Skip to content

Commit 089bc81

Browse files
committed
ZJIT: Removed unused self_val from Send
1 parent 64ea440 commit 089bc81

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

zjit/src/hir.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ pub enum Insn {
583583
/// Un-optimized fallback implementation (dynamic dispatch) for send-ish instructions
584584
/// Ignoring keyword arguments etc for now
585585
SendWithoutBlock { self_val: InsnId, cd: *const rb_call_data, args: Vec<InsnId>, state: InsnId },
586-
Send { self_val: InsnId, cd: *const rb_call_data, blockiseq: IseqPtr, args: Vec<InsnId>, state: InsnId },
586+
Send { cd: *const rb_call_data, blockiseq: IseqPtr, args: Vec<InsnId>, state: InsnId },
587587
InvokeSuper { cd: *const rb_call_data, blockiseq: IseqPtr, args: Vec<InsnId>, state: InsnId },
588588

589589
/// Optimized ISEQ call
@@ -828,11 +828,11 @@ impl<'a> std::fmt::Display for InsnPrinter<'a> {
828828
}
829829
Ok(())
830830
}
831-
Insn::Send { self_val, cd, args, blockiseq, .. } => {
831+
Insn::Send { cd, args, blockiseq, .. } => {
832832
// For tests, we want to check HIR snippets textually. Addresses change
833833
// between runs, making tests fail. Instead, pick an arbitrary hex value to
834834
// use as a "pointer" so we can check the rest of the HIR.
835-
write!(f, "Send {self_val}, {:p}, :{}", self.ptr_map.map_ptr(blockiseq), ruby_call_method_name(*cd))?;
835+
write!(f, "Send {:p}, :{}", self.ptr_map.map_ptr(blockiseq), ruby_call_method_name(*cd))?;
836836
for arg in args {
837837
write!(f, ", {arg}")?;
838838
}
@@ -1335,8 +1335,7 @@ impl Function {
13351335
args: find_vec!(args),
13361336
state,
13371337
},
1338-
&Send { self_val, cd, blockiseq, ref args, state } => Send {
1339-
self_val: find!(self_val),
1338+
&Send { cd, blockiseq, ref args, state } => Send {
13401339
cd,
13411340
blockiseq,
13421341
args: find_vec!(args),
@@ -2267,14 +2266,14 @@ impl Function {
22672266
worklist.push_back(val);
22682267
worklist.push_back(state);
22692268
}
2270-
&Insn::Send { self_val, ref args, state, .. }
22712269
| &Insn::SendWithoutBlock { self_val, ref args, state, .. }
22722270
| &Insn::SendWithoutBlockDirect { self_val, ref args, state, .. } => {
22732271
worklist.push_back(self_val);
22742272
worklist.extend(args);
22752273
worklist.push_back(state);
22762274
}
22772275
&Insn::InvokeSuper { ref args, state, .. }
2276+
| &Insn::Send { ref args, state, .. }
22782277
| &Insn::InvokeBuiltin { ref args, state, .. } => {
22792278
worklist.extend(args);
22802279
worklist.push_back(state)
@@ -3622,9 +3621,9 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
36223621
let argc = unsafe { vm_ci_argc((*cd).ci) };
36233622

36243623
let args = state.stack_pop_n(argc as usize)?;
3625-
let recv = state.stack_pop()?;
3624+
let _recv = state.stack_pop()?; // unused
36263625
let exit_id = fun.push_insn(block, Insn::Snapshot { state: exit_state });
3627-
let send = fun.push_insn(block, Insn::Send { self_val: recv, cd, blockiseq, args, state: exit_id });
3626+
let send = fun.push_insn(block, Insn::Send { cd, blockiseq, args, state: exit_id });
36283627
state.stack_push(send);
36293628

36303629
// Reload locals that may have been modified by the blockiseq.
@@ -5048,7 +5047,7 @@ mod tests {
50485047
fn test@<compiled>:3:
50495048
bb0(v0:BasicObject, v1:BasicObject):
50505049
v5:BasicObject = GetLocal l0, EP@3
5051-
v7:BasicObject = Send v5, 0x1000, :each
5050+
v7:BasicObject = Send 0x1000, :each
50525051
v8:BasicObject = GetLocal l0, EP@3
50535052
CheckInterrupts
50545053
Return v7
@@ -7734,7 +7733,7 @@ mod opt_tests {
77347733
assert_snapshot!(hir_string("test"), @r"
77357734
fn test@<compiled>:3:
77367735
bb0(v0:BasicObject):
7737-
v5:BasicObject = Send v0, 0x1000, :foo
7736+
v5:BasicObject = Send 0x1000, :foo
77387737
CheckInterrupts
77397738
Return v5
77407739
");
@@ -7758,7 +7757,7 @@ mod opt_tests {
77587757
v1:NilClass = Const Value(nil)
77597758
v5:Fixnum[1] = Const Value(1)
77607759
SetLocal l0, EP@3, v5
7761-
v10:BasicObject = Send v0, 0x1000, :foo
7760+
v10:BasicObject = Send 0x1000, :foo
77627761
v11:BasicObject = GetLocal l0, EP@3
77637762
v14:BasicObject = GetLocal l0, EP@3
77647763
CheckInterrupts

0 commit comments

Comments
 (0)