MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / defer_trap

Method defer_trap

cranelift/codegen/src/machinst/buffer.rs:1300–1308  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 {

Callers 4

emitFunction · 0.80
emitMethod · 0.80
pulley_emitFunction · 0.80

Calls 3

get_labelMethod · 0.45
pushMethod · 0.45
mapMethod · 0.45

Tested by 1