Skip to content

Commit 877b625

Browse files
st0012k0kubun
authored andcommitted
ZJIT: Removed unused self_val from InvokeSuper
1 parent 33cd970 commit 877b625

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

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

590590
/// Optimized ISEQ call
@@ -839,8 +839,8 @@ impl<'a> std::fmt::Display for InsnPrinter<'a> {
839839
}
840840
Ok(())
841841
}
842-
Insn::InvokeSuper { self_val, blockiseq, args, .. } => {
843-
write!(f, "InvokeSuper {self_val}, {:p}", self.ptr_map.map_ptr(blockiseq))?;
842+
Insn::InvokeSuper { blockiseq, args, .. } => {
843+
write!(f, "InvokeSuper {:p}", self.ptr_map.map_ptr(blockiseq))?;
844844
for arg in args {
845845
write!(f, ", {arg}")?;
846846
}
@@ -1350,8 +1350,7 @@ impl Function {
13501350
args: find_vec!(args),
13511351
state,
13521352
},
1353-
&InvokeSuper { self_val, cd, blockiseq, ref args, state } => InvokeSuper {
1354-
self_val: find!(self_val),
1353+
&InvokeSuper { cd, blockiseq, ref args, state } => InvokeSuper {
13551354
cd,
13561355
blockiseq,
13571356
args: find_vec!(args),
@@ -2284,13 +2283,13 @@ impl Function {
22842283
}
22852284
&Insn::Send { self_val, ref args, state, .. }
22862285
| &Insn::SendWithoutBlock { self_val, ref args, state, .. }
2287-
| &Insn::SendWithoutBlockDirect { self_val, ref args, state, .. }
2288-
| &Insn::InvokeSuper { self_val, ref args, state, .. } => {
2286+
| &Insn::SendWithoutBlockDirect { self_val, ref args, state, .. } => {
22892287
worklist.push_back(self_val);
22902288
worklist.extend(args);
22912289
worklist.push_back(state);
22922290
}
2293-
&Insn::InvokeBuiltin { ref args, state, .. }
2291+
&Insn::InvokeSuper { ref args, state, .. }
2292+
| &Insn::InvokeBuiltin { ref args, state, .. }
22942293
| &Insn::InvokeBlock { ref args, state, .. } => {
22952294
worklist.extend(args);
22962295
worklist.push_back(state)
@@ -3649,10 +3648,10 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
36493648
}
36503649
let argc = unsafe { vm_ci_argc((*cd).ci) };
36513650
let args = state.stack_pop_n(argc as usize)?;
3652-
let recv = state.stack_pop()?;
3651+
let _recv = state.stack_pop()?;
36533652
let blockiseq: IseqPtr = get_arg(pc, 1).as_ptr();
36543653
let exit_id = fun.push_insn(block, Insn::Snapshot { state: exit_state });
3655-
let result = fun.push_insn(block, Insn::InvokeSuper { self_val: recv, cd, blockiseq, args, state: exit_id });
3654+
let result = fun.push_insn(block, Insn::InvokeSuper { cd, blockiseq, args, state: exit_id });
36563655
state.stack_push(result);
36573656

36583657
if !blockiseq.is_null() {
@@ -5176,7 +5175,7 @@ mod tests {
51765175
assert_snapshot!(hir_string("test"), @r"
51775176
fn test@<compiled>:2:
51785177
bb0(v0:BasicObject):
5179-
v5:BasicObject = InvokeSuper v0, 0x1000
5178+
v5:BasicObject = InvokeSuper 0x1000
51805179
CheckInterrupts
51815180
Return v5
51825181
");
@@ -5190,7 +5189,7 @@ mod tests {
51905189
assert_snapshot!(hir_string("test"), @r"
51915190
fn test@<compiled>:2:
51925191
bb0(v0:BasicObject):
5193-
v5:BasicObject = InvokeSuper v0, 0x1000
5192+
v5:BasicObject = InvokeSuper 0x1000
51945193
CheckInterrupts
51955194
Return v5
51965195
");

0 commit comments

Comments
 (0)