YJIT: No need to set cfp->sp when setting escaped locals
While writing to the env object can add it to the remember set, it shouldn't trigger a GC run.
This commit is contained in:
parent
57ca5960ad
commit
88050ec179
@ -521,6 +521,7 @@ vm_env_write_slowpath(const VALUE *ep, int index, VALUE v)
|
|||||||
RB_DEBUG_COUNTER_INC(lvar_set_slowpath);
|
RB_DEBUG_COUNTER_INC(lvar_set_slowpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// YJIT assumes this function never runs GC
|
||||||
static inline void
|
static inline void
|
||||||
vm_env_write(const VALUE *ep, int index, VALUE v)
|
vm_env_write(const VALUE *ep, int index, VALUE v)
|
||||||
{
|
{
|
||||||
|
@ -2179,16 +2179,11 @@ fn gen_setlocal_generic(
|
|||||||
let ep_opnd = gen_get_ep(asm, level);
|
let ep_opnd = gen_get_ep(asm, level);
|
||||||
|
|
||||||
// Fallback because of write barrier
|
// Fallback because of write barrier
|
||||||
if asm.ctx.get_chain_depth() > 0
|
if asm.ctx.get_chain_depth() > 0 {
|
||||||
{
|
// This function should not yield to the GC.
|
||||||
// Save the PC and SP because it runs GC
|
|
||||||
jit_prepare_call_with_gc(jit, asm);
|
|
||||||
|
|
||||||
// Pop the value to write from the stack
|
|
||||||
let value_opnd = asm.stack_opnd(0);
|
|
||||||
|
|
||||||
// void rb_vm_env_write(const VALUE *ep, int index, VALUE v)
|
// void rb_vm_env_write(const VALUE *ep, int index, VALUE v)
|
||||||
let index = -(ep_offset as i64);
|
let index = -(ep_offset as i64);
|
||||||
|
let value_opnd = asm.stack_opnd(0);
|
||||||
asm.ccall(
|
asm.ccall(
|
||||||
rb_vm_env_write as *const u8,
|
rb_vm_env_write as *const u8,
|
||||||
vec![
|
vec![
|
||||||
@ -2197,7 +2192,7 @@ fn gen_setlocal_generic(
|
|||||||
value_opnd,
|
value_opnd,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
asm.stack_pop(1); // Keep it on stack during ccall for GC
|
asm.stack_pop(1);
|
||||||
|
|
||||||
return Some(KeepCompiling);
|
return Some(KeepCompiling);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user