From e19ccddb9bc9fb2fc037f51ee64e1fb8eb1f04db Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Thu, 6 Feb 2025 16:30:58 -0500 Subject: YARVINSN_opt_send_without_block, can do `-e nil.itself` --- zjit/src/ir.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/zjit/src/ir.rs b/zjit/src/ir.rs index 414e46a7a4..ce0409eda2 100644 --- a/zjit/src/ir.rs +++ b/zjit/src/ir.rs @@ -364,6 +364,22 @@ pub fn iseq_to_ssa(iseq: *const rb_iseq_t) -> Function { YARVINSN_leave => { fun.push_insn(block, Insn::Return { val: state.pop() }); } + + YARVINSN_opt_send_without_block => { + let cd: *const rb_call_data = get_arg(pc, 0).as_ptr(); + let call_info = unsafe { rb_get_call_data_ci(cd) }; + let argc = unsafe { vm_ci_argc((*cd).ci) }; + + + let method_name = unsafe { + let mid = rb_vm_ci_mid(call_info); + cstr_to_rust_string(rb_id2name(mid)).unwrap_or_else(|| "".to_owned()) + }; + + assert_eq!(0, argc, "really, it's pop(argc), and more, but idk how to do that yet"); + let recv = state.pop(); + state.push(Opnd::Insn(fun.push_insn(block, Insn::Send { self_val: recv, call_info: CallInfo { name: method_name }, args: vec![] }))); + } _ => eprintln!("zjit: to_ssa: unknown opcode `{}'", insn_name(opcode as usize)), } } -- cgit v1.2.3