[pypy-svn] r37722 - pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test

pedronis at codespeak.net pedronis at codespeak.net
Thu Feb 1 12:57:37 CET 2007


Author: pedronis
Date: Thu Feb  1 12:57:36 2007
New Revision: 37722

Modified:
   pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_promotion.py
Log:
a test showing how pypyjit explode now, we need to be much more careful about exception and exception code paths.



Modified: pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_promotion.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_promotion.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/jit/timeshifter/test/test_promotion.py	Thu Feb  1 12:57:36 2007
@@ -1,10 +1,11 @@
 import py
 from pypy.rpython.lltypesystem import lltype
 from pypy.jit.timeshifter.test.test_timeshift import TimeshiftingTests
+from pypy.jit.timeshifter.test.test_timeshift import StopAtXPolicy
 from pypy.jit.timeshifter.test.test_timeshift import P_NOVIRTUAL
 from pypy.jit.timeshifter.test.test_vlist import P_OOPSPEC
 from pypy.rlib.objectmodel import hint
-
+from pypy.rpython.module.support import LLSupport
 
 class TestPromotion(TimeshiftingTests):
 
@@ -299,3 +300,38 @@
         res = self.timeshift(ll_function, [1, 5, 8], [],
                              policy=P_NOVIRTUAL)
         assert res == 22
+
+    def test_raise_result_mixup(self):
+        py.test.skip("WIP")
+        def w(x):
+            pass
+        class E(Exception):
+            def __init__(self, x):
+                self.x = x
+        def o(x):
+            if x < 0:
+                e = E(x)
+                w(e)
+                raise e                
+            return x
+        def ll_function(c, x):
+            i = 0
+            while True:
+                hint(None, global_merge_point=True)
+                op = c[i]
+                hint(op, concrete=True)
+                if op == 'e':
+                    break
+                elif op == 'o':
+                    x = o(x)
+                    x = hint(x, promote=True)
+                    i = x
+            r = hint(i, variable=True)
+            return r
+        ll_function.convert_arguments = [LLSupport.to_rstr, int]
+        
+        assert ll_function("oe", 1) == 1
+
+        res = self.timeshift(ll_function, ["oe", 1], [],
+                             policy=StopAtXPolicy(w))
+        res == 1



More information about the Pypy-commit mailing list