[pypy-commit] pypy core-only-tracing: make sure not to inline indirect calls when in core-only mode
antocuni
noreply at buildbot.pypy.org
Fri Jan 20 15:35:16 CET 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: core-only-tracing
Changeset: r51531:03e571309f26
Date: 2012-01-20 14:24 +0100
http://bitbucket.org/pypy/pypy/changeset/03e571309f26/
Log: make sure not to inline indirect calls when in core-only mode
diff --git a/pypy/jit/metainterp/pyjitpl.py b/pypy/jit/metainterp/pyjitpl.py
--- a/pypy/jit/metainterp/pyjitpl.py
+++ b/pypy/jit/metainterp/pyjitpl.py
@@ -1388,7 +1388,7 @@
jitcode = sd.bytecode_for_address(key)
if jitcode is not None:
# we should follow calls to this graph
- return self.metainterp.perform_call(jitcode, argboxes)
+ return self.perform_call_maybe(jitcode, argboxes)
else:
# but we should not follow calls to that graph
return self.do_residual_call(funcbox, calldescr, argboxes)
diff --git a/pypy/jit/metainterp/test/test_ajit.py b/pypy/jit/metainterp/test/test_ajit.py
--- a/pypy/jit/metainterp/test/test_ajit.py
+++ b/pypy/jit/metainterp/test/test_ajit.py
@@ -2974,6 +2974,37 @@
'guard_no_exception': 6,
'guard_not_forced': 6})
+ def test_dont_inline_residual_call_from_core_graph(self):
+ class MyPolicy(JitPolicy):
+ def is_core_graph(self, graph):
+ return graph.name == 'f'
+ myjitdriver = JitDriver(greens = [], reds = ['x', 'y', 'res'])
+
+ def a(x):
+ return x+2
+ def b(x):
+ return x+1
+ def f(x, y):
+ res = 0
+ while y > 0:
+ myjitdriver.can_enter_jit(x=x, y=y, res=res)
+ myjitdriver.jit_merge_point(x=x, y=y, res=res)
+ if y == 5:
+ f = a
+ else:
+ f = b
+ y -= 1
+ res += f(x)
+ return res
+ res = self.meta_interp(f, [5, 7], policy=MyPolicy(), jitmode='fast') # fast == trace only core graphs
+ assert res == 43
+ self.check_trace_count(1)
+ self.check_resops({'jump': 1, 'int_gt': 2, 'guard_true': 2, 'int_sub': 2,
+ 'int_eq': 2, 'int_add': 2, 'guard_false': 2,
+ 'call_may_force': 2,
+ 'guard_no_exception': 2,
+ 'guard_not_forced': 2})
+
class TestOOtype(BasicTests, OOJitMixin):
More information about the pypy-commit
mailing list