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

Method start_patchable

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

Begin a region of patchable code. There is one requirement for the code that is emitted: It must not introduce any instructions that could be chomped (branches are an example of this). In other words, you must not call [`MachBuffer::add_cond_branch`] or [`MachBuffer::add_uncond_branch`] between calls to this method and [`MachBuffer::end_patchable`].

(&mut self)

Source from the content-addressed store, hash-verified

614 /// [`MachBuffer::add_uncond_branch`] between calls to this method and
615 /// [`MachBuffer::end_patchable`].
616 pub fn start_patchable(&mut self) -> OpenPatchRegion {
617 assert!(!self.open_patchable, "Patchable regions may not be nested");
618 self.open_patchable = true;
619 OpenPatchRegion(usize::try_from(self.cur_offset()).unwrap())
620 }
621
622 /// End a region of patchable code, yielding a [`PatchRegion`] value that
623 /// can be consumed later to produce a one-off mutable slice to the

Callers 3

patch_pc_rel_offsetFunction · 0.80
newMethod · 0.80
newMethod · 0.80

Calls 3

OpenPatchRegionClass · 0.85
cur_offsetMethod · 0.80
unwrapMethod · 0.45

Tested by

no test coverage detected