pub struct VMOffsets {Show 26 fields
pointer_size: u8,
num_imported_functions: u32,
num_imported_tables: u32,
num_imported_memories: u32,
num_tag_ids: u32,
num_imported_globals: u32,
num_local_tables: u32,
num_local_memories: u32,
num_local_globals: u32,
local_fixed_funcref_table_offsets: Vec<Option<u32>>,
size_of_local_fixed_funcref_tables: u32,
vmctx_imported_functions_begin: u32,
vmctx_imported_tables_begin: u32,
vmctx_imported_memories_begin: u32,
vmctx_tag_ids_begin: u32,
vmctx_imported_globals_begin: u32,
vmctx_tables_begin: u32,
vmctx_fixed_funcref_tables_begin: u32,
vmctx_memories_begin: u32,
vmctx_globals_begin: u32,
vmctx_builtin_functions_begin: u32,
vmctx_trap_handler_begin: u32,
vmctx_gas_limiter_pointer: u32,
vmctx_stack_limit_begin: u32,
vmctx_stack_limit_initial_begin: u32,
size_of_vmctx: u32,
}Expand description
This class computes offsets to fields within VMContext and other related structs that JIT code accesses directly.
Fields§
§pointer_size: u8The size in bytes of a pointer on the target.
num_imported_functions: u32The number of imported functions in the module.
num_imported_tables: u32The number of imported tables in the module.
num_imported_memories: u32The number of imported memories in the module.
num_tag_ids: u32The number of tags in the module.
num_imported_globals: u32The number of imported globals in the module.
num_local_tables: u32The number of defined tables in the module.
num_local_memories: u32The number of defined memories in the module.
num_local_globals: u32The number of defined globals in the module.
local_fixed_funcref_table_offsets: Vec<Option<u32>>Relative offsets of inline VMCallerCheckedAnyfunc arrays for local fixed funcref
tables. Non-fixed tables do not have inline storage.
size_of_local_fixed_funcref_tables: u32Total size in bytes of all inline fixed funcref table storage in VMContext.
vmctx_imported_functions_begin: u32§vmctx_imported_tables_begin: u32§vmctx_imported_memories_begin: u32§vmctx_tag_ids_begin: u32§vmctx_imported_globals_begin: u32§vmctx_tables_begin: u32§vmctx_fixed_funcref_tables_begin: u32§vmctx_memories_begin: u32§vmctx_globals_begin: u32§vmctx_builtin_functions_begin: u32§vmctx_trap_handler_begin: u32§vmctx_gas_limiter_pointer: u32§vmctx_stack_limit_begin: u32§vmctx_stack_limit_initial_begin: u32§size_of_vmctx: u32Implementations§
Source§impl VMOffsets
impl VMOffsets
Sourcepub fn new(pointer_size: u8, module: &ModuleInfo) -> Self
pub fn new(pointer_size: u8, module: &ModuleInfo) -> Self
Return a new VMOffsets instance, for a given pointer size.
Sourcepub fn new_for_trampolines(pointer_size: u8) -> Self
pub fn new_for_trampolines(pointer_size: u8) -> Self
Return a new VMOffsets instance, for a given pointer size
skipping the ModuleInfo.
Note: This should only when generating code for trampolines.
Sourcepub fn num_local_tables(&self) -> u32
pub fn num_local_tables(&self) -> u32
Number of local tables defined in the module
Sourcepub fn num_local_memories(&self) -> u32
pub fn num_local_memories(&self) -> u32
Number of local memories defined in the module
Sourcepub fn num_local_globals(&self) -> u32
pub fn num_local_globals(&self) -> u32
Number of local globals defined in the module
fn precompute(&mut self)
Source§impl VMOffsets
Offsets for VMFunctionImport.
impl VMOffsets
Offsets for VMFunctionImport.
Sourcepub const fn vmfunction_import_body(&self) -> u8
pub const fn vmfunction_import_body(&self) -> u8
The offset of the body field.
Sourcepub const fn vmfunction_import_vmctx(&self) -> u8
pub const fn vmfunction_import_vmctx(&self) -> u8
The offset of the vmctx field.
Sourcepub const fn vmfunction_import_handle(&self) -> u8
pub const fn vmfunction_import_handle(&self) -> u8
The offset of the handle field.
Sourcepub const fn vmfunction_import_include_m0_param(&self) -> u8
pub const fn vmfunction_import_include_m0_param(&self) -> u8
The offset of the include_m0_param field.
Sourcepub const fn size_of_vmfunction_import(&self) -> u8
pub const fn size_of_vmfunction_import(&self) -> u8
Return the size of VMFunctionImport.
Source§impl VMOffsets
Offsets for VMDynamicFunctionContext.
impl VMOffsets
Offsets for VMDynamicFunctionContext.
Sourcepub const fn vmdynamicfunction_import_context_address(&self) -> u8
pub const fn vmdynamicfunction_import_context_address(&self) -> u8
The offset of the address field.
Sourcepub const fn vmdynamicfunction_import_context_ctx(&self) -> u8
pub const fn vmdynamicfunction_import_context_ctx(&self) -> u8
The offset of the ctx field.
Sourcepub const fn size_of_vmdynamicfunction_import_context(&self) -> u8
pub const fn size_of_vmdynamicfunction_import_context(&self) -> u8
Return the size of VMDynamicFunctionContext.
Source§impl VMOffsets
Offsets for *const VMFunctionBody.
impl VMOffsets
Offsets for *const VMFunctionBody.
Sourcepub const fn size_of_vmfunction_body_ptr(&self) -> u8
pub const fn size_of_vmfunction_body_ptr(&self) -> u8
The size of the current_elements field.
Source§impl VMOffsets
Offsets for VMTableImport.
impl VMOffsets
Offsets for VMTableImport.
Sourcepub const fn vmtable_import_definition(&self) -> u8
pub const fn vmtable_import_definition(&self) -> u8
The offset of the definition field.
Sourcepub const fn vmtable_import_handle(&self) -> u8
pub const fn vmtable_import_handle(&self) -> u8
The offset of the handle field.
Sourcepub const fn size_of_vmtable_import(&self) -> u8
pub const fn size_of_vmtable_import(&self) -> u8
Return the size of VMTableImport.
Source§impl VMOffsets
Offsets for VMTableDefinition.
impl VMOffsets
Offsets for VMTableDefinition.
Sourcepub const fn vmtable_definition_base(&self) -> u8
pub const fn vmtable_definition_base(&self) -> u8
The offset of the base field.
Sourcepub const fn vmtable_definition_current_elements(&self) -> u8
pub const fn vmtable_definition_current_elements(&self) -> u8
The offset of the current_elements field.
Sourcepub const fn size_of_vmtable_definition_current_elements(&self) -> u8
pub const fn size_of_vmtable_definition_current_elements(&self) -> u8
The size of the current_elements field.
Sourcepub const fn size_of_vmtable_definition(&self) -> u8
pub const fn size_of_vmtable_definition(&self) -> u8
Return the size of VMTableDefinition.
Source§impl VMOffsets
Offsets for VMMemoryImport.
impl VMOffsets
Offsets for VMMemoryImport.
Sourcepub const fn vmmemory_import_definition(&self) -> u8
pub const fn vmmemory_import_definition(&self) -> u8
The offset of the from field.
Sourcepub const fn vmmemory_import_handle(&self) -> u8
pub const fn vmmemory_import_handle(&self) -> u8
The offset of the handle field.
Sourcepub const fn size_of_vmmemory_import(&self) -> u8
pub const fn size_of_vmmemory_import(&self) -> u8
Return the size of VMMemoryImport.
Source§impl VMOffsets
Offsets for VMMemoryDefinition.
impl VMOffsets
Offsets for VMMemoryDefinition.
Sourcepub const fn vmmemory_definition_base(&self) -> u8
pub const fn vmmemory_definition_base(&self) -> u8
The offset of the base field.
Sourcepub const fn vmmemory_definition_current_length(&self) -> u8
pub const fn vmmemory_definition_current_length(&self) -> u8
The offset of the current_length field.
Sourcepub const fn size_of_vmmemory_definition_current_length(&self) -> u8
pub const fn size_of_vmmemory_definition_current_length(&self) -> u8
The size of the current_length field.
Sourcepub const fn size_of_vmmemory_definition(&self) -> u8
pub const fn size_of_vmmemory_definition(&self) -> u8
Return the size of VMMemoryDefinition.
Source§impl VMOffsets
Offsets for VMGlobalImport.
impl VMOffsets
Offsets for VMGlobalImport.
Sourcepub const fn vmglobal_import_definition(&self) -> u8
pub const fn vmglobal_import_definition(&self) -> u8
The offset of the definition field.
Sourcepub const fn vmglobal_import_handle(&self) -> u8
pub const fn vmglobal_import_handle(&self) -> u8
The offset of the handle field.
Sourcepub const fn size_of_vmglobal_import(&self) -> u8
pub const fn size_of_vmglobal_import(&self) -> u8
Return the size of VMGlobalImport.
Source§impl VMOffsets
Offsets for a VMGlobalDefinition used as a local global.
impl VMOffsets
Offsets for a VMGlobalDefinition used as a local global.
Sourcepub const fn size_of_vmglobal_local(&self) -> u8
pub const fn size_of_vmglobal_local(&self) -> u8
Return the size of a VMGlobalDefinition.
Local globals are stored inline in the VMContext, and the definition
is a 16-byte RawValue aligned to 16.
Source§impl VMOffsets
Offsets for VMCallerCheckedAnyfunc.
impl VMOffsets
Offsets for VMCallerCheckedAnyfunc.
Sourcepub const fn vmcaller_checked_anyfunc_func_ptr(&self) -> u8
pub const fn vmcaller_checked_anyfunc_func_ptr(&self) -> u8
The offset of the func_ptr field.
Sourcepub const fn vmcaller_checked_anyfunc_signature_hash(&self) -> u8
pub const fn vmcaller_checked_anyfunc_signature_hash(&self) -> u8
The offset of the VMSignatureHash field.
Sourcepub const fn vmcaller_checked_anyfunc_vmctx(&self) -> u8
pub const fn vmcaller_checked_anyfunc_vmctx(&self) -> u8
The offset of the vmctx field.
Sourcepub const fn vmcaller_checked_anyfunc_call_trampoline(&self) -> u8
pub const fn vmcaller_checked_anyfunc_call_trampoline(&self) -> u8
The offset of the call_trampoline field.
Sourcepub const fn size_of_vmcaller_checked_anyfunc(&self) -> u8
pub const fn size_of_vmcaller_checked_anyfunc(&self) -> u8
Return the size of VMCallerCheckedAnyfunc.
Source§impl VMOffsets
Offsets for VMFuncRef.
impl VMOffsets
Offsets for VMFuncRef.
Sourcepub const fn vm_funcref_anyfunc_ptr(&self) -> u8
pub const fn vm_funcref_anyfunc_ptr(&self) -> u8
The offset to the pointer to the anyfunc inside the ref.
Sourcepub const fn size_of_vm_funcref(&self) -> u8
pub const fn size_of_vm_funcref(&self) -> u8
Return the size of VMFuncRef.
Source§impl VMOffsets
Offsets for VMContext.
impl VMOffsets
Offsets for VMContext.
Sourcepub fn vmctx_imported_functions_begin(&self) -> u32
pub fn vmctx_imported_functions_begin(&self) -> u32
The offset of the tables array.
Sourcepub fn vmctx_imported_tables_begin(&self) -> u32
pub fn vmctx_imported_tables_begin(&self) -> u32
The offset of the tables array.
Sourcepub fn vmctx_imported_memories_begin(&self) -> u32
pub fn vmctx_imported_memories_begin(&self) -> u32
The offset of the memories array.
Sourcepub fn vmctx_imported_globals_begin(&self) -> u32
pub fn vmctx_imported_globals_begin(&self) -> u32
The offset of the globals array.
Sourcepub fn vmctx_tag_ids_begin(&self) -> u32
pub fn vmctx_tag_ids_begin(&self) -> u32
The offset of the tags array.
Sourcepub fn vmctx_tables_begin(&self) -> u32
pub fn vmctx_tables_begin(&self) -> u32
The offset of the tables array.
Sourcepub fn vmctx_fixed_funcref_tables_begin(&self) -> u32
pub fn vmctx_fixed_funcref_tables_begin(&self) -> u32
The offset of the inline fixed funcref table storage.
Sourcepub fn vmctx_memories_begin(&self) -> u32
pub fn vmctx_memories_begin(&self) -> u32
The offset of the memories array.
Sourcepub fn vmctx_globals_begin(&self) -> u32
pub fn vmctx_globals_begin(&self) -> u32
The offset of the globals array.
Sourcepub fn vmctx_builtin_functions_begin(&self) -> u32
pub fn vmctx_builtin_functions_begin(&self) -> u32
The offset of the builtin functions array.
Sourcepub fn size_of_vmctx(&self) -> u32
pub fn size_of_vmctx(&self) -> u32
Return the size of the VMContext allocation.
Sourcepub fn vmctx_vmfunction_import(&self, index: FunctionIndex) -> u32
pub fn vmctx_vmfunction_import(&self, index: FunctionIndex) -> u32
Return the offset to VMFunctionImport index index.
Sourcepub fn vmctx_vmtable_import(&self, index: TableIndex) -> u32
pub fn vmctx_vmtable_import(&self, index: TableIndex) -> u32
Return the offset to VMTableImport index index.
Sourcepub fn vmctx_vmmemory_import(&self, index: MemoryIndex) -> u32
pub fn vmctx_vmmemory_import(&self, index: MemoryIndex) -> u32
Return the offset to VMMemoryImport index index.
Sourcepub fn vmctx_vmglobal_import(&self, index: GlobalIndex) -> u32
pub fn vmctx_vmglobal_import(&self, index: GlobalIndex) -> u32
Return the offset to VMGlobalImport index index.
Sourcepub fn vmctx_vmtable_definition(&self, index: LocalTableIndex) -> u32
pub fn vmctx_vmtable_definition(&self, index: LocalTableIndex) -> u32
Return the offset to VMTableDefinition index index.
Sourcepub fn vmctx_vmmemory_definition(&self, index: LocalMemoryIndex) -> u32
pub fn vmctx_vmmemory_definition(&self, index: LocalMemoryIndex) -> u32
Return the offset to VMMemoryDefinition index index.
Sourcepub fn vmctx_vmglobal_definition(&self, index: LocalGlobalIndex) -> u32
pub fn vmctx_vmglobal_definition(&self, index: LocalGlobalIndex) -> u32
Return the offset to the VMGlobalDefinition index index.
Sourcepub fn vmctx_vmfunction_import_body(&self, index: FunctionIndex) -> u32
pub fn vmctx_vmfunction_import_body(&self, index: FunctionIndex) -> u32
Return the offset to the body field in *const VMFunctionBody index index.
Remember updating precompute upon changes
Sourcepub fn vmctx_vmfunction_import_vmctx(&self, index: FunctionIndex) -> u32
pub fn vmctx_vmfunction_import_vmctx(&self, index: FunctionIndex) -> u32
Return the offset to the vmctx field in *const VMFunctionBody index index.
Remember updating precompute upon changes
Sourcepub fn vmctx_vmtable_import_definition(&self, index: TableIndex) -> u32
pub fn vmctx_vmtable_import_definition(&self, index: TableIndex) -> u32
Return the offset to the definition field in VMTableImport index index.
Remember updating precompute upon changes
Sourcepub fn vmctx_vmtable_definition_base(&self, index: LocalTableIndex) -> u32
pub fn vmctx_vmtable_definition_base(&self, index: LocalTableIndex) -> u32
Return the offset to the base field in VMTableDefinition index index.
Remember updating precompute upon changes
Sourcepub fn vmctx_vmtable_definition_current_elements(
&self,
index: LocalTableIndex,
) -> u32
pub fn vmctx_vmtable_definition_current_elements( &self, index: LocalTableIndex, ) -> u32
Return the offset to the current_elements field in VMTableDefinition index index.
Remember updating precompute upon changes
Sourcepub fn vmctx_fixed_funcref_table_anyfuncs(
&self,
index: LocalTableIndex,
) -> Option<u32>
pub fn vmctx_fixed_funcref_table_anyfuncs( &self, index: LocalTableIndex, ) -> Option<u32>
Return the offset to the inline VMCallerCheckedAnyfunc array for a local fixed
funcref table.
Sourcepub fn vmctx_vmmemory_import_definition(&self, index: MemoryIndex) -> u32
pub fn vmctx_vmmemory_import_definition(&self, index: MemoryIndex) -> u32
Return the offset to the from field in VMMemoryImport index index.
Remember updating precompute upon changes
Sourcepub fn vmctx_vmmemory_import_handle(&self, index: MemoryIndex) -> u32
pub fn vmctx_vmmemory_import_handle(&self, index: MemoryIndex) -> u32
Return the offset to the vmctx field in VMMemoryImport index index.
Remember updating precompute upon changes
Sourcepub fn vmctx_vmmemory_definition_base(&self, index: LocalMemoryIndex) -> u32
pub fn vmctx_vmmemory_definition_base(&self, index: LocalMemoryIndex) -> u32
Return the offset to the base field in VMMemoryDefinition index index.
Remember updating precompute upon changes
Sourcepub fn vmctx_vmmemory_definition_current_length(
&self,
index: LocalMemoryIndex,
) -> u32
pub fn vmctx_vmmemory_definition_current_length( &self, index: LocalMemoryIndex, ) -> u32
Return the offset to the current_length field in VMMemoryDefinition index index.
Remember updating precompute upon changes
Sourcepub fn vmctx_vmglobal_import_definition(&self, index: GlobalIndex) -> u32
pub fn vmctx_vmglobal_import_definition(&self, index: GlobalIndex) -> u32
Return the offset to the from field in VMGlobalImport index index.
Remember updating precompute upon changes
Sourcepub fn vmctx_builtin_function(&self, index: VMBuiltinFunctionIndex) -> u32
pub fn vmctx_builtin_function(&self, index: VMBuiltinFunctionIndex) -> u32
Return the offset to builtin function in VMBuiltinFunctionsArray index index.
Remember updating precompute upon changes
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VMOffsets
impl RefUnwindSafe for VMOffsets
impl Send for VMOffsets
impl Sync for VMOffsets
impl Unpin for VMOffsets
impl UnwindSafe for VMOffsets
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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