diff options
| author | Max Bernstein <max.bernstein@shopify.com> | 2025-02-07 11:14:50 -0500 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2025-04-18 21:52:57 +0900 |
| commit | 70f365708b34f4690951d3e355ce248dfda1b7d5 (patch) | |
| tree | bd9d46eda5623d5bfe451825fc5418f48158aeea | |
| parent | 03a56988e43b37dd29e9e2fc6e4ea69caaa28e6a (diff) | |
Add opt_aset
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
| -rw-r--r-- | zjit/src/ir.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/zjit/src/ir.rs b/zjit/src/ir.rs index 736951923e..a62710647a 100644 --- a/zjit/src/ir.rs +++ b/zjit/src/ir.rs @@ -83,6 +83,7 @@ pub enum Insn { NewArray { count: usize }, ArraySet { idx: usize, val: Opnd }, + ArrayDup { val: Opnd }, Test { val: Opnd }, Defined { op_type: usize, obj: VALUE, pushval: VALUE, v: Opnd }, GetConstantPath { ic: *const u8 }, @@ -190,6 +191,7 @@ impl<'a> std::fmt::Display for FunctionPrinter<'a> { Insn::Return { val } => { write!(f, "Return {val}")?; } Insn::NewArray { count } => { write!(f, "NewArray {count}")?; } Insn::ArraySet { idx, val } => { write!(f, "ArraySet {idx}, {val}")?; } + Insn::ArrayDup { val } => { write!(f, "ArrayDup {val}")?; } Insn::Send { self_val, call_info, args } => { write!(f, "Send {self_val}, :{}", call_info.name)?; for arg in args { @@ -361,6 +363,11 @@ pub fn iseq_to_ssa(iseq: *const rb_iseq_t) -> Function { } state.push(Opnd::Insn(insn_id)); } + YARVINSN_duparray => { + let val = Opnd::Const(get_arg(pc, 0)); + let insn_id = fun.push_insn(block, Insn::ArrayDup { val }); + state.push(Opnd::Insn(insn_id)); + } YARVINSN_putobject_INT2FIX_0_ => { state.push(Opnd::Const(VALUE::fixnum_from_usize(0))); } @@ -425,6 +432,13 @@ pub fn iseq_to_ssa(iseq: *const rb_iseq_t) -> Function { let v1 = state.pop(); state.push(Opnd::Insn(fun.push_insn(block, Insn::Send { self_val: v0, call_info: CallInfo { name: "<".into() }, args: vec![v1] }))); } + YARVINSN_opt_aset => { + let set = state.pop(); + let obj = state.pop(); + let recv = state.pop(); + fun.push_insn(block, Insn::Send { self_val: recv, call_info: CallInfo { name: "[]=".into() }, args: vec![obj, set] }); + state.push(set); + } YARVINSN_leave => { fun.push_insn(block, Insn::Return { val: state.pop() }); |
