Author: Antonio Cuni <[email protected]>
Branch: core-only-tracing
Changeset: r51532:4a040e6b95e4
Date: 2012-01-20 15:01 +0100
http://bitbucket.org/pypy/pypy/changeset/4a040e6b95e4/
Log: make sure to inline core-to-core calls
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
@@ -780,8 +780,8 @@
def perform_call_maybe(self, jitcode, argboxes):
core_only_mode = (self.metainterp.jitdriver_sd.warmstate.jitmode ==
'fast')
- if core_only_mode and self.jitcode.is_core:
- # never inline in this mode
+ # in core_only_mode, don't inline calls from core to non-core graphs
+ if core_only_mode and self.jitcode.is_core and not jitcode.is_core:
funcbox = ConstInt(jitcode.get_fnaddr_as_int())
# jitcode always has a calldescr, but it might not have the
# correct effectinfo. The result is that we might generate a
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
@@ -3005,6 +3005,27 @@
'guard_no_exception': 2,
'guard_not_forced': 2})
+ def test_inline_core_to_core_calls(self):
+ class MyPolicy(JitPolicy):
+ def is_core_graph(self, graph):
+ return graph.name in ('f', 'a')
+ myjitdriver = JitDriver(greens = [], reds = ['x', 'y', 'res'])
+
+ def a(x, y):
+ return x+y
+ 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)
+ res = a(res, x)
+ y -= 1
+ return res
+ res = self.meta_interp(f, [6, 7], policy=MyPolicy(), jitmode='fast') #
fast == trace only core graphs
+ assert res == 42
+ self.check_trace_count(1)
+ self.check_resops({'jump': 1, 'int_gt': 2, 'guard_true': 2, 'int_sub':
2,
+ 'int_add': 2})
class TestOOtype(BasicTests, OOJitMixin):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit