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

fijal at codespeak.net fijal at codespeak.net
Fri Jun 5 01:38:15 CEST 2009


Author: fijal
Date: Fri Jun  5 01:38:12 2009
New Revision: 65600

Modified:
   pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize.py
   pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_basic.py
Log:
A test and a fix


Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/optimize.py	Fri Jun  5 01:38:12 2009
@@ -411,10 +411,17 @@
                 for box in op.args:
                     if isinstance(box, Box):
                         self.getnode(box).escaped = True
+            if op.is_guard():
+                self.find_nodes_guard(op)
             box = op.result
             if box is not None:
                 self.nodes[box] = InstanceNode(box, escaped=True)
 
+    def find_nodes_guard(self, op):
+        assert len(op.suboperations) == 1
+        for arg in op.suboperations[0].args:
+            self.getnode(arg)
+
     def recursively_find_escaping_values(self):
         end_args = self.loop.operations[-1].args
         assert len(self.loop.inputargs) == len(end_args)

Modified: pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_basic.py
==============================================================================
--- pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_basic.py	(original)
+++ pypy/branch/pyjitpl5-experiments/pypy/jit/metainterp/test/test_basic.py	Fri Jun  5 01:38:12 2009
@@ -674,6 +674,28 @@
         res = self.meta_interp(f, [30])
         assert res == 1
 
+    def test_pass_around(self):
+        myjitdriver = JitDriver(greens = [], reds = ['n', 'x'])
+
+        def call():
+            pass
+
+        def f(n, x):
+            while n > 0:
+                myjitdriver.can_enter_jit(n=n, x=x)
+                myjitdriver.jit_merge_point(n=n, x=x)
+                if n % 2:
+                    call()
+                    if n == 8:
+                        return x
+                    x = 3
+                else:
+                    x = 5
+                n -= 1
+            return 0
+
+        self.meta_interp(f, [40, 0])
+
 class TestOOtype(BasicTests, OOJitMixin):
 
     def test_oohash(self):



More information about the Pypy-commit mailing list