Struct wasmer_types::VMOffsets
source · pub struct VMOffsets { /* private fields */ }
Expand description
This class computes offsets to fields within VMContext and other related structs that JIT code accesses directly.
Implementations§
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
source§impl VMOffsets
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 size_of_vmfunction_import(&self) -> u8
pub const fn size_of_vmfunction_import(&self) -> u8
Return the size of VMFunctionImport
.
source§impl VMOffsets
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
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
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
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
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
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
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
impl VMOffsets
Offsets for a non-null pointer to 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 pointer to a VMGlobalDefinition
;
The underlying global itself is the size of the largest value type (i.e. a V128), however the size of this type is just the size of a pointer.
source§impl VMOffsets
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_type_index(&self) -> u8
pub const fn vmcaller_checked_anyfunc_type_index(&self) -> u8
The offset of the type_index
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
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
impl VMOffsets
Offsets for VMContext
.
sourcepub fn vmctx_signature_ids_begin(&self) -> u32
pub fn vmctx_signature_ids_begin(&self) -> u32
The offset of the signature_ids
array.
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_tables_begin(&self) -> u32
pub fn vmctx_tables_begin(&self) -> u32
The offset of the tables
array.
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.
Return the offset to VMSharedSignatureIndex
index index
.
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_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§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
source§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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)