Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r75161:70e5803eaf3c
Date: 2014-12-30 14:42 +0200
http://bitbucket.org/pypy/pypy/changeset/70e5803eaf3c/
Log: Merge dont-copy-ops - don't make clones of ops before sending them
to optimizer
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
@@ -127,9 +127,10 @@
part = create_empty_loop(metainterp)
part.inputargs = inputargs[:]
h_ops = history.operations
- part.operations = [ResOperation(rop.LABEL, inputargs, None,
descr=TargetToken(jitcell_token))] + \
- [h_ops[i].clone() for i in range(start, len(h_ops))] + \
- [ResOperation(rop.LABEL, jumpargs, None,
descr=jitcell_token)]
+ label = ResOperation(rop.LABEL, inputargs, None,
+ descr=TargetToken(jitcell_token))
+ end_label = ResOperation(rop.LABEL, jumpargs, None, descr=jitcell_token)
+ part.operations = [label] + h_ops[start:] + [end_label]
try:
start_state = optimize_trace(metainterp_sd, jitdriver_sd, part,
@@ -207,7 +208,7 @@
h_ops = history.operations
part.operations = [partial_trace.operations[-1]] + \
- [h_ops[i].clone() for i in range(start, len(h_ops))] + \
+ h_ops[start:] + \
[ResOperation(rop.JUMP, jumpargs, None,
descr=loop_jitcell_token)]
label = part.operations[0]
orignial_label = label.clone()
@@ -767,8 +768,7 @@
hidden_all_virtuals = obj.hide(metainterp_sd.cpu)
metainterp_sd.cpu.set_savedata_ref(deadframe, hidden_all_virtuals)
-def invent_fail_descr_for_op(op, optimizer):
- opnum = op.getopnum()
+def invent_fail_descr_for_op(opnum, optimizer):
if opnum == rop.GUARD_NOT_FORCED or opnum == rop.GUARD_NOT_FORCED_2:
resumedescr = ResumeGuardForcedDescr()
resumedescr._init(optimizer.metainterp_sd, optimizer.jitdriver_sd)
@@ -836,9 +836,8 @@
# it does not work -- i.e. none of the existing old_loop_tokens match.
new_trace = create_empty_loop(metainterp)
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 = metainterp.history.operations[:]
metainterp_sd = metainterp.staticdata
jitdriver_sd = metainterp.jitdriver_sd
state = jitdriver_sd.warmstate
diff --git a/rpython/jit/metainterp/optimizeopt/heap.py
b/rpython/jit/metainterp/optimizeopt/heap.py
--- a/rpython/jit/metainterp/optimizeopt/heap.py
+++ b/rpython/jit/metainterp/optimizeopt/heap.py
@@ -94,10 +94,12 @@
else:
return self._cached_fields.get(structvalue, None)
- def remember_field_value(self, structvalue, fieldvalue, getfield_op=None):
+ def remember_field_value(self, structvalue, fieldvalue, op=None,
+ optimizer=None):
assert self._lazy_setfield is None
self._cached_fields[structvalue] = fieldvalue
- self._cached_fields_getfield_op[structvalue] = getfield_op
+ op = optimizer.get_op_replacement(op)
+ self._cached_fields_getfield_op[structvalue] = op
def force_lazy_setfield(self, optheap, can_cache=True):
op = self._lazy_setfield
@@ -121,7 +123,8 @@
# field.
structvalue = optheap.getvalue(op.getarg(0))
fieldvalue = optheap.getvalue(op.getarglist()[-1])
- self.remember_field_value(structvalue, fieldvalue, op)
+ self.remember_field_value(structvalue, fieldvalue, op,
+ optheap.optimizer)
elif not can_cache:
self.clear()
@@ -446,7 +449,7 @@
self.emit_operation(op)
# then remember the result of reading the field
fieldvalue = self.getvalue(op.result)
- cf.remember_field_value(structvalue, fieldvalue, op)
+ cf.remember_field_value(structvalue, fieldvalue, op, self.optimizer)
def optimize_GETFIELD_GC_PURE(self, op):
structvalue = self.getvalue(op.getarg(0))
@@ -490,7 +493,7 @@
# the remember the result of reading the array item
if cf is not None:
fieldvalue = self.getvalue(op.result)
- cf.remember_field_value(arrayvalue, fieldvalue, op)
+ cf.remember_field_value(arrayvalue, fieldvalue, op, self.optimizer)
def optimize_GETARRAYITEM_GC_PURE(self, op):
arrayvalue = self.getvalue(op.getarg(0))
diff --git a/rpython/jit/metainterp/optimizeopt/optimizer.py
b/rpython/jit/metainterp/optimizeopt/optimizer.py
--- a/rpython/jit/metainterp/optimizeopt/optimizer.py
+++ b/rpython/jit/metainterp/optimizeopt/optimizer.py
@@ -75,7 +75,7 @@
if other.getlevel() == LEVEL_CONSTANT:
self.make_constant(other.get_key_box())
elif other.getlevel() == LEVEL_KNOWNCLASS:
- self.make_constant_class(other.get_known_class(), None)
+ self.make_constant_class(None, other.get_known_class())
else:
if other.getlevel() == LEVEL_NONNULL:
self.ensure_nonnull()
@@ -193,7 +193,7 @@
self.box = constbox
self.setlevel(LEVEL_CONSTANT)
- def get_last_guard(self):
+ def get_last_guard(self, optimizer):
return None
def get_known_class(self):
@@ -209,10 +209,10 @@
return None
class PtrOptValue(OptValue):
- _attrs_ = ('known_class', 'last_guard', 'lenbound')
+ _attrs_ = ('known_class', 'last_guard_pos', 'lenbound')
known_class = None
- last_guard = None
+ last_guard_pos = -1
lenbound = None
def __init__(self, box, level=None, known_class=None, intbound=None):
@@ -225,7 +225,7 @@
self.box = other_value.box
self.known_class = other_value.known_class
self._tag = other_value._tag
- self.last_guard = other_value.last_guard
+ self.last_guard_pos = other_value.last_guard_pos
self.lenbound = other_value.lenbound
def make_len_gt(self, mode, descr, val):
@@ -236,16 +236,20 @@
else:
self.lenbound = LenBound(mode, descr, IntLowerBound(val + 1))
- def make_nonnull(self, guardop):
+ def make_nonnull(self, optimizer):
assert self.getlevel() < LEVEL_NONNULL
self.setlevel(LEVEL_NONNULL)
- self.last_guard = guardop
+ if optimizer is not None:
+ self.last_guard_pos = len(optimizer._newoperations) - 1
+ assert self.get_last_guard(optimizer).is_guard()
- def make_constant_class(self, classbox, guardop):
+ def make_constant_class(self, optimizer, classbox):
assert self.getlevel() < LEVEL_KNOWNCLASS
self.known_class = classbox
self.setlevel(LEVEL_KNOWNCLASS)
- self.last_guard = guardop
+ if optimizer is not None:
+ self.last_guard_pos = len(optimizer._newoperations) - 1
+ assert self.get_last_guard(optimizer).is_guard()
def import_from(self, other, optimizer):
OptValue.import_from(self, other, optimizer)
@@ -300,8 +304,10 @@
def getlenbound(self):
return self.lenbound
- def get_last_guard(self):
- return self.last_guard
+ def get_last_guard(self, optimizer):
+ if self.last_guard_pos == -1:
+ return None
+ return optimizer._newoperations[self.last_guard_pos]
def get_known_class(self):
return self.known_class
@@ -346,7 +352,7 @@
return True
return False
- def make_nonnull(self, guardop):
+ def make_nonnull(self, optimizer):
assert self.getlevel() < LEVEL_NONNULL
self.setlevel(LEVEL_NONNULL)
@@ -375,7 +381,7 @@
def getintbound(self):
return self.intbound
- def get_last_guard(self):
+ def get_last_guard(self, optimizer):
return None
def get_known_class(self):
@@ -547,6 +553,12 @@
self.optimizations = optimizations
+ def replace_guard(self, op, value):
+ assert isinstance(value, PtrOptValue)
+ if value.last_guard_pos == -1:
+ return
+ self.replaces_guard[op] = value.last_guard_pos
+
def force_at_end_of_preamble(self):
for o in self.optimizations:
o.force_at_end_of_preamble()
@@ -593,6 +605,13 @@
self.ensure_imported(value)
return value
+ def get_box_replacement(self, box):
+ try:
+ v = self.values[box]
+ except KeyError:
+ return box
+ return v.get_key_box()
+
def ensure_imported(self, value):
pass
@@ -706,6 +725,8 @@
@specialize.argtype(0)
def _emit_operation(self, op):
assert op.getopnum() != rop.CALL_PURE
+ changed = False
+ orig_op = op
for i in range(op.numargs()):
arg = op.getarg(i)
try:
@@ -714,37 +735,52 @@
pass
else:
self.ensure_imported(value)
- op.setarg(i, value.force_box(self))
+ newbox = value.force_box(self)
+ if arg is not newbox:
+ if not changed:
+ op = op.clone()
+ changed = True
+ op.setarg(i, newbox)
self.metainterp_sd.profiler.count(jitprof.Counters.OPT_OPS)
if op.is_guard():
self.metainterp_sd.profiler.count(jitprof.Counters.OPT_GUARDS)
pendingfields = self.pendingfields
self.pendingfields = None
- if self.replaces_guard and op in self.replaces_guard:
- self.replace_op(self.replaces_guard[op], op)
+ if self.replaces_guard and orig_op in self.replaces_guard:
+ self.replace_op(self.replaces_guard[orig_op], op)
del self.replaces_guard[op]
return
else:
- op = self.store_final_boxes_in_guard(op, pendingfields)
+ guard_op = op.clone()
+ op = self.store_final_boxes_in_guard(guard_op, pendingfields)
elif op.can_raise():
self.exception_might_have_happened = True
+ self._last_emitted_op = orig_op
self._newoperations.append(op)
- def replace_op(self, old_op, new_op):
- # XXX: Do we want to cache indexes to prevent search?
- i = len(self._newoperations)
- while i > 0:
- i -= 1
- if self._newoperations[i] is old_op:
- # a bit of dance to make sure we copy all the attrs on
- # an already emitted descr
- newdescr = new_op.getdescr()
- olddescr = old_op.getdescr()
- newdescr.copy_all_attributes_from(olddescr)
- self._newoperations[i] = new_op
- break
- else:
- assert False
+ def get_op_replacement(self, op):
+ changed = False
+ for i, arg in enumerate(op.getarglist()):
+ try:
+ v = self.values[arg]
+ except KeyError:
+ pass
+ else:
+ box = v.get_key_box()
+ if box is not arg:
+ if not changed:
+ changed = True
+ op = op.clone()
+ op.setarg(i, box)
+ return op
+
+ def replace_op(self, old_op_pos, new_op):
+ old_op = self._newoperations[old_op_pos]
+ assert old_op.is_guard()
+ old_descr = old_op.getdescr()
+ new_descr = new_op.getdescr()
+ new_descr.copy_all_attributes_from(old_descr)
+ self._newoperations[old_op_pos] = new_op
def store_final_boxes_in_guard(self, op, pendingfields):
assert pendingfields is not None
@@ -752,7 +788,7 @@
descr = op.getdescr()
assert isinstance(descr, compile.ResumeAtPositionDescr)
else:
- descr = compile.invent_fail_descr_for_op(op, self)
+ descr = compile.invent_fail_descr_for_op(op.getopnum(), self)
op.setdescr(descr)
assert isinstance(descr, compile.ResumeGuardDescr)
assert isinstance(op, GuardResOp)
@@ -791,13 +827,7 @@
n = op.numargs()
args = [None] * (n + 2)
for i in range(n):
- arg = op.getarg(i)
- try:
- value = self.values[arg]
- except KeyError:
- pass
- else:
- arg = value.get_key_box()
+ arg = self.get_box_replacement(op.getarg(i))
args[i] = arg
args[n] = ConstInt(op.getopnum())
args[n + 1] = op.getdescr()
diff --git a/rpython/jit/metainterp/optimizeopt/pure.py
b/rpython/jit/metainterp/optimizeopt/pure.py
--- a/rpython/jit/metainterp/optimizeopt/pure.py
+++ b/rpython/jit/metainterp/optimizeopt/pure.py
@@ -26,6 +26,7 @@
nextop = None
args = None
+ remember = None
if canfold:
for i in range(op.numargs()):
if self.get_constant_box(op.getarg(i)) is None:
@@ -45,7 +46,7 @@
self.optimizer.make_equal_to(op.result, oldvalue, True)
return
else:
- self.remember_emitting_pure(op)
+ remember = op
# otherwise, the operation remains
self.emit_operation(op)
@@ -55,6 +56,8 @@
self.emit_operation(nextop)
if args is not None:
self.pure_operations[args] = self.getvalue(op.result)
+ if remember:
+ self.remember_emitting_pure(remember)
def optimize_CALL_PURE(self, op):
# Step 1: check if all arguments are constant
@@ -77,12 +80,12 @@
return
else:
self.pure_operations[args] = self.getvalue(op.result)
- self.remember_emitting_pure(op)
# replace CALL_PURE with just CALL
args = op.getarglist()
self.emit_operation(ResOperation(rop.CALL, args, op.result,
op.getdescr()))
+ self.remember_emitting_pure(op)
def optimize_GUARD_NO_EXCEPTION(self, op):
if self.last_emitted_operation is REMOVED:
@@ -112,6 +115,7 @@
return self.pure_operations.get(key, None)
def remember_emitting_pure(self, op):
+ op = self.optimizer.get_op_replacement(op)
self.emitted_pure_operations[op] = True
def produce_potential_short_preamble_ops(self, sb):
diff --git a/rpython/jit/metainterp/optimizeopt/rewrite.py
b/rpython/jit/metainterp/optimizeopt/rewrite.py
--- a/rpython/jit/metainterp/optimizeopt/rewrite.py
+++ b/rpython/jit/metainterp/optimizeopt/rewrite.py
@@ -284,7 +284,7 @@
raise InvalidLoop('A GUARD_NONNULL (%s) was proven to always fail'
% r)
self.emit_operation(op)
- value.make_nonnull(op)
+ value.make_nonnull(self.optimizer)
def optimize_GUARD_VALUE(self, op):
value = self.getvalue(op.getarg(0))
@@ -296,11 +296,11 @@
else:
name = "<unknown>"
raise InvalidLoop('A promote of a virtual %s (a recently allocated
object) never makes sense!' % name)
- if value.get_last_guard():
+ old_guard_op = value.get_last_guard(self.optimizer)
+ if old_guard_op:
# there already has been a guard_nonnull or guard_class or
# guard_nonnull_class on this value, which is rather silly.
# replace the original guard with a guard_value
- old_guard_op = value.get_last_guard()
if old_guard_op.getopnum() != rop.GUARD_NONNULL:
# This is only safe if the class of the guard_value matches the
# class of the guard_*_class, otherwise the intermediate ops
might
@@ -316,11 +316,11 @@
op = old_guard_op.copy_and_change(rop.GUARD_VALUE,
args = [old_guard_op.getarg(0), op.getarg(1)],
descr = descr)
- self.optimizer.replaces_guard[op] = old_guard_op
+ self.optimizer.replace_guard(op, value)
descr.make_a_counter_per_value(op)
# to be safe
if isinstance(value, PtrOptValue):
- value.last_guard = None
+ value.last_guard_pos = -1
constbox = op.getarg(1)
assert isinstance(constbox, Const)
self.optimize_guard(op, constbox)
@@ -339,7 +339,7 @@
if realclassbox is not None:
assert realclassbox.same_constant(expectedclassbox)
return
- value.make_constant_class(expectedclassbox, None)
+ value.make_constant_class(None, expectedclassbox)
def optimize_GUARD_CLASS(self, op):
value = self.getvalue(op.getarg(0))
@@ -353,10 +353,10 @@
raise InvalidLoop('A GUARD_CLASS (%s) was proven to always fail'
% r)
assert isinstance(value, PtrOptValue)
- if value.last_guard:
+ old_guard_op = value.get_last_guard(self.optimizer)
+ if old_guard_op:
# there already has been a guard_nonnull or guard_class or
# guard_nonnull_class on this value.
- old_guard_op = value.last_guard
if old_guard_op.getopnum() == rop.GUARD_NONNULL:
# it was a guard_nonnull, which we replace with a
# guard_nonnull_class.
@@ -364,9 +364,14 @@
op = old_guard_op.copy_and_change (rop.GUARD_NONNULL_CLASS,
args = [old_guard_op.getarg(0), op.getarg(1)],
descr=descr)
- self.optimizer.replaces_guard[op] = old_guard_op
+ self.optimizer.replace_guard(op, value)
+ # not emitting the guard, so we have to pass None to
+ # make_constant_class, so last_guard_pos is not updated
+ self.emit_operation(op)
+ value.make_constant_class(None, expectedclassbox)
+ return
self.emit_operation(op)
- value.make_constant_class(expectedclassbox, op)
+ value.make_constant_class(self.optimizer, expectedclassbox)
def optimize_GUARD_NONNULL_CLASS(self, op):
value = self.getvalue(op.getarg(0))
diff --git a/rpython/jit/metainterp/optimizeopt/simplify.py
b/rpython/jit/metainterp/optimizeopt/simplify.py
--- a/rpython/jit/metainterp/optimizeopt/simplify.py
+++ b/rpython/jit/metainterp/optimizeopt/simplify.py
@@ -48,6 +48,7 @@
def optimize_JUMP(self, op):
if not self.unroll:
+ op = op.clone()
descr = op.getdescr()
assert isinstance(descr, JitCellToken)
if not descr.target_tokens:
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_virtualstate.py
b/rpython/jit/metainterp/optimizeopt/test/test_virtualstate.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_virtualstate.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_virtualstate.py
@@ -125,12 +125,12 @@
ptr = PtrOptValue(BoxPtr())
nonnull = PtrOptValue(BoxPtr())
- nonnull.make_nonnull(0)
+ nonnull.make_nonnull(None)
knownclass = PtrOptValue(BoxPtr())
clsbox = self.cpu.ts.cls_of_box(BoxPtr(self.myptr))
- knownclass.make_constant_class(clsbox, 0)
+ knownclass.make_constant_class(None, clsbox)
const = PtrOptValue(BoxPtr)
- const.make_constant_class(clsbox, 0)
+ const.make_constant_class(None, clsbox)
const.make_constant(ConstPtr(self.myptr))
inorder = [ptr, nonnull, knownclass, const]
for i in range(len(inorder)):
@@ -181,18 +181,18 @@
def test_known_class_generalization(self):
knownclass1 = PtrOptValue(BoxPtr())
- knownclass1.make_constant_class(ConstPtr(self.myptr), 0)
+ knownclass1.make_constant_class(None, ConstPtr(self.myptr))
info1 = NotVirtualStateInfo(knownclass1)
info1.position = 0
knownclass2 = PtrOptValue(BoxPtr())
- knownclass2.make_constant_class(ConstPtr(self.myptr), 0)
+ knownclass2.make_constant_class(None, ConstPtr(self.myptr))
info2 = NotVirtualStateInfo(knownclass2)
info2.position = 0
self.check_no_guards(info1, info2)
self.check_no_guards(info2, info1)
knownclass3 = PtrOptValue(BoxPtr())
- knownclass3.make_constant_class(ConstPtr(self.myptr2), 0)
+ knownclass3.make_constant_class(None, ConstPtr(self.myptr2))
info3 = NotVirtualStateInfo(knownclass3)
info3.position = 0
self.check_invalid(info1, info3)
@@ -221,11 +221,11 @@
knownclass_val = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- knownclass_val.make_constant_class(classbox, -1)
+ knownclass_val.make_constant_class(None, classbox,)
knownclass_info = NotVirtualStateInfo(knownclass_val)
knownclass2_val = PtrOptValue(self.nodebox2)
classbox = self.cpu.ts.cls_of_box(self.nodebox2)
- knownclass2_val.make_constant_class(classbox, -1)
+ knownclass2_val.make_constant_class(None, classbox)
knownclass2_info = NotVirtualStateInfo(knownclass2_val)
constant_val = IntOptValue(BoxInt())
@@ -384,7 +384,7 @@
def test_known_class(self):
value1 = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value1.make_constant_class(classbox, -1)
+ value1.make_constant_class(None, classbox)
info1 = NotVirtualStateInfo(value1)
info2 = NotVirtualStateInfo(PtrOptValue(self.nodebox))
expected = """
@@ -397,7 +397,7 @@
def test_known_class_value(self):
value1 = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value1.make_constant_class(classbox, -1)
+ value1.make_constant_class(None, classbox)
box = self.nodebox
guards = value1.make_guards(box)
expected = """
@@ -421,7 +421,7 @@
def test_equal_inputargs(self):
value = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
vstate1 = VirtualState([knownclass_info, knownclass_info])
assert vstate1.generalization_of(vstate1)
@@ -458,7 +458,7 @@
def test_generate_guards_on_virtual_fields_matches_array(self):
innervalue1 = PtrOptValue(self.nodebox)
constclassbox = self.cpu.ts.cls_of_box(self.nodebox)
- innervalue1.make_constant_class(constclassbox, -1)
+ innervalue1.make_constant_class(None, constclassbox)
innerinfo1 = NotVirtualStateInfo(innervalue1)
innerinfo1.position = 1
innerinfo2 = NotVirtualStateInfo(PtrOptValue(self.nodebox))
@@ -484,7 +484,7 @@
def test_generate_guards_on_virtual_fields_matches_instance(self):
innervalue1 = PtrOptValue(self.nodebox)
constclassbox = self.cpu.ts.cls_of_box(self.nodebox)
- innervalue1.make_constant_class(constclassbox, -1)
+ innervalue1.make_constant_class(None, constclassbox)
innerinfo1 = NotVirtualStateInfo(innervalue1)
innerinfo1.position = 1
innerinfo2 = NotVirtualStateInfo(PtrOptValue(self.nodebox))
@@ -508,7 +508,7 @@
def test_generate_guards_on_virtual_fields_matches_struct(self):
innervalue1 = PtrOptValue(self.nodebox)
constclassbox = self.cpu.ts.cls_of_box(self.nodebox)
- innervalue1.make_constant_class(constclassbox, -1)
+ innervalue1.make_constant_class(None, constclassbox)
innerinfo1 = NotVirtualStateInfo(innervalue1)
innerinfo1.position = 1
innerinfo2 = NotVirtualStateInfo(PtrOptValue(self.nodebox))
@@ -534,7 +534,7 @@
def test_generate_guards_on_virtual_fields_matches_arraystruct(self):
innervalue1 = PtrOptValue(self.nodebox)
constclassbox = self.cpu.ts.cls_of_box(self.nodebox)
- innervalue1.make_constant_class(constclassbox, -1)
+ innervalue1.make_constant_class(None, constclassbox)
innerinfo1 = NotVirtualStateInfo(innervalue1)
innerinfo1.position = 1
innerinfo2 = NotVirtualStateInfo(PtrOptValue(self.nodebox))
@@ -565,7 +565,7 @@
info1 = VirtualStateInfo(ConstInt(42), [1, 2])
value = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info1.fieldstate = [knownclass_info, knownclass_info]
vstate1 = VirtualState([info1])
@@ -593,7 +593,7 @@
info1 = VirtualStateInfo(ConstInt(42), [1, 2])
value = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info1.fieldstate = [knownclass_info, knownclass_info]
vstate1 = VirtualState([info1])
@@ -602,7 +602,7 @@
info2 = VirtualStateInfo(ConstInt(42), [1, 2])
value = PtrOptValue(self.nodebox2)
classbox = self.cpu.ts.cls_of_box(self.nodebox2)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info2.fieldstate = [knownclass_info, knownclass_info]
vstate2 = VirtualState([info2])
@@ -615,7 +615,7 @@
info1 = VirtualStateInfo(ConstInt(42), [10, 20])
value = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info1.fieldstate = [knownclass_info, knownclass_info]
vstate1 = VirtualState([info1])
@@ -624,7 +624,7 @@
info2 = VirtualStateInfo(ConstInt(42), [1, 2])
value = PtrOptValue(self.nodebox2)
classbox = self.cpu.ts.cls_of_box(self.nodebox2)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info2.fieldstate = [knownclass_info, knownclass_info]
vstate2 = VirtualState([info2])
@@ -637,7 +637,7 @@
info1 = VirtualStateInfo(ConstInt(42), [1, 2])
value = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info1.fieldstate = [knownclass_info, knownclass_info]
vstate1 = VirtualState([info1])
@@ -646,7 +646,7 @@
info2 = VirtualStateInfo(ConstInt(7), [1, 2])
value = PtrOptValue(self.nodebox2)
classbox = self.cpu.ts.cls_of_box(self.nodebox2)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info2.fieldstate = [knownclass_info, knownclass_info]
vstate2 = VirtualState([info2])
@@ -659,7 +659,7 @@
info1 = VirtualStateInfo(ConstInt(42), [1, 2])
value = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info1.fieldstate = [knownclass_info, knownclass_info]
vstate1 = VirtualState([info1])
@@ -676,7 +676,7 @@
info1 = VArrayStateInfo(42)
value = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info1.fieldstate = [knownclass_info, knownclass_info]
vstate1 = VirtualState([info1])
@@ -685,7 +685,7 @@
info2 = VArrayStateInfo(42)
value = PtrOptValue(self.nodebox2)
classbox = self.cpu.ts.cls_of_box(self.nodebox2)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info2.fieldstate = [knownclass_info, knownclass_info]
vstate2 = VirtualState([info2])
@@ -698,7 +698,7 @@
info1 = VArrayStateInfo(42)
value = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info1.fieldstate = [knownclass_info, knownclass_info]
vstate1 = VirtualState([info1])
@@ -707,7 +707,7 @@
info2 = VArrayStateInfo(42)
value = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info2.fieldstate = [knownclass_info]
vstate2 = VirtualState([info2])
@@ -720,7 +720,7 @@
info1 = VArrayStateInfo(42)
value = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info1.fieldstate = [knownclass_info, knownclass_info]
vstate1 = VirtualState([info1])
@@ -729,7 +729,7 @@
info2 = VArrayStateInfo(7)
value = PtrOptValue(self.nodebox2)
classbox = self.cpu.ts.cls_of_box(self.nodebox2)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info2.fieldstate = [knownclass_info, knownclass_info]
vstate2 = VirtualState([info2])
@@ -742,7 +742,7 @@
info1 = VArrayStateInfo(42)
value = PtrOptValue(self.nodebox)
classbox = self.cpu.ts.cls_of_box(self.nodebox)
- value.make_constant_class(classbox, -1)
+ value.make_constant_class(None, classbox)
knownclass_info = NotVirtualStateInfo(value)
info1.fieldstate = [knownclass_info, knownclass_info]
vstate1 = VirtualState([info1])
@@ -759,7 +759,7 @@
def test_crash_varay_clear(self):
innervalue1 = PtrOptValue(self.nodebox)
constclassbox = self.cpu.ts.cls_of_box(self.nodebox)
- innervalue1.make_constant_class(constclassbox, -1)
+ innervalue1.make_constant_class(None, constclassbox)
innerinfo1 = NotVirtualStateInfo(innervalue1)
innerinfo1.position = 1
innerinfo1.position_in_notvirtuals = 0
diff --git a/rpython/jit/metainterp/optimizeopt/unroll.py
b/rpython/jit/metainterp/optimizeopt/unroll.py
--- a/rpython/jit/metainterp/optimizeopt/unroll.py
+++ b/rpython/jit/metainterp/optimizeopt/unroll.py
@@ -135,6 +135,7 @@
else:
debug_print("Retrace count reached, jumping to preamble")
assert cell_token.target_tokens[0].virtual_state is None
+ jumpop = jumpop.clone()
jumpop.setdescr(cell_token.target_tokens[0])
self.optimizer.send_extra_operation(jumpop)
return
@@ -507,6 +508,7 @@
self.import_box(a, inputargs, short_jumpargs, jumpargs)
def jump_to_already_compiled_trace(self, jumpop, patchguardop):
+ jumpop = jumpop.clone()
assert jumpop.getopnum() == rop.JUMP
cell_token = jumpop.getdescr()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit