[pypy-commit] pypy default: found an unroll miscompilation

cfbolz noreply at buildbot.pypy.org
Fri Apr 4 14:59:56 CEST 2014


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: 
Changeset: r70436:2b8a59268ac7
Date: 2014-04-04 14:59 +0200
http://bitbucket.org/pypy/pypy/changeset/2b8a59268ac7/

Log:	found an unroll miscompilation

diff --git a/rpython/jit/metainterp/test/test_loop.py b/rpython/jit/metainterp/test/test_loop.py
--- a/rpython/jit/metainterp/test/test_loop.py
+++ b/rpython/jit/metainterp/test/test_loop.py
@@ -501,6 +501,59 @@
             return g(n, 1) + g(n, 2)
         assert self.meta_interp(h, [25]) == 7 * 25 * (7 + 8 + 2 + 3)
 
+    def test_two_bridged_loops_classes(self):
+        py.test.skip("fix me :-((((")
+        myjitdriver = JitDriver(greens = ['pos'], reds = ['i', 'n', 'x', 's'])
+        class A(object):
+            pass
+        bytecode = "zI7izI8i"
+        def f(n, s):
+            i = x = 0
+            pos = 0
+            op = '-'
+            while pos < len(bytecode):
+                myjitdriver.jit_merge_point(pos=pos, i=i, n=n, s=s, x=x)
+                op = bytecode[pos]
+                if op == 'z':
+                    i = 0
+                if op == 'i':
+                    i += 1
+                    pos -= 2
+                    myjitdriver.can_enter_jit(pos=pos, i=i, n=n, s=s, x=x)
+                    continue
+                elif op == 'I':
+                    if not (i < n):
+                        pos += 2
+                elif op == '7':
+                    if s is not None:
+                        x = x + 7
+                    else:
+                        x = x + 2
+                elif op == '8':
+                    if s is not None:
+                        x = x + 8
+                    else:
+                        x = x + 3
+
+                pos += 1
+            return x
+
+        def g(n, s):
+            if s == 2:
+                s = None
+            else:
+                s = A()
+            sa = 0
+            for i in range(7):
+                sa += f(n, s)
+            return sa
+        assert self.meta_interp(g, [25, 1]) == g(25, 1)
+
+        def h(n):
+            return g(n, 1) + g(n, 2)
+        assert self.meta_interp(h, [25]) == h(25)
+
+
     def test_three_nested_loops(self):
         myjitdriver = JitDriver(greens = ['i'], reds = ['x'])
         bytecode = ".+357"


More information about the pypy-commit mailing list