Author: Maciej Fijalkowski <[email protected]>
Branch: optresult
Changeset: r74593:efc7b11cbda1
Date: 2014-11-19 12:01 +0200
http://bitbucket.org/pypy/pypy/changeset/efc7b11cbda1/
Log: stop cloning stuff in compile.py, we need to investigate why it
happens
diff --git a/rpython/jit/metainterp/compile.py
b/rpython/jit/metainterp/compile.py
--- a/rpython/jit/metainterp/compile.py
+++ b/rpython/jit/metainterp/compile.py
@@ -10,8 +10,8 @@
from rpython.tool.sourcetools import func_with_new_name
from rpython.jit.metainterp.resoperation import ResOperation, rop,
get_deep_immutable_oplist
-from rpython.jit.metainterp.history import (TreeLoop, Box, JitCellToken,
- TargetToken, AbstractFailDescr, BoxInt, BoxPtr, BoxFloat, ConstInt)
+from rpython.jit.metainterp.history import (TreeLoop, Const, JitCellToken,
+ TargetToken, AbstractFailDescr, ConstInt)
from rpython.jit.metainterp import history, jitexc
from rpython.jit.metainterp.optimize import InvalidLoop
from rpython.jit.metainterp.inliner import Inliner
@@ -130,7 +130,7 @@
h_ops = history.operations
# XXX why do we clone here?
part.operations = [ResOperation(rop.LABEL, inputargs,
descr=TargetToken(jitcell_token))] + \
- [h_ops[i].clone() for i in range(start, len(h_ops))] + \
+ [h_ops[i] for i in range(start, len(h_ops))] + \
[ResOperation(rop.LABEL, jumpargs, descr=jitcell_token)]
try:
@@ -172,7 +172,7 @@
if not loop.quasi_immutable_deps:
loop.quasi_immutable_deps = None
for box in loop.inputargs:
- assert isinstance(box, Box)
+ assert not isinstance(box, Const)
loop.original_jitcell_token = jitcell_token
for label in all_target_tokens:
@@ -206,10 +206,10 @@
h_ops = history.operations
part.operations = [partial_trace.operations[-1]] + \
- [h_ops[i].clone() for i in range(start, len(h_ops))] + \
+ [h_ops[i] for i in range(start, len(h_ops))] + \
[ResOperation(rop.JUMP, jumpargs, None,
descr=loop_jitcell_token)]
label = part.operations[0]
- orignial_label = label.clone()
+ orignial_label = label
assert label.getopnum() == rop.LABEL
try:
optimize_trace(metainterp_sd, part, jitdriver_sd.warmstate.enable_opts)
@@ -784,7 +784,7 @@
new_trace.inputargs = metainterp.history.inputargs[:]
# clone ops, as optimize_bridge can mutate the ops
- new_trace.operations = [op.clone() for op in metainterp.history.operations]
+ new_trace.operations = [op for op in metainterp.history.operations]
metainterp_sd = metainterp.staticdata
state = metainterp.jitdriver_sd.warmstate
if isinstance(resumekey, ResumeAtPositionDescr):
diff --git a/rpython/jit/metainterp/history.py
b/rpython/jit/metainterp/history.py
--- a/rpython/jit/metainterp/history.py
+++ b/rpython/jit/metainterp/history.py
@@ -412,6 +412,7 @@
_attrs_ = ('value',)
def __init__(self, value=0):
+ xxx
if not we_are_translated():
if is_valid_int(value):
value = int(value) # bool -> int
@@ -451,6 +452,7 @@
_attrs_ = ('value',)
def __init__(self, valuestorage=longlong.ZEROF):
+ xxxx
assert lltype.typeOf(valuestorage) is longlong.FLOATSTORAGE
self.value = valuestorage
@@ -483,6 +485,7 @@
_attrs_ = ('value',)
def __init__(self, value=lltype.nullptr(llmemory.GCREF.TO)):
+ xxx
assert lltype.typeOf(value) == llmemory.GCREF
self.value = value
@@ -516,7 +519,6 @@
_getrepr_ = repr_pointer
-NULLBOX = BoxPtr()
# ____________________________________________________________
@@ -690,7 +692,8 @@
@staticmethod
def check_consistency_of(inputargs, operations):
for box in inputargs:
- assert isinstance(box, Box), "Loop.inputargs contains %r" % (box,)
+ assert (not isinstance(box, Const),
+ "Loop.inputargs contains %r" % (box,))
seen = dict.fromkeys(inputargs)
assert len(seen) == len(inputargs), (
"duplicate Box in the Loop.inputargs")
@@ -699,11 +702,10 @@
@staticmethod
def check_consistency_of_branch(operations, seen):
"NOT_RPYTHON"
- return # XXX for now
for op in operations:
for i in range(op.numargs()):
box = op.getarg(i)
- if isinstance(box, Box):
+ if not isinstance(box, Const):
assert box in seen
if op.is_guard():
assert op.getdescr() is not None
@@ -712,19 +714,16 @@
TreeLoop.check_consistency_of_branch(ops, seen.copy())
for box in op.getfailargs() or []:
if box is not None:
- assert isinstance(box, Box)
+ assert not isinstance(box, Const)
assert box in seen
else:
assert op.getfailargs() is None
- box = op.result
- if box is not None:
- assert isinstance(box, Box)
- assert box not in seen
- seen[box] = True
+ if op.type != 'v':
+ seen[op] = True
if op.getopnum() == rop.LABEL:
inputargs = op.getarglist()
for box in inputargs:
- assert isinstance(box, Box), "LABEL contains %r" % (box,)
+ assert not isinstance(box, Const), "LABEL contains %r" %
(box,)
seen = dict.fromkeys(inputargs)
assert len(seen) == len(inputargs), (
"duplicate Box in the LABEL arguments")
diff --git a/rpython/jit/metainterp/warmstate.py
b/rpython/jit/metainterp/warmstate.py
--- a/rpython/jit/metainterp/warmstate.py
+++ b/rpython/jit/metainterp/warmstate.py
@@ -2,7 +2,7 @@
import weakref
from rpython.jit.codewriter import support, heaptracker, longlong
-from rpython.jit.metainterp import history
+from rpython.jit.metainterp import resoperation, history
from rpython.rlib.debug import debug_start, debug_stop, debug_print
from rpython.rlib.jit import PARAMETERS
from rpython.rlib.nonconst import NonConstant
@@ -73,7 +73,7 @@
if in_const_box:
return history.ConstPtr(value)
else:
- return history.BoxPtr(value)
+ return resoperation.InputArgRef(value)
else:
adr = llmemory.cast_ptr_to_adr(value)
value = heaptracker.adr2int(adr)
@@ -87,7 +87,7 @@
if in_const_box:
return history.ConstFloat(value)
else:
- return history.BoxFloat(value)
+ return resoperation.InputArgFloat(value)
elif isinstance(value, str) or isinstance(value, unicode):
assert len(value) == 1 # must be a character
value = ord(value)
@@ -98,7 +98,7 @@
if in_const_box:
return history.ConstInt(value)
else:
- return history.BoxInt(value)
+ return resoperation.InputArgInt(value)
@specialize.arg(0)
def equal_whatever(TYPE, x, y):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit