1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

fix alignment

This commit is contained in:
Aaron Patterson 2021-07-13 16:04:56 -07:00 committed by Alan Wu
parent d0174d99c6
commit 0fdcdd267f
3 changed files with 7 additions and 9 deletions

View file

@ -238,14 +238,12 @@ yjit_save_regs(codeblock_t* cb)
push(cb, REG_CFP);
push(cb, REG_EC);
push(cb, REG_SP);
push(cb, REG_SP); // Maintain 16-byte RSP alignment
}
// Restore YJIT registers after a C call
static void
yjit_load_regs(codeblock_t* cb)
{
pop(cb, REG_SP); // Maintain 16-byte RSP alignment
pop(cb, REG_SP);
pop(cb, REG_EC);
pop(cb, REG_CFP);
@ -2717,11 +2715,9 @@ gen_send_cfunc(jitstate_t *jit, ctx_t *ctx, const struct rb_callinfo *ci, const
// Pop the C function arguments from the stack (in the caller)
ctx_stack_pop(ctx, argc + 1);
if (block) {
// Write interpreter SP into CFP.
// Needed in case the callee yields to the block.
jit_save_sp(jit, ctx);
}
// Write interpreter SP into CFP.
// Needed in case the callee yields to the block.
jit_save_sp(jit, ctx);
// Save YJIT registers
yjit_save_regs(cb);

View file

@ -675,7 +675,6 @@ uint8_t* get_branch_target(
push(ocb, REG_CFP);
push(ocb, REG_EC);
push(ocb, REG_SP);
push(ocb, REG_SP);
// Call branch_stub_hit(branch_idx, target_idx, ec)
mov(ocb, C_ARG_REGS[2], REG_EC);
@ -685,7 +684,6 @@ uint8_t* get_branch_target(
// Restore the yjit registers
pop(ocb, REG_SP);
pop(ocb, REG_SP);
pop(ocb, REG_EC);
pop(ocb, REG_CFP);

View file

@ -95,9 +95,13 @@ void print_str(codeblock_t* cb, const char* str)
cb_write_byte(cb, (uint8_t)str[i]);
cb_write_byte(cb, 0);
push(cb, RSP); // Alignment
// Call the print function
mov(cb, RAX, const_ptr_opnd((void*)&print_str_cfun));
call(cb, RAX);
pop(cb, RSP); // Alignment
pop_regs(cb);
}