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

arigo at codespeak.net arigo at codespeak.net
Wed Feb 11 17:06:00 CET 2009


Author: arigo
Date: Wed Feb 11 17:06:00 2009
New Revision: 61740

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtual.py
Log:
(arigo, fijal)
try to have the same args in jump and merge point


Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py	Wed Feb 11 17:06:00 2009
@@ -313,23 +313,24 @@
                 instnode.virtual = True
 
     def expanded_version_of(self, boxlist):
-        memo = {}
         newboxlist = []
-        for box in boxlist:
-            self.expanded_version_of_rec(self.nodes[box], newboxlist, memo)
+        assert len(boxlist) == len(self.specnodes)
+        for i in range(len(boxlist)):
+            box = boxlist[i]
+            specnode = self.specnodes[i]
+            self.expanded_version_of_rec(specnode, self.nodes[box], newboxlist)
         return newboxlist
 
-    def expanded_version_of_rec(self, instnode, newboxlist, memo):
-        if instnode in memo:
-            return
-        memo[instnode] = None
-        if not instnode.virtual:
+    def expanded_version_of_rec(self, specnode, instnode, newboxlist):
+        if not isinstance(specnode, VirtualInstanceSpecNode):
             newboxlist.append(instnode.source)
-            return
-        lst = instnode.curfields.items()
-        lst.sort()
-        for _, subinstnode in lst:
-            self.expanded_version_of_rec(subinstnode, newboxlist, memo)
+        else:
+            lst = specnode.fields.items()
+            lst.sort()
+            for ofs, subspecnode in lst:
+                subinstnode = instnode.curfields[ofs]  # should really be there
+                self.expanded_version_of_rec(subspecnode, subinstnode,
+                                             newboxlist)
 
     def optimize_guard(self, op):
         liveboxes = []

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtual.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtual.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_virtual.py	Wed Feb 11 17:06:00 2009
@@ -99,7 +99,7 @@
                 n -= 1
             return node.value
         res = self.meta_interp(f, [10])
-        assert res == 255
+        assert res == f(10)
         self.check_loop_count(2)
         self.check_loops(new=0, new_with_vtable=0,
                                 getfield_gc__4=0, getfield_gc_ptr=0,



More information about the Pypy-commit mailing list