Struct wasmtime_runtime::VMContext
source · #[repr(C, align(16))]pub struct VMContext {
pub _marker: PhantomPinned,
}
Expand description
The VM “context”, which is pointed to by the vmctx
arg in Cranelift.
This has information about globals, memories, tables, and other runtime
state associated with the current instance.
The struct here is empty, as the sizes of these fields are dynamic, and we can’t describe them in Rust’s type system. Sufficient memory is allocated at runtime.
Fields§
§_marker: PhantomPinned
There’s some more discussion about this within wasmtime/src/lib.rs
but
the idea is that we want to tell the compiler that this contains
pointers which transitively refers to itself, to suppress some
optimizations that might otherwise assume this doesn’t exist.
The self-referential pointer we care about is the *mut Store
pointer
early on in this context, which if you follow through enough levels of
nesting, eventually can refer back to this VMContext
Implementations§
source§impl VMContext
impl VMContext
sourcepub unsafe fn from_opaque(opaque: *mut VMOpaqueContext) -> *mut VMContext
pub unsafe fn from_opaque(opaque: *mut VMOpaqueContext) -> *mut VMContext
Helper function to cast between context types using a debug assertion to protect against some mistakes.