[pypy-svn] r65429 - in pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp: . test

fijal at codespeak.net fijal at codespeak.net
Tue May 26 20:49:08 CEST 2009


Author: fijal
Date: Tue May 26 20:49:08 2009
New Revision: 65429

Modified:
   pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize2.py
   pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_optimize2.py
Log:
put some extra guards on a rebuild path. backend will kill them away anyway
and we can deduce what kind of operations those are. We have no way of passing
this kind of information some other way so far


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	Tue May 26 20:49:08 2009
@@ -22,7 +22,7 @@
         self.cleanfields = {}
         self.arrayfields = {}
         self.virtualized = False
-        self.possibly_virtualized_list = False
+        self.vdesc = None
 
     def __repr__(self):
         flags = ''
@@ -109,11 +109,19 @@
         op.suboperations = []
         for node, d in self.additional_stores.iteritems():
             for field, fieldnode in d.iteritems():
+                gop = ResOperation(rop.GUARD_NONVIRTUALIZED,
+                                   [node.source], None)
+                gop.vdesc = node.vdesc
+                op.suboperations.append(gop)
                 op.suboperations.append(ResOperation(rop.SETFIELD_GC,
                     [node.source, fieldnode.source], None, field))
         for node, d in self.additional_setarrayitems.iteritems():
             for field, (fieldnode, descr) in d.iteritems():
                 box = fieldnode.source
+                gop = ResOperation(rop.GUARD_NONVIRTUALIZED,
+                                   [node.source], None)
+                gop.vdesc = node.vdesc
+                op.suboperations.append(gop) 
                 op.suboperations.append(ResOperation(rop.SETARRAYITEM_GC,
                              [node.source, ConstInt(field), box], None, descr))
         op.suboperations.append(op_fail)
@@ -192,7 +200,7 @@
             spec.nodes[op.result] = node
             return True
         node = spec.getnode(op.result)
-        node.possibly_virtualized_list = True
+        node.virtualized = True
         instnode.cleanfields[field] = node
         return False
 
@@ -214,7 +222,7 @@
     @staticmethod
     def optimize_getarrayitem_gc(op, spec):
         instnode = spec.getnode(op.args[0])
-        if not instnode.possibly_virtualized_list:
+        if not instnode.virtualized:
             return False
         if not spec.getnode(op.args[1]).const:
             raise VirtualizedListAccessedWithVariableArg()
@@ -230,7 +238,7 @@
     @staticmethod
     def optimize_setarrayitem_gc(op, spec):
         instnode = spec.getnode(op.args[0])
-        if not instnode.possibly_virtualized_list:
+        if not instnode.virtualized:
             return False
         argnode = spec.getnode(op.args[1])
         if not argnode.const:

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	Tue May 26 20:49:08 2009
@@ -184,6 +184,7 @@
         i1 = getfield_gc(p0, descr=field_desc)
         i2 = getfield_gc(p0, descr=other_field_desc)
         guard_true(i2)
+            guard_nonvirtualized(p0)
             setfield_gc(p0, i2, descr=field_desc)
             fail()
         """
@@ -251,6 +252,7 @@
         i2 = int_add(i0, i0)
         i3 = int_is_true(i2)
         guard_true(i3)
+            guard_nonvirtualized(p1)
             setarrayitem_gc(p1, 0, i0, descr=array_descr)
             fail()
         """
@@ -279,6 +281,7 @@
         i4 = int_add(i0, i1)
         i5 = int_is_true(i4)
         guard_true(i5)
+            guard_nonvirtualized(p1)
             setarrayitem_gc(p1, 0, i1, descr=array_descr)
             fail()
         """



More information about the Pypy-commit mailing list