Emit a trap at some point in the future with the specified code and stack map. This function returns a [`MachLabel`] which will be the future address of the trap. Jumps should refer to this label, likely by using the [`MachBuffer::use_label_at_offset`] method, to get a relocation patched in once the address of the trap is known. This will batch all traps into the end of the function.
(&mut self, code: TrapCode)
| 1298 | /// |
| 1299 | /// This will batch all traps into the end of the function. |
| 1300 | pub fn defer_trap(&mut self, code: TrapCode) -> MachLabel { |
| 1301 | let label = self.get_label(); |
| 1302 | self.pending_traps.push(MachLabelTrap { |
| 1303 | label, |
| 1304 | code, |
| 1305 | loc: self.cur_srcloc.map(|(_start, loc)| loc), |
| 1306 | }); |
| 1307 | label |
| 1308 | } |
| 1309 | |
| 1310 | /// Is an island needed within the next N bytes? |
| 1311 | pub fn island_needed(&self, distance: CodeOffset) -> bool { |