summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Bernstein <max.bernstein@shopify.com>2025-02-07 11:19:58 -0500
committerTakashi Kokubun <takashikkbn@gmail.com>2025-04-18 21:52:57 +0900
commit2ce1888005f6f53aa7049e1d7bb7cf1dffa7d1a0 (patch)
treeb50a47abe7a7491a14548294a8c7de1ca1660855
parent70f365708b34f4690951d3e355ce248dfda1b7d5 (diff)
Add setn
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13131
-rw-r--r--zjit/src/ir.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/zjit/src/ir.rs b/zjit/src/ir.rs
index a62710647a..6a2f3b52ad 100644
--- a/zjit/src/ir.rs
+++ b/zjit/src/ir.rs
@@ -235,6 +235,11 @@ impl FrameState {
self.stack.pop().expect("Bytecode stack mismatch (underflow)")
}
+ fn setn(&mut self, n: usize, opnd: Opnd) {
+ let idx = self.stack.len() - n - 1;
+ self.stack[idx] = opnd;
+ }
+
fn setlocal(&mut self, idx: usize, opnd: Opnd) {
if idx >= self.locals.len() {
self.locals.resize(idx+1, Opnd::Const(Qnil));
@@ -420,6 +425,11 @@ pub fn iseq_to_ssa(iseq: *const rb_iseq_t) -> Function {
state.push(right);
state.push(left);
}
+ YARVINSN_setn => {
+ let n = get_arg(pc, 0).as_usize();
+ let top = state.top();
+ state.setn(n, top);
+ }
YARVINSN_opt_plus => {
let v0 = state.pop();