[pypy-svn] r65443 - in pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp: . test
fijal at codespeak.net
fijal at codespeak.net
Wed May 27 02:41:09 CEST 2009
Author: fijal
Date: Wed May 27 02:41:07 2009
New Revision: 65443
Modified:
pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize2.py
pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_basic.py
pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_optimize2.py
Log:
cheat - don't virtualize virtualizables that are allocated in a loop. The
reason behind it is that if it does so, it's going to be an argument of a
portal call
Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize2.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize2.py (original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize2.py Wed May 27 02:41:07 2009
@@ -22,6 +22,7 @@
self.cleanfields = {}
self.arrayfields = {}
self.virtualized = False
+ self.allocated_in_loop = False
self.vdesc = None
def __repr__(self):
@@ -83,7 +84,10 @@
self.getnode(box)
box = op.result
if box is not None:
- self.nodes[box] = self.getnode(box)
+ node = self.getnode(box)
+ if op.opnum == rop.NEW or op.opnum == rop.NEW_WITH_VTABLE:
+ node.allocated_in_loop = True
+ self.nodes[box] = node
def new_arguments(self, op):
newboxes = []
@@ -188,8 +192,9 @@
@staticmethod
def optimize_guard_nonvirtualized(op, spec):
instnode = spec.getnode(op.args[0])
- instnode.virtualized = True
- instnode.vdesc = op.vdesc
+ if not instnode.allocated_in_loop:
+ instnode.virtualized = True
+ instnode.vdesc = op.vdesc
return True
@staticmethod
Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_basic.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_basic.py (original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_basic.py Wed May 27 02:41:07 2009
@@ -667,7 +667,6 @@
res = self.meta_interp(f, [30])
assert res == 1
-
class TestOOtype(BasicTests, OOJitMixin):
def test_oohash(self):
Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_optimize2.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_optimize2.py (original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_optimize2.py Wed May 27 02:41:07 2009
@@ -279,7 +279,6 @@
guard_true(i5)
fail()
"""
- pre_op = parse(pre_op, self.cpu, self.namespace)
expected = """
[p0, i0, i1]
p1 = getfield_gc(p0, descr=list_desc)
@@ -294,6 +293,23 @@
self.assert_equal(self.optimize(pre_op, [SimpleVirtualizableOpt()]),
expected)
+ def test_newly_allocated_virtualizable_is_not_virtualized(self):
+ pre_op = """
+ []
+ p0 = new_with_vtable(13, ConstClass(xy_vtable))
+ guard_nonvirtualized(p0, vdesc=vdesc)
+ fail()
+ setfield_gc(p0, 3, descr=field_desc)
+ """
+ expected = """
+ []
+ p0 = new_with_vtable(13, ConstClass(xy_vtable))
+ setfield_gc(p0, 3, descr=field_desc)
+ """
+ self.assert_equal(self.optimize(pre_op, [SimpleVirtualizableOpt()]),
+ expected)
+
+
def test_remove_consecutive_guard_value_constfold(self):
py.test.skip("not yet")
n = BoxInt(0)
More information about the Pypy-commit
mailing list