[pypy-commit] pypy default: Add a failing test.

arigo noreply at buildbot.pypy.org
Mon Dec 5 19:52:21 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r50174:0d1f6b514b53
Date: 2011-12-05 18:22 +0100
http://bitbucket.org/pypy/pypy/changeset/0d1f6b514b53/

Log:	Add a failing test.

diff --git a/pypy/jit/metainterp/test/test_recursive.py b/pypy/jit/metainterp/test/test_recursive.py
--- a/pypy/jit/metainterp/test/test_recursive.py
+++ b/pypy/jit/metainterp/test/test_recursive.py
@@ -1238,6 +1238,30 @@
         self.meta_interp(portal, [0, 0, 0], inline=True)
         self.check_resops(call_may_force=0, call=0)
 
+    def test_dont_repeatedly_trace_from_the_same_guard(self):
+        driver = JitDriver(greens = [], reds = ['level', 'i'])
+
+        def portal(level):
+            if level == 0:
+                i = -10
+            else:
+                i = 0
+            #
+            while True:
+                driver.jit_merge_point(level=level, i=i)
+                if level == 25:
+                    return 42
+                i += 1
+                if i <= 0:      # <- guard
+                    continue    # first make a loop
+                else:
+                    # then we fail the guard above, doing a recursive call
+                    return portal(level + 1)
+
+        self.meta_interp(portal, [0])
+        assert self.check_loop_count_at_most(3)   # and not, e.g., 24
+
+
 class TestLLtype(RecursiveTests, LLJitMixin):
     pass
 


More information about the pypy-commit mailing list