Struct wasmer_vm::VMOffsets

source ·
pub struct VMOffsets {
    pub pointer_size: u8,
    pub num_signature_ids: u32,
    pub num_imported_functions: u32,
    pub num_imported_tables: u32,
    pub num_imported_memories: u32,
    pub num_imported_globals: u32,
    pub num_local_tables: u32,
    pub num_local_memories: u32,
    pub num_local_globals: u32,
    pub has_trap_handlers: bool,
}
Expand description

This class computes offsets to fields within VMContext and other related structs that JIT code accesses directly.

Fields§

§pointer_size: u8

The size in bytes of a pointer on the target.

§num_signature_ids: u32

The number of signature declarations in the module.

§num_imported_functions: u32

The number of imported functions in the module.

§num_imported_tables: u32

The number of imported tables in the module.

§num_imported_memories: u32

The number of imported memories in the module.

§num_imported_globals: u32

The number of imported globals in the module.

§num_local_tables: u32

The number of defined tables in the module.

§num_local_memories: u32

The number of defined memories in the module.

§num_local_globals: u32

The number of defined globals in the module.

§has_trap_handlers: bool

If the module has trap handler.

Implementations§

source§

impl VMOffsets

source

pub fn new(pointer_size: u8) -> Self

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

The returned VMOffsets has no entities. Add entities with other builder methods for this type.

source

pub fn for_host() -> Self

Return a new VMOffsets instance, for a host’s pointer size.

The returned VMOffsets has no entities. Add entities with other builder methods for this type.

source

pub fn with_module_info(self, module: &ModuleInfo) -> Self

Add imports and locals from the provided ModuleInfo.

source

pub fn with_archived_module_info(self, module: &Archived<ModuleInfo>) -> Self

Add imports and locals from the provided ModuleInfo.

source§

impl VMOffsets

Offsets for VMFunctionImport.

source

pub const fn vmfunction_import_body(&self) -> u8

The offset of the body field.

source

pub const fn vmfunction_import_vmctx(&self) -> u8

The offset of the vmctx field.

source

pub const fn size_of_vmfunction_import(&self) -> u8

Return the size of VMFunctionImport.

source§

impl VMOffsets

source

pub const fn vmdynamicfunction_import_context_address(&self) -> u8

The offset of the address field.

source

pub const fn vmdynamicfunction_import_context_ctx(&self) -> u8

The offset of the ctx field.

source

pub const fn size_of_vmdynamicfunction_import_context(&self) -> u8

Return the size of VMDynamicFunctionContext.

source§

impl VMOffsets

Offsets for *const VMFunctionBody.

source

pub const fn size_of_vmfunction_body_ptr(&self) -> u8

The size of the current_elements field.

source§

impl VMOffsets

Offsets for VMTableImport.

source

pub const fn vmtable_import_definition(&self) -> u8

The offset of the definition field.

source

pub const fn vmtable_import_from(&self) -> u8

The offset of the from field.

source

pub const fn size_of_vmtable_import(&self) -> u8

Return the size of VMTableImport.

source§

impl VMOffsets

Offsets for VMTableDefinition.

source

pub const fn vmtable_definition_base(&self) -> u8

The offset of the base field.

source

pub const fn vmtable_definition_current_elements(&self) -> u8

The offset of the current_elements field.

source

pub const fn size_of_vmtable_definition_current_elements(&self) -> u8

The size of the current_elements field.

source

pub const fn size_of_vmtable_definition(&self) -> u8

Return the size of VMTableDefinition.

source§

impl VMOffsets

Offsets for VMMemoryImport.

source

pub const fn vmmemory_import_definition(&self) -> u8

The offset of the from field.

source

pub const fn vmmemory_import_from(&self) -> u8

The offset of the from field.

source

pub const fn size_of_vmmemory_import(&self) -> u8

Return the size of VMMemoryImport.

source§

impl VMOffsets

Offsets for VMMemoryDefinition.

source

pub const fn vmmemory_definition_base(&self) -> u8

The offset of the base field.

source

pub const fn vmmemory_definition_current_length(&self) -> u8

The offset of the current_length field.

source

pub const fn size_of_vmmemory_definition_current_length(&self) -> u8

The size of the current_length field.

source

pub const fn size_of_vmmemory_definition(&self) -> u8

Return the size of VMMemoryDefinition.

