Struct wasmtime_jit::CodeMemory
source · pub struct CodeMemory { /* private fields */ }
Expand description
Management of executable memory within a MmapVec
This type consumes ownership of a region of memory and will manage the executable permissions of the contained JIT code as necessary.
Implementations§
source§impl CodeMemory
impl CodeMemory
sourcepub fn new(mmap: MmapVec) -> Self
pub fn new(mmap: MmapVec) -> Self
Creates a new CodeMemory
by taking ownership of the provided
MmapVec
.
The returned CodeMemory
manages the internal MmapVec
and the
publish
method is used to actually make the memory executable.
sourcepub fn publish(&mut self) -> Result<Publish<'_>>
pub fn publish(&mut self) -> Result<Publish<'_>>
Publishes the internal ELF image to be ready for execution.
This method can only be called once and will panic if called twice. This
will parse the ELF image from the original MmapVec
and do everything
necessary to get it ready for execution, including:
- Change page protections from read/write to read/execute.
- Register unwinding information with the OS
After this function executes all JIT code should be ready to execute.
The various parsed results of the internals of the MmapVec
are
returned through the Publish
structure.