[pypy-svn] r52048 - pypy/branch/jit-refactoring/pypy/jit/rainbow/test

cfbolz at codespeak.net cfbolz at codespeak.net
Sun Mar 2 16:58:39 CET 2008


Author: cfbolz
Date: Sun Mar  2 16:58:38 2008
New Revision: 52048

Modified:
   pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_promotion.py
Log:
a test showing the current promotion problem


Modified: pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_promotion.py
==============================================================================
--- pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_promotion.py	(original)
+++ pypy/branch/jit-refactoring/pypy/jit/rainbow/test/test_promotion.py	Sun Mar  2 16:58:38 2008
@@ -100,6 +100,33 @@
         assert res == 186
         self.check_insns(int_add=1, int_mul=0, int_sub=0)
 
+    def test_promote_inside_call2(self):
+        py.test.skip("bug in promotion")
+        def ll_two(n):
+            k = hint(n, promote=True)
+            k *= 17
+            return hint(k, variable=True)
+        def ll_function(n, m):
+            hint(None, global_merge_point=True)
+            if not n:
+                return -41
+            if m:
+                return 42
+            return ll_two(n + 1) - 1
+
+        res = self.interpret(ll_function, [10, 0], [], policy=P_NOVIRTUAL)
+        assert res == 186
+        self.check_insns(int_add=1, int_mul=0, int_sub=0)
+
+        res = self.interpret(ll_function, [0, 0], [], policy=P_NOVIRTUAL)
+        assert res == -41
+        self.check_insns(int_add=1, int_mul=0, int_sub=0)
+
+        res = self.interpret(ll_function, [1, 1], [], policy=P_NOVIRTUAL)
+        assert res == 42
+        self.check_insns(int_add=1, int_mul=0, int_sub=0)
+
+
     def test_two_promotions(self):
         def ll_function(n, m):
             hint(None, global_merge_point=True)


More information about the pypy-svn mailing list