source§

impl VMOffsets

Offsets for VMGlobalImport.

source

pub const fn vmglobal_import_definition(&self) -> u8

The offset of the definition field.

source

pub const fn vmglobal_import_from(&self) -> u8

The offset of the from field.

source

pub const fn size_of_vmglobal_import(&self) -> u8

Return the size of VMGlobalImport.

source§

impl VMOffsets

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

source

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

source

pub const fn size_of_vmshared_signature_index(&self) -> u8

Return the size of VMSharedSignatureIndex.

source§

impl VMOffsets

source

pub const fn vmcaller_checked_anyfunc_func_ptr(&self) -> u8

The offset of the func_ptr field.

source

pub const fn vmcaller_checked_anyfunc_type_index(&self) -> u8

The offset of the type_index field.

source

pub const fn vmcaller_checked_anyfunc_vmctx(&self) -> u8

The offset of the vmctx field.

source

pub const fn size_of_vmcaller_checked_anyfunc(&self) -> u8

Return the size of VMCallerCheckedAnyfunc.

source§

impl VMOffsets

Offsets for VMFuncRef.

source

pub const fn vm_funcref_anyfunc_ptr(&self) -> u8

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

source

pub const fn size_of_vm_funcref(&self) -> u8

Return the size of VMFuncRef.

source§

impl VMOffsets

Offsets for VMContext.

source

pub fn vmctx_signature_ids_begin(&self) -> u32

The offset of the signature_ids array.

source

pub fn vmctx_imported_functions_begin(&self) -> u32

The offset of the tables array.

source

pub fn vmctx_imported_tables_begin(&self) -> u32

The offset of the tables array.

source

pub fn vmctx_imported_memories_begin(&self) -> u32

The offset of the memories array.

source

pub fn vmctx_imported_globals_begin(&self) -> u32

The offset of the globals array.

source

pub fn vmctx_tables_begin(&self) -> u32

The offset of the tables array.

source

pub fn vmctx_memories_begin(&self) -> u32

The offset of the memories array.

source

pub fn vmctx_globals_begin(&self) -> u32

The offset of the globals array.

source

pub fn vmctx_builtin_functions_begin(&self) -> u32

The offset of the builtin functions array.

source

pub fn vmctx_trap_handler_begin(&self) -> u32

The offset of the trap handler.

source

pub fn vmctx_gas_limiter_pointer(&self) -> u32

The offset of the gas limiter pointer.

source

pub fn vmctx_stack_limit_begin(&self) -> u32

The offset of the current stack limit.

source

pub fn vmctx_stack_limit_initial_begin(&self) -> u32

The offset of the initial stack limit.

source

pub fn size_of_vmctx(&self) -> u32

Return the size of the VMContext allocation.

source

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

Return the offset to VMSharedSignatureIndex index index.

source

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

Return the offset to VMFunctionImport index index.

source

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

Return the offset to VMTableImport index index.

source

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

Return the offset to VMMemoryImport index index.

source

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

Return the offset to VMGlobalImport index index.

source

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

Return the offset to VMTableDefinition index index.

source

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

Return the offset to VMMemoryDefinition index index.

source

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

Return the offset to the VMGlobalDefinition index index.

source

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

Return the offset to the body field in *const VMFunctionBody index index.

source

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

Return the offset to the vmctx field in *const VMFunctionBody index index.

source

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

Return the offset to the definition field in VMTableImport index index.

source

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

Return the offset to the base field in VMTableDefinition index index.

source

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

Return the offset to the current_elements field in VMTableDefinition index index.

source

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

Return the offset to the from field in VMMemoryImport index index.

source

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

Return the offset to the vmctx field in VMMemoryImport index index.

source

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

Return the offset to the base field in VMMemoryDefinition index index.

source

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

Return the offset to the current_length field in VMMemoryDefinition index index.

source

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

Return the offset to the from field in VMGlobalImport index index.

source

pub fn vmctx_builtin_function(&self, index: VMBuiltinFunctionIndex) -> u32

Return the offset to builtin function in VMBuiltinFunctionsArray index index.

source

pub fn vmctx_trap_handler(&self) -> u32

Return the offset to the trap handler.

Trait Implementations§

source§

impl Clone for VMOffsets

source§

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
source§

impl Debug for VMOffsets

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

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

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 Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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.