[pypy-svn] r78151 - in pypy/branch/jit-unroll-loops/pypy/jit/metainterp: optimizeopt test

hakanardo at codespeak.net hakanardo at codespeak.net
Thu Oct 21 08:20:15 CEST 2010


Author: hakanardo
Date: Thu Oct 21 08:20:12 2010
New Revision: 78151

Modified:
   pypy/branch/jit-unroll-loops/pypy/jit/metainterp/optimizeopt/unroll.py
   pypy/branch/jit-unroll-loops/pypy/jit/metainterp/optimizeopt/virtualize.py
   pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizeopt.py
Log:
pure_operations inherited from first iteration

Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/optimizeopt/unroll.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/optimizeopt/unroll.py	(original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/optimizeopt/unroll.py	Thu Oct 21 08:20:12 2010
@@ -43,6 +43,11 @@
             if not v.is_constant() and v.box:
                 v.fromstart = True
 
+        for op in self.optimizer.pure_operations.values():
+            v = self.getvalue(op.result)
+            v.fromstart = True
+            
+
         self.snapshot_map ={None: None}
         
         inputargs = []

Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/optimizeopt/virtualize.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/optimizeopt/virtualize.py	(original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/optimizeopt/virtualize.py	Thu Oct 21 08:20:12 2010
@@ -121,6 +121,7 @@
                 fieldvalue = self._fields[ofs]
                 fieldvalue.get_args_for_fail(modifier)
 
+    # FIXME: circular references
     def get_forced_boxes(self):
         if self.box is None:
             lst = self._get_field_descr_list()

Modified: pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizeopt.py
==============================================================================
--- pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizeopt.py	(original)
+++ pypy/branch/jit-unroll-loops/pypy/jit/metainterp/test/test_optimizeopt.py	Thu Oct 21 08:20:12 2010
@@ -1131,8 +1131,8 @@
         jump(i1)
         """
         expected = """
-        [i]
-        jump(5)
+        []
+        jump()
         """
         self.node.value = 5
         self.optimize_loop(ops, 'Not', expected)
@@ -3590,6 +3590,23 @@
         """
         self.optimize_loop(ops, 'Not, Not, Not', expected)
 
+    def test_pure(self):
+        ops = """
+        [p42]
+        p53 = getfield_gc(ConstPtr(myptr), descr=nextdescr)
+        p59 = getfield_gc_pure(p53, descr=valuedescr)
+        i61 = call(1, p59, descr=nonwritedescr)
+        jump(p42)
+        """
+        expected = """
+        [p42, p59]
+        i61 = call(1, p59, descr=nonwritedescr)
+        jump(p42, p59)
+
+        """
+        self.node.value = 5
+        self.optimize_loop(ops, 'Not', expected)
+
     def test_addsub_ovf(self):
         ops = """
         [i0]



More information about the Pypy-commit mailing list