Trait wasmtime_runtime::InstanceAllocator[][src]

pub unsafe trait InstanceAllocator: Send + Sync {
    unsafe fn allocate(
        &self,
        req: InstanceAllocationRequest<'_>
    ) -> Result<InstanceHandle, InstantiationError>;
unsafe fn initialize(
        &self,
        handle: &InstanceHandle,
        is_bulk_memory: bool
    ) -> Result<(), InstantiationError>;
unsafe fn deallocate(&self, handle: &InstanceHandle); fn validate(&self, module: &Module) -> Result<()> { ... }
fn adjust_tunables(&self, tunables: &mut Tunables) { ... } }
Expand description

Represents a runtime instance allocator.

Safety

This trait is unsafe as it requires knowledge of Wasmtime’s runtime internals to implement correctly.

Required methods

unsafe fn allocate(
    &self,
    req: InstanceAllocationRequest<'_>
) -> Result<InstanceHandle, InstantiationError>
[src]

Allocates an instance for the given allocation request.

Safety

This method is not inherently unsafe, but care must be made to ensure pointers passed in the allocation request outlive the returned instance.

unsafe fn initialize(
    &self,
    handle: &InstanceHandle,
    is_bulk_memory: bool
) -> Result<(), InstantiationError>
[src]

Finishes the instantiation process started by an instance allocator.

Safety

This method is only safe to call immediately after an instance has been allocated.

unsafe fn deallocate(&self, handle: &InstanceHandle)[src]

Deallocates a previously allocated instance.

Safety

This function is unsafe because there are no guarantees that the given handle is the only owner of the underlying instance to deallocate.

Use extreme care when deallocating an instance so that there are no dangling instance pointers.

Provided methods

fn validate(&self, module: &Module) -> Result<()>[src]

Validates that a module is supported by the allocator.

fn adjust_tunables(&self, tunables: &mut Tunables)[src]

Adjusts the tunables prior to creation of any JIT compiler.

This method allows the instance allocator control over tunables passed to a wasmtime_jit::Compiler.

Implementors

impl InstanceAllocator for OnDemandInstanceAllocator[src]

unsafe fn allocate(
    &self,
    req: InstanceAllocationRequest<'_>
) -> Result<InstanceHandle, InstantiationError>
[src]

unsafe fn initialize(
    &self,
    handle: &InstanceHandle,
    is_bulk_memory: bool
) -> Result<(), InstantiationError>
[src]

unsafe fn deallocate(&self, handle: &InstanceHandle)[src]

impl InstanceAllocator for PoolingInstanceAllocator[src]

fn validate(&self, module: &Module) -> Result<()>[src]

fn adjust_tunables(&self, tunables: &mut Tunables)[src]

unsafe fn allocate(
    &self,
    req: InstanceAllocationRequest<'_>
) -> Result<InstanceHandle, InstantiationError>
[src]

unsafe fn initialize(
    &self,
    handle: &InstanceHandle,
    is_bulk_memory: bool
) -> Result<(), InstantiationError>
[src]

unsafe fn deallocate(&self, handle: &InstanceHandle)[src]