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

arigo at codespeak.net arigo at codespeak.net
Tue Feb 24 16:44:45 CET 2009


Author: arigo
Date: Tue Feb 24 16:44:45 2009
New Revision: 62116

Modified:
   pypy/branch/pyjitpl5/pypy/jit/metainterp/optimize.py
   pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize.py
Log:
Oooups.  Typo in the optimization of 'oois' meant
that it was removed in bogus cases.


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	Tue Feb 24 16:44:45 2009
@@ -761,7 +761,7 @@
             elif opname == 'oois' or opname == 'ooisnot':
                 instnode_x = self.nodes[op.args[0]]
                 instnode_y = self.nodes[op.args[1]]
-                if not instnode_x.virtual or not instnode_y.virtual:
+                if instnode_x.virtual or instnode_y.virtual:
                     box = op.results[0]
                     instnode = InstanceNode(box.constbox(), const=True)
                     self.nodes[box] = instnode

Modified: pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize.py	(original)
+++ pypy/branch/pyjitpl5/pypy/jit/metainterp/test/test_optimize.py	Tue Feb 24 16:44:45 2009
@@ -400,6 +400,31 @@
             Jump('jump', [F.sum2, F.v2, F.n3], []),
         ])
 
+class F2:
+    locals().update(A.__dict__)    # :-)
+    node2 = lltype.malloc(NODE)
+    node3 = lltype.malloc(NODE)
+    node4 = lltype.malloc(NODE)
+    n2 = BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, node2))
+    n3 = BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, node3))
+    n4 = BoxPtr(lltype.cast_opaque_ptr(llmemory.GCREF, node4))
+    vbool1 = BoxInt(0)
+    ops = [
+        MergePoint('merge_point', [n2, n3], []),
+        ResOperation('oois', [n2, n3], [vbool1]),
+        GuardOp('guard_true', [vbool1], []),
+        ResOperation('external', [], [n4]),
+        Jump('jump', [n2, n4], []),
+        ]
+    ops[2].liveboxes = [n2]
+
+def test_F2_optimize_loop():
+    spec = PerfectSpecializer(Loop(F2.ops))
+    spec.find_nodes()
+    spec.intersect_input_and_output()
+    spec.optimize_loop()
+    equaloplists(spec.loop.operations, F2.ops)
+
 # ____________________________________________________________
 
 class G:



More information about the Pypy-commit mailing list