Author: Maciej Fijalkowski <fij...@gmail.com> Branch: Changeset: r73231:239c8dadefea Date: 2014-08-31 08:10 -0600 http://bitbucket.org/pypy/pypy/changeset/239c8dadefea/
Log: (arigo, fijal) merge trace-limit-hack branch which adjusts the heuristics how things are traced after ABORT_TOO_LONG. Now both the inner function and the outer loop should be traced "soon" after the abort. 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 @@ -183,6 +183,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: @@ -197,9 +200,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. # ____________________________________________________________ @@ -408,6 +416,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) @@ -510,6 +524,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 pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit