aboutsummaryrefslogtreecommitdiffstats
path: root/yjit
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2024-02-29 20:53:48 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2024-03-01 12:54:34 -0500
commit88050ec179b2327d4b99d08fc0d825fc8898f5a7 (patch)
tree20d5d4de631afb0e257051113f1dd1c6d4e1d1e3 /yjit
parent57ca5960ad207beb0c4f2788df0e74f8cc6b7cac (diff)
downloadruby-88050ec179b2327d4b99d08fc0d825fc8898f5a7.tar.gz
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.
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/codegen.rs13
1 files changed, 4 insertions, 9 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index eb85239998..c150d48666 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -2179,16 +2179,11 @@ fn gen_setlocal_generic(
let ep_opnd = gen_get_ep(asm, level);
// Fallback because of write barrier
- if asm.ctx.get_chain_depth() > 0
- {
- // 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);
-
+ if asm.ctx.get_chain_depth() > 0 {
+ // This function should not yield to the GC.
// void rb_vm_env_write(const VALUE *ep, int index, VALUE v)
let index = -(ep_offset as i64);
+ let value_opnd = asm.stack_opnd(0);
asm.ccall(
rb_vm_env_write as *const u8,
vec![
@@ -2197,7 +2192,7 @@ fn gen_setlocal_generic(
value_opnd,
]
);
- asm.stack_pop(1); // Keep it on stack during ccall for GC
+ asm.stack_pop(1);
return Some(KeepCompiling);
}