Example #1
0
    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."""

        for jmp, tgt in looptoken.compiled_loop_token.invalidate_positions:
            mc = InstrBuilder()
            # needs 4 bytes, ensured by the previous process
            mc.b_offset(tgt)     # a single instruction
            mc.copy_to_raw_memory(jmp)
        # positions invalidated
        looptoken.compiled_loop_token.invalidate_positions = []
Example #2
0
 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
     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)
     # we overwrite the instructions at the old _ll_function_addr
     # to start with a JMP to the new _ll_function_addr.
     mc = InstrBuilder()
     mc.load_imm(r.SCRATCH, target)
     mc.BCR(c.ANY, r.SCRATCH)
     mc.copy_to_raw_memory(oldadr)
Example #3
0
 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
     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)
     # we overwrite the instructions at the old _ll_function_addr
     # to start with a JMP to the new _ll_function_addr.
     mc = InstrBuilder()
     mc.load_imm(r.SCRATCH, target)
     mc.BCR(c.ANY, r.SCRATCH)
     mc.copy_to_raw_memory(oldadr)
Example #4
0
    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."""

        for jmp, tgt in looptoken.compiled_loop_token.invalidate_positions:
            mc = InstrBuilder()
            # needs 4 bytes, ensured by the previous process
            mc.b_offset(tgt)  # a single instruction
            mc.copy_to_raw_memory(jmp)
        # positions invalidated
        looptoken.compiled_loop_token.invalidate_positions = []
 def make_function_returning_stack_pointer(self):
     mc = InstrBuilder()
     mc.LGR(r.r2, r.SP)
     mc.BCR(c.ANY, r.r14)
     return rffi.cast(lltype.Signed, mc.get_assembler_function())
Example #6
0
 def make_function_returning_stack_pointer(self):
     mc = InstrBuilder()
     mc.LGR(r.r2, r.SP)
     mc.BCR(c.ANY, r.r14)
     return rffi.cast(lltype.Signed, mc.get_assembler_function())