Author: Maciej Fijalkowski <[email protected]>
Branch: trace-limit-hack
Changeset: r73209:68c497551ab4
Date: 2014-08-30 09:42 -0600
http://bitbucket.org/pypy/pypy/changeset/68c497551ab4/
Log: (arigo, fijal) try to hack the noninlinable marking to trace quicker
the functions involved
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
@@ -1991,6 +1991,10 @@
if greenkey_of_huge_function is not None:
warmrunnerstate.disable_noninlinable_function(
greenkey_of_huge_function)
+ if self.current_merge_points:
+ jd_sd = self.jitdriver_sd
+ greenkey =
self.current_merge_points[0][0][:jd_sd.num_green_args]
+ warmrunnerstate.JitCell.trace_next_iteration(greenkey)
raise SwitchToBlackhole(Counters.ABORT_TOO_LONG)
def _interpret(self):
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
@@ -140,6 +140,9 @@
return token
return None
+ def has_seen_a_procedure_token(self):
+ return self.wref_procedure_token is not None
+
def set_procedure_token(self, token, tmp=False):
self.wref_procedure_token = self._makeref(token)
if tmp:
@@ -154,9 +157,14 @@
def should_remove_jitcell(self):
if self.get_procedure_token() is not None:
return False # don't remove JitCells with a procedure_token
- # don't remove JitCells that are being traced, or JitCells with
- # the "don't trace here" flag. Other JitCells can be removed.
- return (self.flags & (JC_TRACING | JC_DONT_TRACE_HERE)) == 0
+ if self.flags & JC_TRACING:
+ return False # don't remove JitCells that are being traced
+ if self.flags & JC_DONT_TRACE_HERE:
+ # if we have this flag, and we *had* a procedure_token but
+ # we no longer have one, then remove me. this prevents this
+ # JitCell from being immortal.
+ return self.has_seen_a_procedure_token()
+ return True # Other JitCells can be removed.
# ____________________________________________________________
@@ -365,6 +373,12 @@
# machine code was already compiled for these greenargs
procedure_token = cell.get_procedure_token()
if procedure_token is None:
+ if cell.flags & JC_DONT_TRACE_HERE:
+ if not cell.has_seen_a_procedure_token():
+ # we're seeing a fresh JC_DONT_TRACE_HERE with no
+ # procedure_token. Compile now.
+ bound_reached(hash, cell, *args)
+ return
# it was an aborted compilation, or maybe a weakref that
# has been freed
jitcounter.cleanup_chain(hash)
@@ -467,6 +481,12 @@
return JitCell.get_jitcell(*greenargs)
@staticmethod
+ def trace_next_iteration(greenkey):
+ greenargs = unwrap_greenkey(greenkey)
+ hash = JitCell.get_uhash(*greenargs)
+ jitcounter.change_current_fraction(hash, 0.98)
+
+ @staticmethod
def ensure_jit_cell_at_key(greenkey):
greenargs = unwrap_greenkey(greenkey)
hash = JitCell.get_uhash(*greenargs)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit