Trait wasmtime_runtime::ModuleRuntimeInfo
source · pub trait ModuleRuntimeInfo: Send + Sync + 'static {
// Required methods
fn module(&self) -> &Arc<Module>;
fn signature(&self, index: SignatureIndex) -> VMSharedSignatureIndex;
fn image_base(&self) -> usize;
fn function_info(&self, func_index: DefinedFuncIndex) -> &FunctionInfo;
fn memory_image(
&self,
memory: DefinedMemoryIndex
) -> Result<Option<&Arc<MemoryImage>>>;
fn unique_id(&self) -> Option<CompiledModuleId>;
fn wasm_data(&self) -> &[u8] ⓘ;
fn signature_ids(&self) -> &[VMSharedSignatureIndex];
}
Expand description
Functionality required by this crate for a particular module. This is chiefly needed for lazy initialization of various bits of instance state.
When an instance is created, it holds an Arcwasmtime::module::ModuleInner
. Since the runtime crate sits at
the bottom of the dependence DAG though, we don’t know or care about
that; we just need some implementor of this trait for each
allocation request.
Required Methods§
sourcefn signature(&self, index: SignatureIndex) -> VMSharedSignatureIndex
fn signature(&self, index: SignatureIndex) -> VMSharedSignatureIndex
The signatures.
sourcefn image_base(&self) -> usize
fn image_base(&self) -> usize
The base address of where JIT functions are located.
sourcefn function_info(&self, func_index: DefinedFuncIndex) -> &FunctionInfo
fn function_info(&self, func_index: DefinedFuncIndex) -> &FunctionInfo
Descriptors about each compiled function, such as the offset from
image_base
.
sourcefn memory_image(
&self,
memory: DefinedMemoryIndex
) -> Result<Option<&Arc<MemoryImage>>>
fn memory_image( &self, memory: DefinedMemoryIndex ) -> Result<Option<&Arc<MemoryImage>>>
Returns the MemoryImage
structure used for copy-on-write
initialization of the memory, if it’s applicable.
sourcefn unique_id(&self) -> Option<CompiledModuleId>
fn unique_id(&self) -> Option<CompiledModuleId>
A unique ID for this particular module. This can be used to allow for fastpaths to optimize a “re-instantiate the same module again” case.
sourcefn wasm_data(&self) -> &[u8] ⓘ
fn wasm_data(&self) -> &[u8] ⓘ
A slice pointing to all data that is referenced by this instance.
sourcefn signature_ids(&self) -> &[VMSharedSignatureIndex]
fn signature_ids(&self) -> &[VMSharedSignatureIndex]
Returns an array, indexed by SignatureIndex
of all
VMSharedSignatureIndex
entries corresponding to the SignatureIndex
.