Struct wasmtime_jit::CompiledModule
source · [−]pub struct CompiledModule { /* private fields */ }
Expand description
A compiled wasm module, ready to be instantiated.
Implementations
sourceimpl CompiledModule
impl CompiledModule
sourcepub fn from_artifacts(
mmap: MmapVec,
info: Option<CompiledModuleInfo>,
profiler: &dyn ProfilingAgent,
id_allocator: &CompiledModuleIdAllocator
) -> Result<Self>
pub fn from_artifacts(
mmap: MmapVec,
info: Option<CompiledModuleInfo>,
profiler: &dyn ProfilingAgent,
id_allocator: &CompiledModuleIdAllocator
) -> Result<Self>
Creates CompiledModule
directly from a precompiled artifact.
The mmap
argument is expecte to be the result of a previous call to
finish_compile
above. This is an ELF image, at this time, which
contains all necessary information to create a CompiledModule
from a
compilation.
This method also takes info
, an optionally-provided deserialization of
the artifacts’ compilation metadata section. If this information is not
provided (e.g. it’s set to None
) then the information will be
deserialized from the image of the compilation artifacts. Otherwise it
will be assumed to be what would otherwise happen if the section were to
be deserialized.
The profiler
argument here is used to inform JIT profiling runtimes
about new code that is loaded.
sourcepub fn unique_id(&self) -> CompiledModuleId
pub fn unique_id(&self) -> CompiledModuleId
Get this module’s unique ID. It is unique with respect to a single allocator (which is ordinarily held on a Wasm engine).
sourcepub fn mmap(&self) -> &MmapVec
pub fn mmap(&self) -> &MmapVec
Returns the underlying memory which contains the compiled module’s image.
sourcepub fn wasm_data(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn wasm_data(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Returns the concatenated list of all data associated with this wasm module.
This is used for initialization of memories and all data ranges stored
in a Module
are relative to the slice returned here.
sourcepub fn address_map_data(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn address_map_data(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Returns the encoded address map section used to pass to
wasmtime_environ::lookup_file_pos
.
sourcepub fn trap_data(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn trap_data(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Returns the encoded trap information for this compiled image.
For more information see wasmtime_environ::trap_encoding
.
sourcepub fn code(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn code(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Returns the text section of the ELF image for this compiled module.
This memory should have the read/execute permissions.
sourcepub fn func_name(&self, idx: FuncIndex) -> Option<&str>
pub fn func_name(&self, idx: FuncIndex) -> Option<&str>
Looks up the name
section name for the function index idx
, if one
was specified in the original wasm module.
sourcepub fn module_mut(&mut self) -> Option<&mut Module>
pub fn module_mut(&mut self) -> Option<&mut Module>
Return a reference to a mutable module (if possible).
sourcepub fn finished_functions(
&self
) -> impl ExactSizeIterator<Item = (DefinedFuncIndex, *const [VMFunctionBody])> + '_
pub fn finished_functions(
&self
) -> impl ExactSizeIterator<Item = (DefinedFuncIndex, *const [VMFunctionBody])> + '_
Returns the map of all finished JIT functions compiled for this module
sourcepub fn trampolines(
&self
) -> impl Iterator<Item = (SignatureIndex, VMTrampoline, usize)> + '_
pub fn trampolines(
&self
) -> impl Iterator<Item = (SignatureIndex, VMTrampoline, usize)> + '_
Returns the per-signature trampolines for this module.
sourcepub fn stack_maps(
&self
) -> impl Iterator<Item = (*const [VMFunctionBody], &[StackMapInformation])>
pub fn stack_maps(
&self
) -> impl Iterator<Item = (*const [VMFunctionBody], &[StackMapInformation])>
Returns the stack map information for all functions defined in this module.
The iterator returned iterates over the span of the compiled function in memory with the stack maps associated with those bytes.
sourcepub fn func_by_text_offset(
&self,
text_offset: usize
) -> Option<(DefinedFuncIndex, u32)>
pub fn func_by_text_offset(
&self,
text_offset: usize
) -> Option<(DefinedFuncIndex, u32)>
Lookups a defined function by a program counter value.
Returns the defined function index and the relative address of
text_offset
within the function itself.
sourcepub fn func_info(&self, index: DefinedFuncIndex) -> &FunctionInfo
pub fn func_info(&self, index: DefinedFuncIndex) -> &FunctionInfo
Gets the function information for a given function index.
sourcepub fn symbolize_context(&self) -> Result<Option<SymbolizeContext<'_>>>
pub fn symbolize_context(&self) -> Result<Option<SymbolizeContext<'_>>>
Creates a new symbolication context which can be used to further symbolicate stack traces.
Basically this makes a thing which parses debuginfo and can tell you what filename and line number a wasm pc comes from.
sourcepub fn has_unparsed_debuginfo(&self) -> bool
pub fn has_unparsed_debuginfo(&self) -> bool
Returns whether the original wasm module had unparsed debug information based on the tunables configuration.
sourcepub fn has_address_map(&self) -> bool
pub fn has_address_map(&self) -> bool
Indicates whether this module came with n address map such that lookups
via wasmtime_environ::lookup_file_pos
will succeed.
If this function returns false
then lookup_file_pos
will always
return None
.
sourcepub fn image_range(&self) -> Range<usize>
pub fn image_range(&self) -> Range<usize>
Returns the bounds, in host memory, of where this module’s compiled image resides.
Auto Trait Implementations
impl RefUnwindSafe for CompiledModule
impl Send for CompiledModule
impl Sync for CompiledModule
impl Unpin for CompiledModule
impl UnwindSafe for CompiledModule
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more