pub struct CompiledModule { /* private fields */ }Expand description
A compiled wasm module, ready to be instantiated.
Implementations§
Source§impl CompiledModule
impl CompiledModule
Sourcepub fn from_artifacts(
code_memory: Arc<CodeMemory>,
info: CompiledModuleInfo,
index: Arc<CompiledFunctionsTable>,
profiler: &dyn ProfilingAgent,
) -> Result<Self>
Available on crate feature runtime only.
pub fn from_artifacts( code_memory: Arc<CodeMemory>, info: CompiledModuleInfo, index: Arc<CompiledFunctionsTable>, profiler: &dyn ProfilingAgent, ) -> Result<Self>
runtime only.Creates CompiledModule directly from a precompiled artifact.
The code_memory argument is expected to be the result of a previous
call to ObjectBuilder::finish 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 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
Available on crate feature runtime only.
pub fn unique_id(&self) -> CompiledModuleId
runtime only.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
Available on crate feature runtime only.
pub fn mmap(&self) -> &MmapVec
runtime only.Returns the underlying memory which contains the compiled module’s image.
Sourcepub fn code_memory(&self) -> &Arc<CodeMemory>
Available on crate feature runtime only.
pub fn code_memory(&self) -> &Arc<CodeMemory>
runtime only.Returns the underlying owned mmap of this compiled image.
Sourcepub fn text(&self) -> &[u8] ⓘ
Available on crate feature runtime only.
pub fn text(&self) -> &[u8] ⓘ
runtime only.Returns the text section of the ELF image for this compiled module.
This memory should have the read/execute permissions.
Sourcepub fn module(&self) -> &Arc<Module>
Available on crate feature runtime only.
pub fn module(&self) -> &Arc<Module>
runtime only.Return a reference-counting pointer to a module.
Sourcepub fn func_name(&self, idx: FuncIndex) -> Option<&str>
Available on crate feature runtime only.
pub fn func_name(&self, idx: FuncIndex) -> Option<&str>
runtime only.Looks up the name section name for the function index idx, if one
was specified in the original wasm module.
Sourcepub fn finished_functions(
&self,
) -> impl ExactSizeIterator<Item = (DefinedFuncIndex, &[u8])> + '_
Available on crate feature runtime only.
pub fn finished_functions( &self, ) -> impl ExactSizeIterator<Item = (DefinedFuncIndex, &[u8])> + '_
runtime only.Returns an iterator over all functions defined within this module with their index and their body in memory.
Sourcepub fn finished_function(&self, def_func_index: DefinedFuncIndex) -> &[u8] ⓘ
Available on crate feature runtime only.
pub fn finished_function(&self, def_func_index: DefinedFuncIndex) -> &[u8] ⓘ
runtime only.Returns the body of the function that index points to.
Sourcepub fn array_to_wasm_trampoline(
&self,
def_func_index: DefinedFuncIndex,
) -> Option<&[u8]>
Available on crate feature runtime only.
pub fn array_to_wasm_trampoline( &self, def_func_index: DefinedFuncIndex, ) -> Option<&[u8]>
runtime only.Get the array-to-Wasm trampoline for the function index points to.
If the function index points to does not escape, then None is
returned.
These trampolines are used for array callers (e.g. Func::new)
calling Wasm callees.
Sourcepub fn wasm_to_array_trampoline(
&self,
signature: ModuleInternedTypeIndex,
) -> Option<&[u8]>
Available on crate feature runtime only.
pub fn wasm_to_array_trampoline( &self, signature: ModuleInternedTypeIndex, ) -> Option<&[u8]>
runtime only.Get the Wasm-to-array trampoline for the given signature.
These trampolines are used for filling in
VMFuncRef::wasm_call for Func::wrap-style host funcrefs
that don’t have access to a compiler when created.
Sourcepub fn func_by_text_offset(
&self,
text_offset: usize,
) -> Option<DefinedFuncIndex>
Available on crate feature runtime only.
pub fn func_by_text_offset( &self, text_offset: usize, ) -> Option<DefinedFuncIndex>
runtime only.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_loc(&self, def_func_index: DefinedFuncIndex) -> &FunctionLoc
Available on crate feature runtime only.
pub fn func_loc(&self, def_func_index: DefinedFuncIndex) -> &FunctionLoc
runtime only.Gets the function location information for a given function index.
Sourcepub fn func_start_srcloc(&self, def_func_index: DefinedFuncIndex) -> FilePos
Available on crate feature runtime only.
pub fn func_start_srcloc(&self, def_func_index: DefinedFuncIndex) -> FilePos
runtime only.Returns the original binary offset in the file that index was defined
at.
Sourcepub fn symbolize_context(&self) -> Result<Option<SymbolizeContext<'_>>>
Available on crate features runtime and addr2line only.
pub fn symbolize_context(&self) -> Result<Option<SymbolizeContext<'_>>>
runtime and addr2line only.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
Available on crate feature runtime only.
pub fn has_unparsed_debuginfo(&self) -> bool
runtime only.Returns whether the original wasm module had unparsed debug information based on the tunables configuration.
Sourcepub fn has_address_map(&self) -> bool
Available on crate feature runtime only.
pub fn has_address_map(&self) -> bool
runtime only.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.
Auto Trait Implementations§
impl Freeze for CompiledModule
impl !RefUnwindSafe for CompiledModule
impl Send for CompiledModule
impl Sync for CompiledModule
impl Unpin for CompiledModule
impl !UnwindSafe for CompiledModule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more