Struct wasmer::BaseTunables
source · [−]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
sourceimpl BaseTunables
impl BaseTunables
sourcepub fn for_target(target: &Target) -> Self
pub fn for_target(target: &Target) -> Self
Get the BaseTunables
for a specific Target
Trait Implementations
sourceimpl Clone for BaseTunables
impl Clone for BaseTunables
sourcefn clone(&self) -> BaseTunables
fn clone(&self) -> BaseTunables
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl MemoryUsage for BaseTunables
impl MemoryUsage for BaseTunables
sourcefn size_of_val(&self, visited: &mut dyn MemoryUsageTracker) -> usize
fn size_of_val(&self, visited: &mut dyn MemoryUsageTracker) -> usize
Returns the size of the referenced value in bytes. Read more
sourceimpl Tunables for BaseTunables
impl Tunables for BaseTunables
sourcefn memory_style(&self, memory: &MemoryType) -> MemoryStyle
fn memory_style(&self, memory: &MemoryType) -> MemoryStyle
Get a MemoryStyle
for the provided MemoryType
sourcefn table_style(&self, _table: &TableType) -> TableStyle
fn table_style(&self, _table: &TableType) -> TableStyle
Get a TableStyle
for the provided TableType
.
sourcefn create_host_memory(
&self,
ty: &MemoryType,
style: &MemoryStyle
) -> Result<Arc<dyn Memory>, MemoryError>
fn create_host_memory(
&self,
ty: &MemoryType,
style: &MemoryStyle
) -> Result<Arc<dyn Memory>, MemoryError>
Create a memory owned by the host given a MemoryType
and a MemoryStyle
.
sourceunsafe fn create_vm_memory(
&self,
ty: &MemoryType,
style: &MemoryStyle,
vm_definition_location: NonNull<VMMemoryDefinition>
) -> Result<Arc<dyn Memory>, MemoryError>
unsafe fn create_vm_memory(
&self,
ty: &MemoryType,
style: &MemoryStyle,
vm_definition_location: NonNull<VMMemoryDefinition>
) -> Result<Arc<dyn Memory>, 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
.
sourcefn create_host_table(
&self,
ty: &TableType,
style: &TableStyle
) -> Result<Arc<dyn Table>, String>
fn create_host_table(
&self,
ty: &TableType,
style: &TableStyle
) -> Result<Arc<dyn Table>, String>
Create a table owned by the host given a TableType
and a TableStyle
.
sourceunsafe fn create_vm_table(
&self,
ty: &TableType,
style: &TableStyle,
vm_definition_location: NonNull<VMTableDefinition>
) -> Result<Arc<dyn Table>, String>
unsafe fn create_vm_table(
&self,
ty: &TableType,
style: &TableStyle,
vm_definition_location: NonNull<VMTableDefinition>
) -> Result<Arc<dyn Table>, 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
.
sourcefn create_global(&self, ty: GlobalType) -> Result<Arc<Global>, String>
fn create_global(&self, ty: GlobalType) -> Result<Arc<Global>, String>
Create a global with an unset value.
sourceunsafe fn create_memories(
&self,
module: &ModuleInfo,
memory_styles: &PrimaryMap<MemoryIndex, MemoryStyle>,
memory_definition_locations: &[NonNull<VMMemoryDefinition>]
) -> Result<PrimaryMap<LocalMemoryIndex, Arc<dyn Memory + 'static>>, LinkError>
unsafe fn create_memories(
&self,
module: &ModuleInfo,
memory_styles: &PrimaryMap<MemoryIndex, MemoryStyle>,
memory_definition_locations: &[NonNull<VMMemoryDefinition>]
) -> Result<PrimaryMap<LocalMemoryIndex, Arc<dyn Memory + 'static>>, LinkError>
Allocate memory for just the memories of the current module.
sourceunsafe fn create_tables(
&self,
module: &ModuleInfo,
table_styles: &PrimaryMap<TableIndex, TableStyle>,
table_definition_locations: &[NonNull<VMTableDefinition>]
) -> Result<PrimaryMap<LocalTableIndex, Arc<dyn Table + 'static>>, LinkError>
unsafe fn create_tables(
&self,
module: &ModuleInfo,
table_styles: &PrimaryMap<TableIndex, TableStyle>,
table_definition_locations: &[NonNull<VMTableDefinition>]
) -> Result<PrimaryMap<LocalTableIndex, Arc<dyn Table + 'static>>, LinkError>
Allocate memory for just the tables of the current module.
sourcefn create_globals(
&self,
module: &ModuleInfo
) -> Result<PrimaryMap<LocalGlobalIndex, Arc<Global>>, LinkError>
fn create_globals(
&self,
module: &ModuleInfo
) -> Result<PrimaryMap<LocalGlobalIndex, Arc<Global>>, LinkError>
Allocate memory for just the globals of the current module, with initializers applied. Read more
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
sourceimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
sourcepub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more