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

Fix MicroJIT's putobject against GC copmaction

This commit is contained in:
Alan Wu 2020-10-05 11:31:24 -04:00
parent e9ecf80d20
commit 805f49630d

View file

@ -308,13 +308,14 @@ void gen_putnil(codeblock_t* cb, codeblock_t* ocb, ctx_t* ctx)
void gen_putobject(codeblock_t* cb, codeblock_t* ocb, ctx_t* ctx) void gen_putobject(codeblock_t* cb, codeblock_t* ocb, ctx_t* ctx)
{ {
// Get the argument // Load the argument from the bytecode sequence.
VALUE object = ctx_get_arg(ctx, 0); // We need to do this as the argument can chanage due to GC compaction.
x86opnd_t ptr_imm = const_ptr_opnd((void*)object); x86opnd_t pc_imm = const_ptr_opnd((void*)ctx->pc);
mov(cb, RAX, pc_imm);
mov(cb, RAX, mem_opnd(64, RAX, 8)); // One after the opcode
// Write constant at SP // Write argument at SP
x86opnd_t stack_top = ctx_stack_push(ctx, 1); x86opnd_t stack_top = ctx_stack_push(ctx, 1);
mov(cb, RAX, ptr_imm);
mov(cb, stack_top, RAX); mov(cb, stack_top, RAX);
} }