Skip to content

Commit 8748184

Browse files
tenderlovek0kubun
andcommitted
Update zjit/src/backend/lir.rs
Co-authored-by: Takashi Kokubun <[email protected]>
1 parent c42d9a6 commit 8748184

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

zjit/src/backend/lir.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,12 +1751,12 @@ impl Assembler
17511751
self.expand_branch_insn(insn, &mut insns);
17521752
}
17531753

1754-
// If the last instruction of the block is a ret, add a pad patch point after it
1755-
if let Some(last_insn) = block.insns.last() {
1756-
if matches!(last_insn, Insn::CRet(_)) {
1757-
insns.push(Insn::PadPatchPoint);
1758-
}
1759-
}
1754+
// If the last instruction of the block is a ret, add a pad patch point after it.
1755+
// Otherwise, because a jump may be longer than a ret, a PatchPoint right before
1756+
// a ret may overwrite the next block.
1757+
//
1758+
// We also need to ensure the current block is long enough to insert a patch point.
1759+
insns.push(Insn::PadPatchPoint);
17601760
}
17611761
insns
17621762
}

0 commit comments

Comments
 (0)