Struct wasmer_compiler::BaseTunables

source ·
pub struct BaseTunables {
    pub static_memory_bound: Pages,
    pub static_memory_offset_guard_size: u64,
    pub dynamic_memory_offset_guard_size: u64,
}
Available on non-WebAssembly only.
Expand description

Tunable parameters for WebAssembly compilation. This is the reference implementation of the Tunables trait, used by default.

You can use this as a template for creating a custom Tunables implementation or use composition to wrap your Tunables around this one. The later approach is demonstrated in the tunables-limit-memory example.

Fields§

§static_memory_bound: Pages

For static heaps, the size in wasm pages of the heap protected by bounds checking.

§static_memory_offset_guard_size: u64

The size in bytes of the offset guard for static heaps.

§dynamic_memory_offset_guard_size: u64

The size in bytes of the offset guard for dynamic heaps.

Implementations§

source§

impl BaseTunables

source

pub fn for_target(target: &Target) -> Self

Get the BaseTunables for a specific Target

Trait Implementations§

source§

impl Clone for BaseTunables

source§

fn clone(&self) -> BaseTunables

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Tunables for BaseTunables

source§

fn memory_style(&self, memory: &MemoryType) -> MemoryStyle

Get a MemoryStyle for the provided MemoryType

source§

fn table_style(&self, _table: &TableType) -> TableStyle

Get a TableStyle for the provided TableType.

source§

fn create_host_memory( &self, ty: &MemoryType, style: &MemoryStyle ) -> Result<VMMemory, MemoryError>

Create a memory owned by the host given a MemoryType and a MemoryStyle.

source§

unsafe fn create_vm_memory( &self, ty: &MemoryType, style: &MemoryStyle, vm_definition_location: NonNull<VMMemoryDefinition> ) -> Result<VMMemory, MemoryError>

Create a memory owned by the VM given a MemoryType and a MemoryStyle.

§Safety
  • vm_definition_location must point to a valid, owned VMMemoryDefinition, for example in VMContext.
source§

fn create_host_table( &self, ty: &TableType, style: &TableStyle ) -> Result<VMTable, String>

Create a table owned by the host given a TableType and a TableStyle.

source§

unsafe fn create_vm_table( &self, ty: &TableType, style: &TableStyle, vm_definition_location: NonNull<VMTableDefinition> ) -> Result<VMTable, String>

Create a table owned by the VM given a TableType and a TableStyle.

§Safety
  • vm_definition_location must point to a valid, owned VMTableDefinition, for example in VMContext.
source§

fn create_global(&self, ty: GlobalType) -> Result<VMGlobal, String>

Create a global with an unset value.
source§

unsafe fn create_memories( &self, context: &mut StoreObjects, module: &ModuleInfo, memory_styles: &PrimaryMap<MemoryIndex, MemoryStyle>, memory_definition_locations: &[NonNull<VMMemoryDefinition>] ) -> Result<PrimaryMap<LocalMemoryIndex, InternalStoreHandle<VMMemory>>, LinkError>

Allocate memory for just the memories of the current module. Read more
source§

unsafe fn create_tables( &self, context: &mut StoreObjects, module: &ModuleInfo, table_styles: &PrimaryMap<TableIndex, TableStyle>, table_definition_locations: &[NonNull<VMTableDefinition>] ) -> Result<PrimaryMap<LocalTableIndex, InternalStoreHandle<VMTable>>, LinkError>

Allocate memory for just the tables of the current module. Read more
source§

fn create_globals( &self, context: &mut StoreObjects, module: &ModuleInfo ) -> Result<PrimaryMap<LocalGlobalIndex, InternalStoreHandle<VMGlobal>>, LinkError>

Allocate memory for just the globals of the current module, with initializers applied.
source§

fn vmconfig(&self) -> &VMConfig

Get the VMConfig for this tunables Currently, VMConfig have optional Stack size If wasm_stack_size is left to None (the default value) then the global stack size will be use Else the defined stack size will be used. Size is in byte and the value might be rounded to sane value is needed.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> LayoutRaw for T

source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
source§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Upcastable for T
where T: Any + Send + Sync + 'static,

source§

fn upcast_any_ref(&self) -> &(dyn Any + 'static)

upcast ref
source§

fn upcast_any_mut(&mut self) -> &mut (dyn Any + 'static)

upcast mut ref
source§

fn upcast_any_box(self: Box<T>) -> Box<dyn Any>

upcast boxed dyn