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

fijal at codespeak.net fijal at codespeak.net
Fri May 29 03:08:07 CEST 2009


Author: fijal
Date: Fri May 29 03:08:04 2009
New Revision: 65486

Modified:
   pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize2.py
   pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_optimize2.py
Log:
Fix the issue, unskip the test.


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	Fri May 29 03:08:04 2009
@@ -218,12 +218,18 @@
             newoperations.append(op)
         print "Length of the loop:", len(newoperations)
         self.loop.operations = newoperations
+
+    def cleanup_nodes(self):
+        for node in self.nodes.values():
+            node.arrayfields.clear()
+            node.cleanfields.clear()
     
     def optimize_loop(self, loop):
         self.nodes = {}
         self.field_caches = {}
         self.loop = loop
         self.find_nodes()
+        self.cleanup_nodes()
         self.optimize_operations()
 
 class ConsecutiveGuardClassRemoval(object):
@@ -244,6 +250,8 @@
         field = op.descr
         if field not in instnode.vdesc.virtuals:
             return False
+        node = spec.getnode(op.args[1])
+        instnode.cleanfields[field] = node
         return True
 
     @staticmethod
@@ -254,6 +262,11 @@
         field = op.descr
         if field not in instnode.vdesc.virtuals:
             return False
+        node = instnode.cleanfields.get(field, None)
+        if node:
+            spec.nodes[op.result] = node
+            node.virtualized = True
+            return True
         node = spec.getnode(op.result)
         node.virtualized = True
         return False
@@ -263,9 +276,24 @@
         instnode = spec.getnode(op.args[0])
         if not instnode.virtualized:
             return False
+        field = op.args[1].getint()
+        node = spec.getnode(op.args[2])
+        instnode.arrayfields[field] = node
         return True
 
     @staticmethod
+    def find_nodes_getarrayitem_gc(op, spec):
+        instnode = spec.getnode(op.args[0])
+        if not instnode.virtualized:
+            return False
+        field = op.args[1].getint()
+        node = instnode.arrayfields.get(field, None)
+        if node is not None:
+            spec.nodes[op.result] = node
+            return True
+        return False
+
+    @staticmethod
     def find_nodes_guard_nonvirtualized(op, spec):
         instnode = spec.getnode(op.args[0])
         if not instnode.allocated_in_loop:

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	Fri May 29 03:08:04 2009
@@ -429,7 +429,6 @@
 
 
     def test_virtual_with_virtualizable_escapes(self):
-        py.test.skip("FIXME")
         pre_op = """
         [p0]
         p1 = new_with_vtable(ConstClass(node_vtable))



More information about the Pypy-commit mailing list