Struct wasmer_vm::VMOffsets

pub struct VMOffsets {
Show 23 fields pointer_size: u8, num_signature_ids: u32, num_imported_functions: u32, num_imported_tables: u32, num_imported_memories: u32, num_imported_globals: u32, num_local_tables: u32, num_local_memories: u32, num_local_globals: u32, vmctx_signature_ids_begin: u32, vmctx_imported_functions_begin: u32, vmctx_imported_tables_begin: u32, vmctx_imported_memories_begin: u32, vmctx_imported_globals_begin: u32, vmctx_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: u8§num_signature_ids: u32§num_imported_functions: u32§num_imported_tables: u32§num_imported_memories: u32§num_imported_globals: u32§num_local_tables: u32§num_local_memories: u32§num_local_globals: u32§vmctx_signature_ids_begin: u32§vmctx_imported_functions_begin: u32§vmctx_imported_tables_begin: u32§vmctx_imported_memories_begin: u32§vmctx_imported_globals_begin: u32§vmctx_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

Implementations§

§

impl VMOffsets

pub fn new(pointer_size: u8, module: &ModuleInfo) -> VMOffsets

Return a new VMOffsets instance, for a given pointer size.

pub fn new_for_trampolines(pointer_size: u8) -> VMOffsets

Return a new VMOffsets instance, for a given pointer size skipping the ModuleInfo.

Note: This should only when generating code for trampolines.

pub fn num_local_tables(&self) -> u32

Number of local tables defined in the module

pub fn num_local_memories(&self) -> u32

Number of local memories defined in the module

§

impl VMOffsets

Offsets for VMFunctionImport.

pub const fn vmfunction_import_body(&self) -> u8

The offset of the body field.

pub const fn vmfunction_import_vmctx(&self) -> u8

The offset of the vmctx field.

pub const fn vmfunction_import_handle(&self) -> u8

The offset of the handle field.

pub const fn size_of_vmfunction_import(&self) -> u8

Return the size of VMFunctionImport.

§

impl VMOffsets

Offsets for VMDynamicFunctionContext.

pub const fn vmdynamicfunction_import_context_address(&self) -> u8

The offset of the address field.

pub const fn vmdynamicfunction_import_context_ctx(&self) -> u8

The offset of the ctx field.

pub const fn size_of_vmdynamicfunction_import_context(&self) -> u8

Return the size of VMDynamicFunctionContext.

§

impl VMOffsets

Offsets for *const VMFunctionBody.

pub const fn size_of_vmfunction_body_ptr(&self) -> u8

The size of the current_elements field.

§

impl VMOffsets

Offsets for VMTableImport.

pub const fn vmtable_import_definition(&self) -> u8

The offset of the definition field.

pub const fn vmtable_import_handle(&self) -> u8

The offset of the handle field.

pub const fn size_of_vmtable_import(&self) -> u8

Return the size of VMTableImport.

§

impl VMOffsets

Offsets for VMTableDefinition.

pub const fn vmtable_definition_base(&self) -> u8

The offset of the base field.

pub const fn vmtable_definition_current_elements(&self) -> u8

The offset of the current_elements field.

pub const fn size_of_vmtable_definition_current_elements(&self) -> u8

The size of the current_elements field.

pub const fn size_of_vmtable_definition(&self) -> u8

Return the size of VMTableDefinition.

§

impl VMOffsets

Offsets for VMMemoryImport.

pub const fn vmmemory_import_definition(&self) -> u8

The offset of the from field.

pub const fn vmmemory_import_handle(&self) -> u8

The offset of the handle field.

pub const fn size_of_vmmemory_import(&self) -> u8

Return the size of VMMemoryImport.

§

impl VMOffsets

Offsets for VMMemoryDefinition.

pub const fn vmmemory_definition_base(&self) -> u8

The offset of the base field.

pub const fn vmmemory_definition_current_length(&self) -> u8

The offset of the current_length field.

pub const fn size_of_vmmemory_definition_current_length(&self) -> u8

The size of the current_length field.

pub const fn size_of_vmmemory_definition(&self) -> u8

Return the size of VMMemoryDefinition.

§

impl VMOffsets

Offsets for VMGlobalImport.

pub const fn vmglobal_import_definition(&self) -> u8

The offset of the definition field.

pub const fn vmglobal_import_handle(&self) -> u8

The offset of the handle field.

pub const fn size_of_vmglobal_import(&self) -> u8

Return the size of VMGlobalImport.

§

impl VMOffsets

Offsets for a non-null pointer to a VMGlobalDefinition used as a local global.

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.

§

impl VMOffsets

Offsets for VMSharedSignatureIndex.

pub const fn size_of_vmshared_signature_index(&self) -> u8

Return the size of VMSharedSignatureIndex.

§

impl VMOffsets

Offsets for VMCallerCheckedAnyfunc.

pub const fn vmcaller_checked_anyfunc_func_ptr(&self) -> u8

The offset of the func_ptr field.

pub const fn vmcaller_checked_anyfunc_type_index(&self) -> u8

The offset of the type_index field.

pub const fn vmcaller_checked_anyfunc_vmctx(&self) -> u8

The offset of the vmctx field.

pub const fn vmcaller_checked_anyfunc_call_trampoline(&self) -> u8

The offset of the call_trampoline field.

pub const fn size_of_vmcaller_checked_anyfunc(&self) -> u8

Return the size of VMCallerCheckedAnyfunc.

§

impl VMOffsets

Offsets for VMFuncRef.

pub const fn vm_funcref_anyfunc_ptr(&self) -> u8

The offset to the pointer to the anyfunc inside the ref.

pub const fn size_of_vm_funcref(&self) -> u8

Return the size of VMFuncRef.

§

impl VMOffsets

Offsets for VMContext.

pub fn vmctx_signature_ids_begin(&self) -> u32

The offset of the signature_ids array.

pub fn vmctx_imported_functions_begin(&self) -> u32

The offset of the tables array.

pub fn vmctx_imported_tables_begin(&self) -> u32

The offset of the tables array.

pub fn vmctx_imported_memories_begin(&self) -> u32

The offset of the memories array.

pub fn vmctx_imported_globals_begin(&self) -> u32

The offset of the globals array.

pub fn vmctx_tables_begin(&self) -> u32

The offset of the tables array.

pub fn vmctx_memories_begin(&self) -> u32

The offset of the memories array.

pub fn vmctx_globals_begin(&self) -> u32

The offset of the globals array.

pub fn vmctx_builtin_functions_begin(&self) -> u32

The offset of the builtin functions array.

pub fn size_of_vmctx(&self) -> u32

Return the size of the VMContext allocation.

pub fn vmctx_vmshared_signature_id(&self, index: SignatureIndex) -> u32

Return the offset to VMSharedSignatureIndex index index.

pub fn vmctx_vmfunction_import(&self, index: FunctionIndex) -> u32

Return the offset to VMFunctionImport index index.

pub fn vmctx_vmtable_import(&self, index: TableIndex) -> u32

Return the offset to VMTableImport index index.

pub fn vmctx_vmmemory_import(&self, index: MemoryIndex) -> u32

Return the offset to VMMemoryImport index index.

pub fn vmctx_vmglobal_import(&self, index: GlobalIndex) -> u32

Return the offset to VMGlobalImport index index.

pub fn vmctx_vmtable_definition(&self, index: LocalTableIndex) -> u32

Return the offset to VMTableDefinition index index.

pub fn vmctx_vmmemory_definition(&self, index: LocalMemoryIndex) -> u32

Return the offset to VMMemoryDefinition index index.

pub fn vmctx_vmglobal_definition(&self, index: LocalGlobalIndex) -> u32

Return the offset to the VMGlobalDefinition index index.

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

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

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

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

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

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

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

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

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

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

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§

§

impl Clone for VMOffsets

§

fn clone(&self) -> VMOffsets

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for VMOffsets

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> LayoutRaw for T

§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
§

impl<T> Pointee for T

§

type Metadata = ()

The metadata type for pointers and references to this type.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.