Struct wasmer::sys::BaseTunables
pub struct BaseTunables {
pub static_memory_bound: Pages,
pub static_memory_offset_guard_size: u64,
pub dynamic_memory_offset_guard_size: u64,
}
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§
§impl BaseTunables
impl BaseTunables
pub fn for_target(target: &Target) -> BaseTunables
pub fn for_target(target: &Target) -> BaseTunables
Get the BaseTunables
for a specific Target
Trait Implementations§
§impl Clone for BaseTunables
impl Clone for BaseTunables
§fn clone(&self) -> BaseTunables
fn clone(&self) -> BaseTunables
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Tunables for BaseTunables
impl Tunables for BaseTunables
§fn memory_style(&self, memory: &MemoryType) -> MemoryStyle
fn memory_style(&self, memory: &MemoryType) -> MemoryStyle
Get a MemoryStyle
for the provided MemoryType
§fn table_style(&self, _table: &TableType) -> TableStyle
fn table_style(&self, _table: &TableType) -> TableStyle
Get a TableStyle
for the provided TableType
.
§fn create_host_memory(
&self,
ty: &MemoryType,
style: &MemoryStyle
) -> Result<VMMemory, MemoryError>
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
.
§unsafe fn create_vm_memory(
&self,
ty: &MemoryType,
style: &MemoryStyle,
vm_definition_location: NonNull<VMMemoryDefinition>
) -> Result<VMMemory, MemoryError>
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, ownedVMMemoryDefinition
, for example inVMContext
.
§fn create_host_table(
&self,
ty: &TableType,
style: &TableStyle
) -> Result<VMTable, String>
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
.
§unsafe fn create_vm_table(
&self,
ty: &TableType,
style: &TableStyle,
vm_definition_location: NonNull<VMTableDefinition>
) -> Result<VMTable, String>
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, ownedVMTableDefinition
, for example inVMContext
.
§fn create_global(&self, ty: GlobalType) -> Result<VMGlobal, String>
fn create_global(&self, ty: GlobalType) -> Result<VMGlobal, String>
§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>
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>
§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>
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>
§fn create_globals(
&self,
context: &mut StoreObjects,
module: &ModuleInfo
) -> Result<PrimaryMap<LocalGlobalIndex, InternalStoreHandle<VMGlobal>>, LinkError>
fn create_globals( &self, context: &mut StoreObjects, module: &ModuleInfo ) -> Result<PrimaryMap<LocalGlobalIndex, InternalStoreHandle<VMGlobal>>, LinkError>
§fn vmconfig(&self) -> &VMConfig
fn vmconfig(&self) -> &VMConfig
Auto Trait Implementations§
impl RefUnwindSafe for BaseTunables
impl Send for BaseTunables
impl Sync for BaseTunables
impl Unpin for BaseTunables
impl UnwindSafe for BaseTunables
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>where
F: FnOnce(&Self) -> bool,
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,
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