summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Lo <stan.lo@shopify.com>2025-09-22 22:25:01 +0100
committerGitHub <noreply@github.com>2025-09-22 14:25:01 -0700
commit93c728ce9143b2f32e5d3073c8d2c87da8e0db54 (patch)
treebf6753ddcef08238bfd658679d4e70707f1d8139
parentcbfe403315c4eab4f37906137b99c195204d63fe (diff)
YJIT: Pass iseq pointer to get/set classvariable functions (#14625)
* YJIT: Pass iseq pointer to get/set classvariable functions Since we already have the iseq pointer, we can actually save one memory read by passing it directly. We need to wrap the iseq in a VALUE so it can be marked correctly by GC. * YJIT: Fix missing GC marking when passing iseq to rb_vm_setinstancevariable Without wrapping the iseq in a `Operand::Value`, the iseq would not be marked correctly by GC and when compacting the heap, the iseq would be lost and cause a crash.
-rw-r--r--yjit/src/codegen.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index 85fed25d24..67841d2fdc 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -3148,7 +3148,7 @@ fn gen_set_ivar(
asm.ccall(
rb_vm_setinstancevariable as *const u8,
vec![
- Opnd::const_ptr(jit.iseq as *const u8),
+ VALUE(jit.iseq as usize).into(),
Opnd::mem(64, CFP, RUBY_OFFSET_CFP_SELF),
ivar_name.into(),
val_opnd,
@@ -10207,7 +10207,7 @@ fn gen_getclassvariable(
let val_opnd = asm.ccall(
rb_vm_getclassvariable as *const u8,
vec![
- Opnd::mem(64, CFP, RUBY_OFFSET_CFP_ISEQ),
+ VALUE(jit.iseq as usize).into(),
CFP,
Opnd::UImm(jit.get_arg(0).as_u64()),
Opnd::UImm(jit.get_arg(1).as_u64()),
@@ -10231,7 +10231,7 @@ fn gen_setclassvariable(
asm.ccall(
rb_vm_setclassvariable as *const u8,
vec![
- Opnd::mem(64, CFP, RUBY_OFFSET_CFP_ISEQ),
+ VALUE(jit.iseq as usize).into(),
CFP,
Opnd::UImm(jit.get_arg(0).as_u64()),
val,