On Fri, Jul 10, 2020 at 8:20 PM Alexei Starovoitov
<[email protected]> wrote:
>
> Of course you are right.
> pop+nop+push is incorrect.
>
> How about the following instead:
> - during JIT:
> emit_jump(to_skip_below) <- poke->tailcall_bypass
> pop_callee_regs
> emit_jump(to_tailcall_target) <- poke->tailcall_target
>
> - Transition from one target to another:
> text_poke(poke->tailcall_target, MOD_JMP, old_jmp, new_jmp)
> if (new_jmp != NULL)
> text_poke(poke->tailcall_bypass, MOD jmp into nop);
> else
> text_poke(poke->tailcall_bypass, MOD nop into jmp);
One more correction. I meant:
if (new_jmp != NULL) {
text_poke(poke->tailcall_target, MOD_JMP, old_jmp, new_jmp)
text_poke(poke->tailcall_bypass, MOD jmp into nop);
} else {
text_poke(poke->tailcall_bypass, MOD nop into jmp);
}