Skip to content

Commit 13c2f8d

Browse files
st0012k0kubun
authored andcommitted
ZJIT: Removed unused self_val from Send
1 parent 877b625 commit 13c2f8d

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

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
InvokeBlock { cd: *const rb_call_data, args: Vec<InsnId>, state: InsnId },
589589

@@ -829,11 +829,11 @@ impl<'a> std::fmt::Display for InsnPrinter<'a> {
829829
}
830830
Ok(())
831831
}
832-
Insn::Send { self_val, cd, args, blockiseq, .. } => {
832+
Insn::Send { cd, args, blockiseq, .. } => {
833833
// For tests, we want to check HIR snippets textually. Addresses change
834834
// between runs, making tests fail. Instead, pick an arbitrary hex value to
835835
// use as a "pointer" so we can check the rest of the HIR.
836-
write!(f, "Send {self_val}, {:p}, :{}", self.ptr_map.map_ptr(blockiseq), ruby_call_method_name(*cd))?;
836+
write!(f, "Send {:p}, :{}", self.ptr_map.map_ptr(blockiseq), ruby_call_method_name(*cd))?;
837837
for arg in args {
838838
write!(f, ", {arg}")?;
839839
}
@@ -1343,8 +1343,7 @@ impl Function {
13431343
args: find_vec!(args),
13441344
state,
13451345
},
1346-
&Send { self_val, cd, blockiseq, ref args, state } => Send {
1347-
self_val: find!(self_val),
1346+
&Send { cd, blockiseq, ref args, state } => Send {
13481347
cd,
13491348
blockiseq,
13501349
args: find_vec!(args),
@@ -2281,14 +2280,14 @@ impl Function {
22812280
worklist.push_back(val);
22822281
worklist.push_back(state);
22832282
}
2284-
&Insn::Send { self_val, ref args, state, .. }
22852283
| &Insn::SendWithoutBlock { self_val, ref args, state, .. }
22862284
| &Insn::SendWithoutBlockDirect { self_val, ref args, state, .. } => {
22872285
worklist.push_back(self_val);
22882286
worklist.extend(args);
22892287
worklist.push_back(state);
22902288
}
22912289
&Insn::InvokeSuper { ref args, state, .. }
2290+
| &Insn::Send { ref args, state, .. }
22922291
| &Insn::InvokeBuiltin { ref args, state, .. }
22932292
| &Insn::InvokeBlock { ref args, state, .. } => {
22942293
worklist.extend(args);
@@ -3623,9 +3622,9 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
36233622
let argc = unsafe { vm_ci_argc((*cd).ci) };
36243623

36253624
let args = state.stack_pop_n(argc as usize)?;
3626-
let recv = state.stack_pop()?;
3625+
let _recv = state.stack_pop()?;
36273626
let exit_id = fun.push_insn(block, Insn::Snapshot { state: exit_state });
3628-
let send = fun.push_insn(block, Insn::Send { self_val: recv, cd, blockiseq, args, state: exit_id });
3627+
let send = fun.push_insn(block, Insn::Send { cd, blockiseq, args, state: exit_id });
36293628
state.stack_push(send);
36303629

36313630
// Reload locals that may have been modified by the blockiseq.
@@ -5064,7 +5063,7 @@ mod tests {
50645063
fn test@<compiled>:3:
50655064
bb0(v0:BasicObject, v1:BasicObject):
50665065
v5:BasicObject = GetLocal l0, EP@3
5067-
v7:BasicObject = Send v5, 0x1000, :each
5066+
v7:BasicObject = Send 0x1000, :each
50685067
v8:BasicObject = GetLocal l0, EP@3
50695068
CheckInterrupts
50705069
Return v7
@@ -7799,7 +7798,7 @@ mod opt_tests {
77997798
assert_snapshot!(hir_string("test"), @r"
78007799
fn test@<compiled>:3:
78017800
bb0(v0:BasicObject):
7802-
v5:BasicObject = Send v0, 0x1000, :foo
7801+
v5:BasicObject = Send 0x1000, :foo
78037802
CheckInterrupts
78047803
Return v5
78057804
");
@@ -7823,7 +7822,7 @@ mod opt_tests {
78237822
v1:NilClass = Const Value(nil)
78247823
v5:Fixnum[1] = Const Value(1)
78257824
SetLocal l0, EP@3, v5
7826-
v10:BasicObject = Send v0, 0x1000, :foo
7825+
v10:BasicObject = Send 0x1000, :foo
78277826
v11:BasicObject = GetLocal l0, EP@3
78287827
v14:BasicObject = GetLocal l0, EP@3
78297828
CheckInterrupts

0 commit comments

Comments
 (0)