File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments