AArch64: don't assert inst within worst-case size when island emitted. (#4627)

We assert after emitting each instruction that its size was less than
the "worst-case size", which is used to determine when we need to
proactively emit an island so pending branch fixups don't go out of
bounds. However, the `EmitIsland` pseudo-inst itself can cause an
arbitrarily large island to be emitted; this should not have to fit
within the worst-case size (because island size is explicitly accounted
for by the threshold computation). This PR fixes the assert accordingly.

Fixes #4626.
This commit is contained in:
Chris Fallin
2022-08-05 17:27:56 -07:00
committed by GitHub
parent 95e72db458
commit c5e3c0cafb

View File

@@ -3140,7 +3140,13 @@ impl MachInstEmit for Inst {
} }
let end_off = sink.cur_offset(); let end_off = sink.cur_offset();
debug_assert!((end_off - start_off) <= Inst::worst_case_size()); debug_assert!(
(end_off - start_off) <= Inst::worst_case_size()
|| matches!(self, Inst::EmitIsland { .. }),
"Worst case size exceed for {:?}: {}",
self,
end_off - start_off
);
state.clear_post_insn(); state.clear_post_insn();
} }