Author: Spenser Bauman <[email protected]>
Branch: value-classes
Changeset: r87426:27384c89faf6
Date: 2016-09-27 20:11 -0400
http://bitbucket.org/pypy/pypy/changeset/27384c89faf6/
Log: Guard recursion in generate_guards
diff --git a/rpython/jit/metainterp/optimizeopt/virtualstate.py
b/rpython/jit/metainterp/optimizeopt/virtualstate.py
--- a/rpython/jit/metainterp/optimizeopt/virtualstate.py
+++ b/rpython/jit/metainterp/optimizeopt/virtualstate.py
@@ -21,6 +21,8 @@
class GenerateGuardState(object):
+ _attrs_ = ('optimizer', 'cpu', 'extra_guards', 'renum', 'bad',
'force_boxes')
+
def __init__(self, optimizer=None, guards=None, renum=None, bad=None,
force_boxes=False):
self.optimizer = optimizer
self.cpu = optimizer.cpu
@@ -233,12 +235,10 @@
def make_virtual_copy(self, box, info, optimizer):
optvirtualize = optimizer.optvirtualize
- # newop = ResOperation(rop.NEW_WITH_VTABLE, [], descr=self.typedescr)
opinfo = optvirtualize.make_virtual(self.known_class, box,
self.typedescr)
for i in range(len(info._fields)):
descr = self.fielddescrs[i]
opinfo._fields[i] = self.getfield(box, info, descr, optimizer)
- # optimizer.emit_operation(newop)
return opinfo
def enum_forced_boxes(self, boxes, box, optimizer, force_boxes=False):
@@ -250,13 +250,12 @@
return AbstractVirtualStructStateInfo.enum_forced_boxes(
self, boxes, box, optimizer, force_boxes)
- optvirtualize = optimizer.optimizer
assert isinstance(info, AbstractStructPtrInfo)
# TODO: Do we need to create a new object via NEW_WITH_VTABLE, or will
the
# allocation be handled properly?
opinfo = self.make_virtual_copy(box, info, optimizer.optimizer)
- for i in range(min(len(self.fielddescrs), len(info._fields))):
+ for i in range(min(len(self.fielddescrs), len(opinfo._fields))):
state = self.fieldstate[i]
if state is None:
continue
@@ -328,10 +327,11 @@
fieldbox = ResOperation(opnum, [box], descr=descr)
extra_guards.append(fieldbox)
fieldbox_runtime = None
- other_field_state = not_virtual(cpu, fieldbox.type, opinfo)
fieldstate = self.fieldstate[i]
- fieldstate.generate_guards(other_field_state, fieldbox,
- fieldbox_runtime, state)
+ if fieldstate is not None:
+ other_field_state = not_virtual(cpu, fieldbox.type, opinfo)
+ fieldstate.generate_guards(other_field_state, fieldbox,
+ fieldbox_runtime, state)
def debug_header(self, indent):
debug_print(indent + 'VirtualStateInfo(%d):' % self.position)
diff --git a/rpython/jit/metainterp/test/test_virtual.py
b/rpython/jit/metainterp/test/test_virtual.py
--- a/rpython/jit/metainterp/test/test_virtual.py
+++ b/rpython/jit/metainterp/test/test_virtual.py
@@ -1043,7 +1043,6 @@
return 0
self.meta_interp(f, [])
- import pdb; pdb.set_trace()
def test_aliased_virtual_states(self):
# All cases are covered when forcing one component of the virtual state
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit