pub trait Tunables: Sync {
// 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<Arc<dyn Memory>, MemoryError>;
unsafe fn create_vm_memory(
&self,
ty: &MemoryType,
style: &MemoryStyle,
vm_definition_location: NonNull<VMMemoryDefinition>,
) -> Result<Arc<dyn Memory>, MemoryError>;
fn create_host_table(
&self,
ty: &TableType,
style: &TableStyle,
) -> 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>;
fn stack_limiter_cfg(&self) -> Box<dyn SizeConfig>;
fn gas_cfg(&self) -> Box<dyn VisitOperator<'_, Output = u64>>;
fn stack_init_gas_cost(&self, frame_size: u64) -> u64;
}
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<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 location in VM memory.
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 location in VM memory.
Sourcefn stack_limiter_cfg(&self) -> Box<dyn SizeConfig>
fn stack_limiter_cfg(&self) -> Box<dyn SizeConfig>
Instrumentation configuration: stack limiter config
Sourcefn gas_cfg(&self) -> Box<dyn VisitOperator<'_, Output = u64>>
fn gas_cfg(&self) -> Box<dyn VisitOperator<'_, Output = u64>>
Instrumentation configuration: gas accounting config
Sourcefn stack_init_gas_cost(&self, frame_size: u64) -> u64
fn stack_init_gas_cost(&self, frame_size: u64) -> u64
Cost for initializing a stack frame