def handle_jitexception(e): # XXX the bulk of this function is mostly a copy-paste from above try: raise e except self.ContinueRunningNormally, e: args = () for ARGTYPE, attrname, count in portalfunc_ARGS: x = getattr(e, attrname)[count] x = specialize_value(ARGTYPE, x) args = args + (x,) result = ll_portal_runner(*args) if result_kind != 'void': result = unspecialize_value(result) return result
def _run_with_machine_code(testself, args): metainterp = testself.metainterp num_green_args = metainterp.jitdriver_sd.num_green_args procedure_token = metainterp.get_procedure_token(args[:num_green_args]) # a loop was successfully created by _run_with_pyjitpl(); call it cpu = metainterp.cpu args1 = [] for i in range(len(args) - num_green_args): x = args[num_green_args + i] args1.append(unspecialize_value(x)) faildescr = cpu.execute_token(procedure_token, *args1) assert faildescr.__class__.__name__.startswith('DoneWithThisFrameDescr') if metainterp.jitdriver_sd.result_type == history.INT: return cpu.get_latest_value_int(0) elif metainterp.jitdriver_sd.result_type == history.REF: return cpu.get_latest_value_ref(0) elif metainterp.jitdriver_sd.result_type == history.FLOAT: return cpu.get_latest_value_float(0) else: return None