diff options
Diffstat (limited to 'rpython/jit/metainterp/pyjitpl.py')
-rw-r--r-- | rpython/jit/metainterp/pyjitpl.py | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/rpython/jit/metainterp/pyjitpl.py b/rpython/jit/metainterp/pyjitpl.py index 8d43329e9f..bbc405dba5 100644 --- a/rpython/jit/metainterp/pyjitpl.py +++ b/rpython/jit/metainterp/pyjitpl.py @@ -12,7 +12,7 @@ from rpython.jit.metainterp.history import (Const, ConstInt, ConstPtr, from rpython.jit.metainterp.jitprof import EmptyProfiler from rpython.jit.metainterp.logger import Logger from rpython.jit.metainterp.optimizeopt.util import args_dict -from rpython.jit.metainterp.resoperation import rop +from rpython.jit.metainterp.resoperation import rop, GuardResOp from rpython.rlib import nonconst, rstack from rpython.rlib.debug import debug_start, debug_stop, debug_print from rpython.rlib.debug import have_debug_prints, make_sure_not_resized @@ -1874,23 +1874,15 @@ class MetaInterp(object): moreargs = [box] + extraargs else: moreargs = list(extraargs) - if opnum == rop.GUARD_NOT_FORCED or opnum == rop.GUARD_NOT_FORCED_2: - resumedescr = compile.ResumeGuardForcedDescr(self.staticdata, - self.jitdriver_sd) - elif opnum == rop.GUARD_NOT_INVALIDATED: - resumedescr = compile.ResumeGuardNotInvalidated() - elif opnum == rop.GUARD_FUTURE_CONDITION: - resumedescr = compile.ResumeAtPositionDescr() - else: - resumedescr = compile.ResumeGuardDescr() - guard_op = self.history.record(opnum, moreargs, None, descr=resumedescr) - self.capture_resumedata(resumedescr, resumepc) + guard_op = self.history.record(opnum, moreargs, None) + assert isinstance(guard_op, GuardResOp) + self.capture_resumedata(guard_op, resumepc) self.staticdata.profiler.count_ops(opnum, Counters.GUARDS) # count self.attach_debug_info(guard_op) return guard_op - def capture_resumedata(self, resumedescr, resumepc=-1): + def capture_resumedata(self, guard_op, resumepc=-1): virtualizable_boxes = None if (self.jitdriver_sd.virtualizable_info is not None or self.jitdriver_sd.greenfield_info is not None): @@ -1902,7 +1894,7 @@ class MetaInterp(object): if resumepc >= 0: frame.pc = resumepc resume.capture_resumedata(self.framestack, virtualizable_boxes, - self.virtualref_boxes, resumedescr) + self.virtualref_boxes, guard_op) if self.framestack: self.framestack[-1].pc = saved_pc @@ -2147,7 +2139,9 @@ class MetaInterp(object): assert isinstance(key, compile.ResumeGuardDescr) # store the resumekey.wref_original_loop_token() on 'self' to make # sure that it stays alive as long as this MetaInterp - self.resumekey_original_loop_token = key.wref_original_loop_token() + self.resumekey_original_loop_token = key.rd_loop_token.loop_token_wref() + if self.resumekey_original_loop_token is None: + raise compile.giveup() # should be rare self.staticdata.try_to_free_some_loops() self.initialize_state_from_guard_failure(key, deadframe) try: @@ -2163,13 +2157,8 @@ class MetaInterp(object): self.seen_loop_header_for_jdindex = -1 if isinstance(key, compile.ResumeAtPositionDescr): self.seen_loop_header_for_jdindex = self.jitdriver_sd.index - dont_change_position = True - else: - dont_change_position = False try: - self.prepare_resume_from_failure(key.guard_opnum, - dont_change_position, - deadframe) + self.prepare_resume_from_failure(key.guard_opnum, deadframe) if self.resumekey_original_loop_token is None: # very rare case raise SwitchToBlackhole(Counters.ABORT_BRIDGE) self.interpret() @@ -2312,12 +2301,12 @@ class MetaInterp(object): else: assert 0 self.jitdriver_sd.warmstate.execute_assembler(loop_token, *args) - def prepare_resume_from_failure(self, opnum, dont_change_position, - deadframe): + def prepare_resume_from_failure(self, opnum, deadframe): frame = self.framestack[-1] - if opnum == rop.GUARD_TRUE: # a goto_if_not that jumps only now - if not dont_change_position: - frame.pc = frame.jitcode.follow_jump(frame.pc) + if opnum == rop.GUARD_FUTURE_CONDITION: + pass + elif opnum == rop.GUARD_TRUE: # a goto_if_not that jumps only now + frame.pc = frame.jitcode.follow_jump(frame.pc) elif opnum == rop.GUARD_FALSE: # a goto_if_not that stops jumping; pass # or a switch that was in its "default" case elif opnum == rop.GUARD_VALUE or opnum == rop.GUARD_CLASS: @@ -2341,12 +2330,11 @@ class MetaInterp(object): pass # XXX we want to do something special in resume descr, # but not now elif opnum == rop.GUARD_NO_OVERFLOW: # an overflow now detected - if not dont_change_position: - self.execute_raised(OverflowError(), constant=True) - try: - self.finishframe_exception() - except ChangeFrame: - pass + self.execute_raised(OverflowError(), constant=True) + try: + self.finishframe_exception() + except ChangeFrame: + pass elif opnum == rop.GUARD_OVERFLOW: # no longer overflowing self.clear_exception() else: |