[pypy-commit] pypy recursion_and_inlining: Force recursive functions to be (separately) traced sooner.
ltratt
noreply at buildbot.pypy.org
Wed Nov 12 10:48:19 CET 2014
Author: Laurence Tratt <laurie at tratt.net>
Branch: recursion_and_inlining
Changeset: r74472:ebc86588479f
Date: 2014-11-12 09:44 +0000
http://bitbucket.org/pypy/pypy/changeset/ebc86588479f/
Log: Force recursive functions to be (separately) traced sooner.
As soon as we've identified a recursive function, we know we don't
to inline it into other functions. Instead, we want to have it
traced separately. This patch simply uses the same mechanism as
aborted traces to achieve this.
diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -971,6 +971,7 @@
# The greenkey of a trace position on the stack
# matches what we have, which means we're definitely
# about to recurse.
+ warmrunnerstate.dont_trace_here(greenboxes)
inline = False
break
if inline:
diff --git a/rpython/jit/metainterp/warmstate.py b/rpython/jit/metainterp/warmstate.py
--- a/rpython/jit/metainterp/warmstate.py
+++ b/rpython/jit/metainterp/warmstate.py
@@ -577,6 +577,16 @@
return True
self.can_inline_callable = can_inline_callable
+ def dont_trace_here(greenkey):
+ # Set greenkey as somewhere that tracing should not occur into;
+ # notice that, as per the description of JC_DONT_TRACE_HERE earlier,
+ # if greenkey hasn't been traced separately, setting
+ # JC_DONT_TRACE_HERE will force tracing the next time the function
+ # is encountered.
+ cell = JitCell.ensure_jit_cell_at_key(greenkey)
+ cell.flags |= JC_DONT_TRACE_HERE
+ self.dont_trace_here = dont_trace_here
+
if jd._should_unroll_one_iteration_ptr is None:
def should_unroll_one_iteration(greenkey):
return False
More information about the pypy-commit
mailing list