[][src]Trait wasmer_engine::Artifact

pub trait Artifact: Send + Sync + Upcastable {
    fn module(&self) -> Arc<ModuleInfo>;
fn module_ref(&self) -> &ModuleInfo;
fn module_mut(&mut self) -> Option<&mut ModuleInfo>;
fn register_frame_info(&self);
fn features(&self) -> &Features;
fn memory_styles(&self) -> &PrimaryMap<MemoryIndex, MemoryStyle>;
fn table_styles(&self) -> &PrimaryMap<TableIndex, TableStyle>;
fn data_initializers(&self) -> &[OwnedDataInitializer];
fn finished_functions(
        &self
    ) -> &BoxedSlice<LocalFunctionIndex, FunctionBodyPtr>;
fn finished_dynamic_function_trampolines(
        &self
    ) -> &BoxedSlice<FunctionIndex, FunctionBodyPtr>;
fn signatures(&self) -> &BoxedSlice<SignatureIndex, VMSharedSignatureIndex>;
fn serialize(&self) -> Result<Vec<u8>, SerializeError>; fn serialize_to_file(&self, path: &Path) -> Result<(), SerializeError> { ... }
fn preinstantiate(&self) -> Result<(), InstantiationError> { ... }
unsafe fn instantiate(
        &self,
        tunables: &dyn Tunables,
        resolver: &dyn Resolver,
        host_state: Box<dyn Any>
    ) -> Result<InstanceHandle, InstantiationError> { ... }
unsafe fn finish_instantiation(
        &self,
        handle: &InstanceHandle
    ) -> Result<(), InstantiationError> { ... } }

An Artifact is the product that the Engine implementation produce and use.

The Artifact contains the compiled data for a given module as well as extra information needed to run the module at runtime, such as ModuleInfo and Features.

Required methods

fn module(&self) -> Arc<ModuleInfo>

Return a reference-counted pointer to the module

fn module_ref(&self) -> &ModuleInfo

Return a pointer to a module.

fn module_mut(&mut self) -> Option<&mut ModuleInfo>

Gets a mutable reference to the info.

Note: this will return None if the module is already instantiated.

fn register_frame_info(&self)

Register thie Artifact stack frame information into the global scope.

This is required to ensure that any traps can be properly symbolicated.

fn features(&self) -> &Features

Returns the features for this Artifact

fn memory_styles(&self) -> &PrimaryMap<MemoryIndex, MemoryStyle>

Returns the memory styles associated with this Artifact.

fn table_styles(&self) -> &PrimaryMap<TableIndex, TableStyle>

Returns the table plans associated with this Artifact.

fn data_initializers(&self) -> &[OwnedDataInitializer]

Returns data initializers to pass to InstanceHandle::initialize

fn finished_functions(&self) -> &BoxedSlice<LocalFunctionIndex, FunctionBodyPtr>

Returns the functions allocated in memory or this Artifact ready to be run.

fn finished_dynamic_function_trampolines(
    &self
) -> &BoxedSlice<FunctionIndex, FunctionBodyPtr>

Returns the dynamic function trampolines allocated in memory for this Artifact, ready to be run.

fn signatures(&self) -> &BoxedSlice<SignatureIndex, VMSharedSignatureIndex>

Returns the associated VM signatures for this Artifact.

fn serialize(&self) -> Result<Vec<u8>, SerializeError>

Serializes an artifact into bytes

Loading content...

Provided methods

fn serialize_to_file(&self, path: &Path) -> Result<(), SerializeError>

Serializes an artifact into a file path

fn preinstantiate(&self) -> Result<(), InstantiationError>

Do preinstantiation logic that is executed before instantiating

unsafe fn instantiate(
    &self,
    tunables: &dyn Tunables,
    resolver: &dyn Resolver,
    host_state: Box<dyn Any>
) -> Result<InstanceHandle, InstantiationError>

Crate an Instance from this Artifact.

Safety

See InstanceHandle::new.

unsafe fn finish_instantiation(
    &self,
    handle: &InstanceHandle
) -> Result<(), InstantiationError>

Finishes the instantiation of a just created InstanceHandle.

Safety

See InstanceHandle::finish_instantiation.

Loading content...

Implementations

impl dyn Artifact + 'static[src]

pub fn downcast_ref<T: 'static>(&self) -> Option<&T>[src]

Try to downcast the artifact into a given type.

pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T>[src]

Try to downcast the artifact into a given type mutably.

Implementors

Loading content...