[pypy-svn] pypy jit-short-preamble: make test 32bit compatible

hakanardo commits-noreply at bitbucket.org
Thu Jan 20 15:36:19 CET 2011


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-short-preamble
Changeset: r41034:c0370c3a597f
Date: 2011-01-20 15:33 +0100
http://bitbucket.org/pypy/pypy/changeset/c0370c3a597f/

Log:	make test 32bit compatible

diff --git a/pypy/jit/metainterp/test/test_basic.py b/pypy/jit/metainterp/test/test_basic.py
--- a/pypy/jit/metainterp/test/test_basic.py
+++ b/pypy/jit/metainterp/test/test_basic.py
@@ -1854,7 +1854,7 @@
                 return A(self.val + other.val)
         class B(Base):
             def binop(self, other):
-                return B(self.val * other.val)
+                return B(self.val - other.val)
         def f(x, y):
             res = x
             array = [1, 2, 3]
@@ -1924,6 +1924,33 @@
         res = self.meta_interp(g, [3, 14])
         assert res == g(3, 14)
 
+    def test_inlined_guard_in_short_preamble(self):
+        myjitdriver = JitDriver(greens = [], reds = ['y', 'x', 'z', 'res'])
+        class A:
+            def __init__(self, val):
+                self.val = val
+            def getval(self):
+                return self.val
+            def binop(self, other):
+                return A(self.getval() + other.getval())
+        def f(x, y, z):
+            res = x
+            while y > 0:
+                myjitdriver.can_enter_jit(y=y, x=x, z=z, res=res)
+                myjitdriver.jit_merge_point(y=y, x=x, z=z, res=res)
+                res = res.binop(x)
+                y -= 1
+                if y < 7:
+                    x = z
+            return res
+        def g(x, y):
+            a1 = f(A(x), y, A(x))
+            a2 = f(A(x), y, A(x))
+            assert a1.val == a2.val
+            return a1.val
+        res = self.meta_interp(g, [3, 14])
+        assert res == g(3, 14)
+
     def test_specialied_bridge(self):
         myjitdriver = JitDriver(greens = [], reds = ['y', 'x', 'res'])
         class A:


More information about the Pypy-commit mailing list