def invalidate_loop(self, looptoken): """Activate all GUARD_NOT_INVALIDATED in the loop and its attached bridges. Before this call, all GUARD_NOT_INVALIDATED do nothing; after this call, they all fail. Note that afterwards, if one such guard fails often enough, it has a bridge attached to it; it is possible then to re-call invalidate_loop() on the same looptoken, which must invalidate all newer GUARD_NOT_INVALIDATED, but not the old one that already has a bridge attached to it.""" from rpython.jit.backend.arm.codebuilder import InstrBuilder for jmp, tgt in looptoken.compiled_loop_token.invalidate_positions: mc = InstrBuilder(self.cpuinfo.arch_version) mc.B_offs(tgt) mc.copy_to_raw_memory(jmp) # positions invalidated looptoken.compiled_loop_token.invalidate_positions = []
def redirect_call_assembler(self, oldlooptoken, newlooptoken): # some minimal sanity checking old_nbargs = oldlooptoken.compiled_loop_token._debug_nbargs new_nbargs = newlooptoken.compiled_loop_token._debug_nbargs assert old_nbargs == new_nbargs # we overwrite the instructions at the old _ll_function_addr # to start with a JMP to the new _ll_function_addr. # Ideally we should rather patch all existing CALLs, but well. oldadr = oldlooptoken._ll_function_addr target = newlooptoken._ll_function_addr # copy frame-info data baseofs = self.cpu.get_baseofs_of_frame_field() newlooptoken.compiled_loop_token.update_frame_info(oldlooptoken.compiled_loop_token, baseofs) mc = InstrBuilder(self.cpu.cpuinfo.arch_version) mc.B(target) mc.copy_to_raw_memory(oldadr)
def make_function_returning_stack_pointer(self): mc = InstrBuilder() mc.MOV_rr(r.r0.value, r.sp.value) mc.MOV_rr(r.pc.value, r.lr.value) return mc.materialize(self.cpu.asmmemmgr, [])
def make_function_returning_stack_pointer(self): mc = InstrBuilder() mc.MOV_rr(r.r0.value, r.sp.value) mc.MOV_rr(r.pc.value, r.lr.value) return mc.materialize(self.cpu, [])