Skip to content

Commit 64ea440

Browse files
committed
ZJIT: Removed unused self_val from InvokeSuper
1 parent 8f040a5 commit 64ea440

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

zjit/src/hir.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ pub enum Insn {
584584
/// Ignoring keyword arguments etc for now
585585
SendWithoutBlock { self_val: InsnId, cd: *const rb_call_data, args: Vec<InsnId>, state: InsnId },
586586
Send { self_val: InsnId, cd: *const rb_call_data, blockiseq: IseqPtr, args: Vec<InsnId>, state: InsnId },
587-
InvokeSuper { self_val: InsnId, cd: *const rb_call_data, blockiseq: IseqPtr, args: Vec<InsnId>, state: InsnId },
587+
InvokeSuper { cd: *const rb_call_data, blockiseq: IseqPtr, args: Vec<InsnId>, state: InsnId },
588588

589589
/// Optimized ISEQ call
590590
SendWithoutBlockDirect {
@@ -838,8 +838,8 @@ impl<'a> std::fmt::Display for InsnPrinter<'a> {
838838
}
839839
Ok(())
840840
}
841-
Insn::InvokeSuper { self_val, blockiseq, args, .. } => {
842-
write!(f, "InvokeSuper {self_val}, {:p}", self.ptr_map.map_ptr(blockiseq))?;
841+
Insn::InvokeSuper { blockiseq, args, .. } => {
842+
write!(f, "InvokeSuper {:p}", self.ptr_map.map_ptr(blockiseq))?;
843843
for arg in args {
844844
write!(f, ", {arg}")?;
845845
}
@@ -1342,8 +1342,7 @@ impl Function {
13421342
args: find_vec!(args),
13431343
state,
13441344
},
1345-
&InvokeSuper { self_val, cd, blockiseq, ref args, state } => InvokeSuper {
1346-
self_val: find!(self_val),
1345+
&InvokeSuper { cd, blockiseq, ref args, state } => InvokeSuper {
13471346
cd,
13481347
blockiseq,
13491348
args: find_vec!(args),
@@ -2270,13 +2269,13 @@ impl Function {
22702269
}
22712270
&Insn::Send { self_val, ref args, state, .. }
22722271
| &Insn::SendWithoutBlock { self_val, ref args, state, .. }
2273-
| &Insn::SendWithoutBlockDirect { self_val, ref args, state, .. }
2274-
| &Insn::InvokeSuper { self_val, ref args, state, .. } => {
2272+
| &Insn::SendWithoutBlockDirect { self_val, ref args, state, .. } => {
22752273
worklist.push_back(self_val);
22762274
worklist.extend(args);
22772275
worklist.push_back(state);
22782276
}
2279-
&Insn::InvokeBuiltin { ref args, state, .. } => {
2277+
&Insn::InvokeSuper { ref args, state, .. }
2278+
| &Insn::InvokeBuiltin { ref args, state, .. } => {
22802279
worklist.extend(args);
22812280
worklist.push_back(state)
22822281
}
@@ -3648,10 +3647,10 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
36483647
}
36493648
let argc = unsafe { vm_ci_argc((*cd).ci) };
36503649
let args = state.stack_pop_n(argc as usize)?;
3651-
let recv = state.stack_pop()?;
3650+
let _recv = state.stack_pop()?; // unused
36523651
let blockiseq: IseqPtr = get_arg(pc, 1).as_ptr();
36533652
let exit_id = fun.push_insn(block, Insn::Snapshot { state: exit_state });
3654-
let result = fun.push_insn(block, Insn::InvokeSuper { self_val: recv, cd, blockiseq, args, state: exit_id });
3653+
let result = fun.push_insn(block, Insn::InvokeSuper { cd, blockiseq, args, state: exit_id });
36553654
state.stack_push(result);
36563655

36573656
if !blockiseq.is_null() {
@@ -5160,7 +5159,7 @@ mod tests {
51605159
assert_snapshot!(hir_string("test"), @r"
51615160
fn test@<compiled>:2:
51625161
bb0(v0:BasicObject):
5163-
v5:BasicObject = InvokeSuper v0, 0x1000
5162+
v5:BasicObject = InvokeSuper 0x1000
51645163
CheckInterrupts
51655164
Return v5
51665165
");
@@ -5174,7 +5173,7 @@ mod tests {
51745173
assert_snapshot!(hir_string("test"), @r"
51755174
fn test@<compiled>:2:
51765175
bb0(v0:BasicObject):
5177-
v5:BasicObject = InvokeSuper v0, 0x1000
5176+
v5:BasicObject = InvokeSuper 0x1000
51785177
CheckInterrupts
51795178
Return v5
51805179
");

0 commit comments

Comments
 (0)