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§
Source§impl 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§
Source§impl Clone for BaseTunables
impl Clone for BaseTunables
Source§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 moreSource§impl Tunables for BaseTunables
impl Tunables for BaseTunables
Source§fn memory_style(&self, memory: &MemoryType) -> MemoryStyle
fn memory_style(&self, memory: &MemoryType) -> MemoryStyle
Get a MemoryStyle
for the provided MemoryType
Source§fn table_style(&self, _table: &TableType) -> TableStyle
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>
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>
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
.
Source§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
.
Source§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
.