Author: Carl Friedrich Bolz <cfb...@gmx.de>
Branch: guard-compatible
Changeset: r85374:482c68485a89
Date: 2016-06-24 15:52 +0200
http://bitbucket.org/pypy/pypy/changeset/482c68485a89/

Log:    another merging test

diff --git a/rpython/jit/metainterp/test/test_compatible.py 
b/rpython/jit/metainterp/test/test_compatible.py
--- a/rpython/jit/metainterp/test/test_compatible.py
+++ b/rpython/jit/metainterp/test/test_compatible.py
@@ -362,3 +362,43 @@
         # trace, two bridges, a finish bridge
         self.check_trace_count(4)
 
+    def test_merge_switch_object(self):
+        S = lltype.GcStruct('S', ('x', lltype.Signed))
+        p1 = lltype.malloc(S)
+        p1.x = 1
+
+        p2 = lltype.malloc(S)
+        p2.x = 1
+
+        driver = jit.JitDriver(greens = [], reds = ['n', 'x', 'y'])
+
+        class A(object):
+            pass
+
+        c = A()
+        c.count = 0
+        @jit.elidable_compatible()
+        def g(s, ignored):
+            c.count += 1
+            return s.x
+
+        def f(n, x, y):
+            while n > 0:
+                driver.jit_merge_point(n=n, x=x, y=y)
+                n -= g(x, "abc")
+                if n % 6 == 5:
+                    n -= 2
+                    x, y = y, x
+
+        def main():
+            g(p1, "def") # make annotator not make argument constant
+            f(1000, p1, p2)
+            f(1000, p2, p1)
+            return c.count
+
+        x = self.meta_interp(main, [])
+
+        assert x < 30
+        # trace, one bridge, a finish bridge
+        self.check_trace_count(3)
+
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to