def bound_reached(cell, *args): # bound reached, but we do a last check: if it is the first # time we reach the bound, or if another loop or bridge was # compiled since the last time we reached it, then decrease # the counter by a few percents instead. It should avoid # sudden bursts of JIT-compilation, and also corner cases # where we suddenly compile more than one loop because all # counters reach the bound at the same time, but where # compiling all but the first one is pointless. curgen = warmrunnerdesc.memory_manager.current_generation curgen = chr(intmask(curgen) & 0xFF) # only use 8 bits if we_are_translated() and curgen != cell.extra_delay: cell.counter = int(self.THRESHOLD_LIMIT * 0.98) cell.extra_delay = curgen return # if not confirm_enter_jit(*args): cell.counter = 0 return # start tracing from rpython.jit.metainterp.pyjitpl import MetaInterp metainterp = MetaInterp(metainterp_sd, jitdriver_sd) # set counter to -2, to mean "tracing in effect" cell.counter = -2 try: metainterp.compile_and_run_once(jitdriver_sd, *args) finally: if cell.counter == -2: cell.counter = 0
def bound_reached(hash, cell, *args): if not confirm_enter_jit(*args): return jitcounter.decay_all_counters() # start tracing from rpython.jit.metainterp.pyjitpl import MetaInterp metainterp = MetaInterp(metainterp_sd, jitdriver_sd) greenargs = args[:num_green_args] if cell is None: cell = JitCell(*greenargs) jitcounter.install_new_cell(hash, cell) cell.flags |= JC_TRACING | JC_TRACING_OCCURRED try: metainterp.compile_and_run_once(jitdriver_sd, *args) finally: cell.flags &= ~JC_TRACING
def bound_reached(hash, cell, *args): from rpython.jit.metainterp.pyjitpl import MetaInterp if not confirm_enter_jit(*args): return jitcounter.decay_all_counters() if rstack.stack_almost_full(): return greenargs = args[:num_green_args] if cell is None: cell = JitCell(*greenargs) jitcounter.install_new_cell(hash, cell) # start tracing metainterp = MetaInterp( metainterp_sd, jitdriver_sd, force_finish_trace=bool(cell.flags & JC_FORCE_FINISH)) cell.flags |= JC_TRACING | JC_TRACING_OCCURRED try: metainterp.compile_and_run_once(jitdriver_sd, *args) finally: cell.flags &= ~JC_TRACING