Add other real yarv insns

This commit is contained in:
Max Bernstein 2025-02-06 11:56:45 -05:00 committed by Takashi Kokubun
parent 64287c95ca
commit a0e2502e18
Notes: git 2025-04-18 13:49:49 +00:00

View File

@ -177,6 +177,24 @@ fn iseq_to_ssa(iseq: *const rb_iseq_t) -> Function {
match opcode { match opcode {
YARVINSN_putnil => { state.push(Opnd::Const(Qnil)); }, YARVINSN_putnil => { state.push(Opnd::Const(Qnil)); },
YARVINSN_putobject => { state.push(Opnd::Const(get_arg(pc, 0))); }, YARVINSN_putobject => { state.push(Opnd::Const(get_arg(pc, 0))); },
YARVINSN_putstring => {
let val = Opnd::Const(get_arg(pc, 0));
let insn_id = result.push_insn(block, Insn::StringCopy { val });
state.push(Opnd::Insn(insn_id));
}
YARVINSN_intern => {
let val = state.pop();
let insn_id = result.push_insn(block, Insn::StringIntern { val });
state.push(Opnd::Insn(insn_id));
}
YARVINSN_newarray => {
let count = get_arg(pc, 0).as_usize();
let insn_id = result.push_insn(block, Insn::AllocArray { count });
for idx in (0..count).rev() {
result.push_insn(block, Insn::ArraySet { idx, val: state.pop() });
}
state.push(Opnd::Insn(insn_id));
}
YARVINSN_setlocal_WC_0 => { YARVINSN_setlocal_WC_0 => {
let val = state.pop(); let val = state.pop();
state.setlocal(0, val); state.setlocal(0, val);