Skip to content

Commit c4540eb

Browse files
authored
ZJIT: Just make a new block (ruby#17307)
I don't know what the original code was intending to do but we should always be making a new block.
1 parent f022064 commit c4540eb

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

zjit/src/hir.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7175,7 +7175,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
71757175
let pushval = get_arg(pc, 2);
71767176
if let Some(summary) = fun.polymorphic_summary(&profiles, self_param, exit_state.insn_idx) {
71777177
self_param = fun.push_insn(block, Insn::GuardType { val: self_param, guard_type: types::HeapBasicObject, state: exit_id, recompile: None });
7178-
let join_block = insn_idx_to_block.get(&insn_idx).copied().unwrap_or_else(|| fun.new_block(insn_idx));
7178+
let join_block = fun.new_block(insn_idx);
71797179
let join_param = fun.push_insn(join_block, Insn::Param);
71807180
// Dedup by expected shape so objects with different classes but the
71817181
// same shape can share code.
@@ -7566,7 +7566,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
75667566
// - unmodified: inspect the block handler and produce proxy/nil
75677567
let modified_block = fun.new_block(branch_insn_idx);
75687568
let unmodified_block = fun.new_block(branch_insn_idx);
7569-
let join_block = insn_idx_to_block.get(&insn_idx).copied().unwrap_or_else(|| fun.new_block(insn_idx));
7569+
let join_block = fun.new_block(insn_idx);
75707570
let join_result = fun.push_insn(join_block, Insn::Param);
75717571
let join_local = if level == 0 { Some(fun.push_insn(join_block, Insn::Param)) } else { None };
75727572

@@ -7800,7 +7800,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
78007800
// Otherwise, convert it to a Proc and store it to EP.
78017801
let modified_block = fun.new_block(branch_insn_idx);
78027802
let unmodified_block = fun.new_block(branch_insn_idx);
7803-
let join_block = insn_idx_to_block.get(&insn_idx).copied().unwrap_or_else(|| fun.new_block(insn_idx));
7803+
let join_block = fun.new_block(insn_idx);
78047804
let join_param = fun.push_insn(join_block, Insn::Param);
78057805

78067806
let ep = fun.push_insn(block, Insn::GetEP { level });
@@ -8042,7 +8042,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
80428042
let recv = state.stack_topn(argc as usize)?; // args are on top
80438043
let entry_args = state.as_args(self_param);
80448044
if let Some(summary) = fun.polymorphic_summary(&profiles, recv, exit_state.insn_idx) {
8045-
let join_block = insn_idx_to_block.get(&insn_idx).copied().unwrap_or_else(|| fun.new_block(insn_idx));
8045+
let join_block = fun.new_block(insn_idx);
80468046
// Dedup by expected type so immediate/heap variants
80478047
// under the same Ruby class can still get separate branches.
80488048
let mut seen_types = Vec::with_capacity(summary.buckets().len());
@@ -8380,7 +8380,7 @@ pub fn iseq_to_hir(iseq: *const rb_iseq_t) -> Result<Function, ParseError> {
83808380
}
83818381
if let Some(summary) = fun.polymorphic_summary(&profiles, self_param, exit_state.insn_idx) {
83828382
self_param = fun.push_insn(block, Insn::GuardType { val: self_param, guard_type: types::HeapBasicObject, state: exit_id, recompile: None });
8383-
let join_block = insn_idx_to_block.get(&insn_idx).copied().unwrap_or_else(|| fun.new_block(insn_idx));
8383+
let join_block = fun.new_block(insn_idx);
83848384
let join_param = fun.push_insn(join_block, Insn::Param);
83858385
// Dedup by expected shape so objects with different classes but the same shape can share code
83868386
// TODO(max): De-duplicate further by checking ivar offsets to allow

0 commit comments

Comments
 (0)