Trait wasmer_compiler::Tunables
source · pub trait Tunables {
// Required methods
fn memory_style(&self, memory: &MemoryType) -> MemoryStyle;
fn table_style(&self, table: &TableType) -> TableStyle;
fn create_host_memory(
&self,
ty: &MemoryType,
style: &MemoryStyle
) -> Result<VMMemory, MemoryError>;
unsafe fn create_vm_memory(
&self,
ty: &MemoryType,
style: &MemoryStyle,
vm_definition_location: NonNull<VMMemoryDefinition>
) -> Result<VMMemory, MemoryError>;
fn create_host_table(
&self,
ty: &TableType,
style: &TableStyle
) -> Result<VMTable, String>;
unsafe fn create_vm_table(
&self,
ty: &TableType,
style: &TableStyle,
vm_definition_location: NonNull<VMTableDefinition>
) -> Result<VMTable, String>;
// Provided methods
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_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> { ... }
}
Expand description
An engine delegates the creation of memories, tables, and globals to a foreign implementor of this trait.
Required Methods§
sourcefn memory_style(&self, memory: &MemoryType) -> MemoryStyle
fn memory_style(&self, memory: &MemoryType) -> MemoryStyle
Construct a MemoryStyle
for the provided MemoryType
sourcefn table_style(&self, table: &TableType) -> TableStyle
fn table_style(&self, table: &TableType) -> TableStyle
Construct a TableStyle
for the provided TableType
sourcefn 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
.
sourceunsafe 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 location in VM memory.
sourcefn 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
.
sourceunsafe 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 location in VM memory.
Provided Methods§
sourcefn create_global(&self, ty: GlobalType) -> Result<VMGlobal, String>
fn create_global(&self, ty: GlobalType) -> Result<VMGlobal, String>
Create a global with an unset value.
sourceunsafe 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>
Allocate memory for just the memories of the current module.
Safety
memory_definition_locations
must point to a valid locations in VM memory.
sourceunsafe 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>
sourcefn 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>
Allocate memory for just the globals of the current module, with initializers applied.
Trait Implementations§
source§impl Tunables for Box<dyn Tunables + Send + Sync>
impl Tunables for Box<dyn Tunables + Send + Sync>
source§fn memory_style(&self, memory: &MemoryType) -> MemoryStyle
fn memory_style(&self, memory: &MemoryType) -> MemoryStyle
Construct a
MemoryStyle
for the provided MemoryType
source§fn table_style(&self, table: &TableType) -> TableStyle
fn table_style(&self, table: &TableType) -> TableStyle
Construct 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>
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>
source§fn create_global(&self, ty: GlobalType) -> Result<VMGlobal, String>
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>
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>
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>
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.