summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Bernstein <max.bernstein@shopify.com>2025-02-07 11:43:10 -0500
committerTakashi Kokubun <takashikkbn@gmail.com>2025-04-18 21:52:57 +0900
commit9cec9a5c1ebdaa83f9825371b954ed2ffe4aec32 (patch)
treed37293d94add65d0a17b74d329a0fd440b622134
parent2ce1888005f6f53aa7049e1d7bb7cf1dffa7d1a0 (diff)
Fix setlocal/getlocal
Need to read the index
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13131
-rw-r--r--zjit/src/ir.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/zjit/src/ir.rs b/zjit/src/ir.rs
index 6a2f3b52ad..9adf572e9f 100644
--- a/zjit/src/ir.rs
+++ b/zjit/src/ir.rs
@@ -379,10 +379,6 @@ pub fn iseq_to_ssa(iseq: *const rb_iseq_t) -> Function {
YARVINSN_putobject_INT2FIX_1_ => {
state.push(Opnd::Const(VALUE::fixnum_from_usize(1)));
}
- YARVINSN_setlocal_WC_0 => {
- let val = state.pop();
- state.setlocal(0, val);
- }
YARVINSN_defined => {
let op_type = get_arg(pc, 0).as_usize();
let obj = get_arg(pc, 0);
@@ -414,9 +410,15 @@ pub fn iseq_to_ssa(iseq: *const rb_iseq_t) -> Function {
state.push(Opnd::Insn(fun.push_insn(block, Insn::Send { self_val: recv, call_info: CallInfo { name: "nil?".into() }, args: vec![] })));
}
YARVINSN_getlocal_WC_0 => {
- let val = state.getlocal(0);
+ let idx = get_arg(pc, 0).as_usize();
+ let val = state.getlocal(idx);
state.push(val);
}
+ YARVINSN_setlocal_WC_0 => {
+ let idx = get_arg(pc, 0).as_usize();
+ let val = state.pop();
+ state.setlocal(idx, val);
+ }
YARVINSN_pop => { state.pop(); }
YARVINSN_dup => { state.push(state.top()); }
YARVINSN_swap => {