[pypy-commit] pypy recursion_and_inlining: Test that recursing past a specified threshold turns off recursion inlining.
ltratt
noreply at buildbot.pypy.org
Tue Dec 9 17:29:47 CET 2014
Author: Laurence Tratt <laurie at tratt.net>
Branch: recursion_and_inlining
Changeset: r74865:64b3af5150aa
Date: 2014-12-09 15:44 +0000
http://bitbucket.org/pypy/pypy/changeset/64b3af5150aa/
Log: Test that recursing past a specified threshold turns off recursion
inlining.
diff --git a/rpython/jit/metainterp/test/test_recursive.py b/rpython/jit/metainterp/test/test_recursive.py
--- a/rpython/jit/metainterp/test/test_recursive.py
+++ b/rpython/jit/metainterp/test/test_recursive.py
@@ -1112,6 +1112,37 @@
assert res == 2095
self.check_resops(call_assembler=12)
+ def test_inline_recursion_limit(self):
+ driver = JitDriver(greens = ["threshold", "loop"], reds=["i"])
+ @dont_look_inside
+ def f():
+ set_param(driver, "max_unroll_recursion", 10)
+ def portal(threshold, loop, i):
+ f()
+ if i > threshold:
+ return i
+ while True:
+ driver.jit_merge_point(threshold=threshold, loop=loop, i=i)
+ if loop:
+ portal(threshold, False, 0)
+ else:
+ portal(threshold, False, i + 1)
+ return i
+ if i > 10:
+ return 1
+ i += 1
+ driver.can_enter_jit(threshold=threshold, loop=loop, i=i)
+
+ res1 = portal(10, True, 0)
+ res2 = self.meta_interp(portal, [10, True, 0], inline=True)
+ assert res1 == res2
+ self.check_resops(call_assembler=2)
+
+ res1 = portal(9, True, 0)
+ res2 = self.meta_interp(portal, [9, True, 0], inline=True)
+ assert res1 == res2
+ self.check_resops(call_assembler=0)
+
def test_handle_jitexception_in_portal(self):
# a test for _handle_jitexception_in_portal in blackhole.py
driver = JitDriver(greens = ['codeno'], reds = ['i', 'str'],
More information about the pypy-commit
mailing list