Use callee-saved regs for REG_SP, REG_EP, REG_CFP

This commit is contained in:
John Hawthorn 2021-08-04 16:17:36 -07:00 committed by Alan Wu
parent ed8aa3409a
commit 8fa0ee4d40
3 changed files with 25 additions and 109 deletions

View file

@ -847,22 +847,12 @@ uint8_t* get_branch_target(
// Generate an outlined stub that will call branch_stub_hit()
uint8_t* stub_addr = cb_get_ptr(ocb, ocb->write_pos);
// Save the yjit registers
push(ocb, REG_CFP);
push(ocb, REG_EC);
push(ocb, REG_SP);
// Call branch_stub_hit(branch_idx, target_idx, ec)
mov(ocb, C_ARG_REGS[2], REG_EC);
mov(ocb, C_ARG_REGS[1], imm_opnd(target_idx));
mov(ocb, C_ARG_REGS[0], const_ptr_opnd(branch));
call_ptr(ocb, REG0, (void *)&branch_stub_hit);
// Restore the yjit registers
pop(ocb, REG_SP);
pop(ocb, REG_EC);
pop(ocb, REG_CFP);
// Jump to the address returned by the
// branch_stub_hit call
jmp_rm(ocb, RAX);