Sign in

    Milky2018/wasmoon_runtime/runtime does not have a README file

    AsyncHostFunction

    One asynchronous host function registered with a Store.

    GcHeap

    pub(open) trait GcHeap {
    fn alloc_struct(Self, Int, Array[
    Value
    ]) -> Int raise RuntimeError
    fn alloc_array(Self, Int, Array[
    Value
    ]) -> Int raise RuntimeError
    fn struct_get(Self, Int, Int) ->
    Value
    raise RuntimeError
    fn struct_set(Self, Int, Int,
    Value
    ) -> Unit raise RuntimeError
    fn array_len(Self, Int) -> Int raise RuntimeError
    fn array_get(Self, Int, Int) ->
    Value
    raise RuntimeError
    fn array_set(Self, Int, Int,
    Value
    ) -> Unit raise RuntimeError
    fn array_fill(Self, Int, Int,
    Value
    , Int) -> Unit raise RuntimeError
    fn array_copy(Self, Int, Int, Int, Int, Int) -> Unit raise RuntimeError
    fn get_type_idx(Self, Int) -> Int raise RuntimeError
    fn is_valid(Self, Int) -> Bool
    }

    Low-level GC heap interface for object storage

    GcManager

    pub(open) trait GcManager {
    fn alloc_struct(Self, Int, Array[
    Value
    ]) -> Int raise RuntimeError
    fn alloc_array(Self, Int, Array[
    Value
    ]) -> Int raise RuntimeError
    fn struct_get(Self, Int, Int) ->
    Value
    raise RuntimeError
    fn struct_set(Self, Int, Int,
    Value
    ) -> Unit raise RuntimeError
    fn array_len(Self, Int) -> Int raise RuntimeError
    fn array_get(Self, Int, Int) ->
    Value
    raise RuntimeError
    fn array_set(Self, Int, Int,
    Value
    ) -> Unit raise RuntimeError
    fn array_fill(Self, Int, Int,
    Value
    , Int) -> Unit raise RuntimeError
    fn array_copy(Self, Int, Int, Int, Int, Int) -> Unit raise RuntimeError
    fn get_type_idx(Self, Int) -> Int raise RuntimeError
    fn is_valid(Self, Int) -> Bool
    fn should_collect(Self) -> Bool
    fn collect(Self, Array[
    Value
    ]) -> Unit
    fn stats(Self) -> GcStats
    fn write_barrier(Self, Int,
    Value
    ,
    Value
    ) -> Unit
    }

    Combined GC manager interface

    GcRuntime

    pub(open) trait GcRuntime {
    fn should_collect(Self) -> Bool
    fn collect(Self, Array[
    Value
    ]) -> Unit
    fn force_collect(Self, Array[
    Value
    ]) -> Unit
    fn write_barrier_pre(Self, Int,
    Value
    ,
    Value
    ) -> Unit
    fn write_barrier_post(Self, Int,
    Value
    ) -> Unit
    fn read_barrier(Self, Int) ->
    Value

    fn stats(Self) -> GcStats
    fn collection_count(Self) -> Int
    fn set_threshold(Self, Int) -> Unit
    fn get_threshold(Self) -> Int
    }

    Runtime GC coordination interface

    SegmentDropBinding

    pub(open) trait SegmentDropBinding {
    fn bind_segment_drop_flags(Self, FixedArray[Bool], FixedArray[Bool]) -> Unit
    }

    A call-scoped sink for the instance's authoritative segment drop flags.

    GuestContinuationSignal

    pub(all) suberror GuestContinuationSignal {
    GuestContinuationYield(GuestContinuationEffect, GuestContinuationBody)
    } derive(
    Debug
    )

    RuntimeError

    pub(all) suberror RuntimeError {
    UnsupportedHostCapability(String)
    HostExit(Int)
    StackUnderflow
    StackOverflow
    TypeMismatch
    InvalidModule(String)
    ForeignStore
    InvalidHandle
    StoreClosed
    MemoryClosed
    InvalidMemoryType(String)
    InvalidTableType(String)
    HeapRepresentationInUse
    OutOfBoundsMemoryAccess
    OutOfBoundsTableAccess
    OutOfBoundsArrayAccess
    UndefinedElement
    UninitializedElement
    IndirectCallTypeMismatch
    DivisionByZero
    IntegerOverflow
    InvalidConversion
    OutOfMemory
    InvalidResourceLimit
    InvalidExecutionLimit
    ExecutionLimitsUnavailable
    ExecutionCancelled
    ExecutionTimedOut
    ExecutionBudgetExceeded
    ResourceLimitExceeded(ResourceKind)
    TableAllocationOverflow
    TableAllocationFailed
    MemoryMinimumExceedsLimits(Int64)
    AllocationTooLarge
    AtomicWaitNonSharedMemory
    Unreachable
    UncaughtException
    CallStackExhausted
    UnknownImport(String, String)
    LinkError
    LinkErrorDetail(String)
    CastFailure
    NullReference
    UnalignedAtomic
    InvalidConstantExpression(String)
    ContinuationAlreadyConsumed
    UnhandledSuspension
    UnsupportedGcContinuationStorage
    AsyncHostRequiresAsyncCall
    AsyncHostCallInProgress
    AsyncHostCallCancelled
    AsyncHostError(String)
    } derive(Eq,
    Debug
    )

    RuntimeError::equal

    RuntimeError::from_error

    fn RuntimeError::from_error(error : Error) -> RuntimeError?

    Recover a structured runtime error from the language-wide Error type.

    This is the single transport boundary used by executors and asynchronous host-call adapters; unrelated errors return None instead of being flattened to a string here.

    RuntimeError::not_equal

    fn RuntimeError::not_equal(x : RuntimeError, y : RuntimeError) -> Bool

    RuntimeError::output

    fn RuntimeError::output(self : RuntimeError, logger : &Logger) -> Unit

    RuntimeError::to_string

    fn RuntimeError::to_string(self : RuntimeError) -> String

    ArrayInstance

    pub(all) struct ArrayInstance {
    type_idx : Int
    elements : Array[
    Value
    ]
    } derive(
    Debug
    )

    Array instance - stores element values and length

    ArrayInstance::output

    fn ArrayInstance::output(self : ArrayInstance, logger : &Logger) -> Unit

    ArrayInstance::to_string

    fn ArrayInstance::to_string(self : ArrayInstance) -> String

    AsyncHostCallDriver

    pub struct AsyncHostCallDriver {
    // private fields
    }

    Invocation-local owner of one pending asynchronous host operation.

    The driver is intentionally opaque. Executors poll it only at an imported hostcall and wait on it only after the Wasm continuation has been parked.

    AsyncHostCallDriver::cancel

    fn AsyncHostCallDriver::cancel(self : AsyncHostCallDriver) -> Unit

    Cancel the pending host operation, if any.

    AsyncHostCallDriver::poll

    Poll the operation associated with the current imported call.

    The first poll starts the host task. A later poll consumes its result after wait_pending has returned.

    AsyncHostCallDriver::to_repr

    AsyncHostCallDriver::wait_pending

    async fn AsyncHostCallDriver::wait_pending(self : AsyncHostCallDriver) -> Unit raise RuntimeError

    Wait without blocking the host thread until the parked host operation can be consumed by a retry of the same Wasm call site.

    AsyncHostPoll

    pub(all) enum AsyncHostPoll {
    AsyncHostPending
    AsyncHostReady(Array[
    Value
    ])
    } derive(
    Debug
    )

    Result of polling the host operation at the current Wasm call site.

    AtomicRmwOp

    pub(all) enum AtomicRmwOp {
    Add
    Sub
    And
    Or
    Xor
    Exchange
    }

    CallStackEntry

    pub(all) struct CallStackEntry {
    func_idx : Int
    func_name : String?
    }

    A stack frame entry for error reporting

    Caller

    pub struct Caller {
    store : Store
    instance : ModuleInstance
    } derive(
    Debug
    )

    Caller context for host functions.

    This mirrors Wasmtime's Caller concept at a simpler level:
    • store gives access to runtime state (memories, tables, globals, etc.).
    • instance is the wasm module instance that called into the host.

    Caller::Caller

    fn Caller::Caller(store : Store, instance : ModuleInstance) -> Caller raise RuntimeError

    Caller::get_exported_func_addr

    fn Caller::get_exported_func_addr(self : Caller, name : String) -> Int?

    Look up an exported function address from the caller instance.

    Caller::get_exported_memory

    fn Caller::get_exported_memory(self : Caller, name : String) -> Memory? raise RuntimeError

    Look up an exported memory from the caller instance.

    Caller::instance

    fn Caller::instance(self : Caller) -> ModuleInstance

    Caller::store

    fn Caller::store(self : Caller) -> Store

    Caller::to_repr

    ExecutionScope

    pub struct ExecutionScope {
    // private fields
    }

    A captured execution scope survives suspension. Nested scopes also charge their parent, so a nested call cannot reset its caller's budget.

    ExecutionScope::check

    fn ExecutionScope::check(self : ExecutionScope) -> Unit raise RuntimeError

    ExecutionScope::failure

    ExecutionScope::poll

    fn ExecutionScope::poll(self : ExecutionScope) -> Bool

    ExecutionScope::to_repr

    ExnInstance

    pub struct ExnInstance {
    tag_addr : Int
    values : Array[
    Value
    ]
    } derive(
    Debug
    )

    Exception instance - represents a caught exception

    ExternVal

    pub(all) enum ExternVal {
    Func(Int)
    Table(Int)
    Memory(Int)
    Global(Int)
    Tag(Int)
    }

    External value for imports

    Frame

    Call frame for function execution

    Frame::Frame

    fn Frame::Frame(func_idx : Int, locals : Array[
    Value
    ], return_arity : Int) -> Frame

    Frame::get_func_idx

    fn Frame::get_func_idx(self : Frame) -> Int

    Frame::get_local

    fn Frame::get_local(self : Frame, idx : Int) ->
    Value
    raise RuntimeError

    Frame::locals_values

    Snapshot local values (for GC root collection/debugging)

    Frame::set_local

    fn Frame::set_local(self : Frame, idx : Int, value :
    Value
    ) -> Unit raise RuntimeError

    Frame::to_repr

    FuncInst

    Function instance - either WASM code or host function
    impl Show for FuncInst
    impl Debug for FuncInst

    FuncInst::output

    fn FuncInst::output(self : FuncInst, logger : &Logger) -> Unit

    FuncInst::to_repr

    FuncInst::to_string

    fn FuncInst::to_string(self : FuncInst) -> String

    FuncOwner

    pub(all) enum FuncOwner {
    HostFunc
    Unowned
    Module(Int)
    } derive(Eq,
    Debug
    )

    Represents the ownership status of a function in the store

    FuncOwner::equal

    fn FuncOwner::equal(FuncOwner, FuncOwner) -> Bool

    FuncOwner::not_equal

    fn FuncOwner::not_equal(x : FuncOwner, y : FuncOwner) -> Bool

    FunctionIdentity

    pub struct FunctionIdentity {
    // private fields
    }

    One allocation lifetime, independent of a reused function address or code.

    FunctionIdentity::is_live

    fn FunctionIdentity::is_live(self : FunctionIdentity) -> Bool

    GCObject

    pub(all) enum GCObject {
    Struct(StructInstance)
    Array(ArrayInstance)
    } derive(
    Debug
    )

    GC Object representation Stores either a struct instance or an array instance
    impl Show for GCObject

    GCObject::output

    fn GCObject::output(self : GCObject, logger : &Logger) -> Unit

    GCObject::to_repr

    GCObject::to_string

    fn GCObject::to_string(self : GCObject) -> String

    GCStats

    pub struct GCStats {
    total_objects : Int
    live_objects : Int
    free_slots : Int
    collections : Int
    bytes_allocated : Int64
    bytes_collected : Int64
    } derive(
    Debug
    )

    GC statistics

    GCStats::to_repr

    GcRootLease

    pub struct GcRootLease {
    // private fields
    }

    One Store-owned lease that keeps a snapshot of GC references alive.

    Executors use this while an invocation is parked outside an active Wasm stack. Releasing a lease is idempotent.

    GcRootLease::release

    fn GcRootLease::release(self : GcRootLease) -> Unit

    GcRootLease::snapshot

    Copy the explicit roots owned by this lease for continuation transfer.

    GcStats

    pub struct GcStats {
    total_slots : Int
    live_objects : Int
    free_slots : Int
    collections : Int
    bytes_allocated : Int64
    bytes_collected : Int64
    } derive(
    Debug
    )

    GC statistics

    GcStats::to_repr

    GlobalInstance

    type GlobalInstance derive(
    Debug
    )

    Runtime representation of a global variable

    GlobalInstance::bind_native

    fn GlobalInstance::bind_native(self : GlobalInstance, binding : NativeGlobalBinding) -> Unit

    GlobalInstance::get_type

    Get global type for type checking

    GlobalInstance::native_binding

    fn GlobalInstance::native_binding(self : GlobalInstance) -> NativeGlobalBinding?

    GlobalInstance::set

    GuestContinuationBody

    pub struct GuestContinuationBody {
    run : (GuestContinuationInput) -> Array[
    Value
    ] raise
    cancel : () -> Unit
    // private fields
    }

    Engine-owned execution state. The Store owns its cancellation capability.

    GuestContinuationBody::gc_root_leases

    Transfer root leases together with engine state when rebinding a body.

    GuestContinuationBody::gc_roots

    Retained reference roots of an engine-owned continuation.

    GuestContinuationBody::to_repr

    GuestContinuationEffect

    GuestContinuationInput

    Delivery at a guest suspension point, including exception injection.

    Imports

    type Imports

    Import object: maps (module_name, name) to external values

    Imports::Imports

    fn Imports::Imports(store : Store) -> Imports

    Imports::add_func

    fn Imports::add_func(self : Imports, mod_name : String, name : String, func_addr : Int) -> Unit

    Imports::add_global

    fn Imports::add_global(self : Imports, mod_name : String, name : String, global_addr : Int) -> Unit

    Imports::add_memory

    fn Imports::add_memory(self : Imports, mod_name : String, name : String, mem_addr : Int) -> Unit

    Imports::add_table

    fn Imports::add_table(self : Imports, mod_name : String, name : String, table_addr : Int) -> Unit

    Imports::add_tag

    fn Imports::add_tag(self : Imports, mod_name : String, name : String, tag_addr : Int) -> Unit

    Imports::check_store

    fn Imports::check_store(self : Imports, store : Store) -> Unit raise RuntimeError

    Imports::resolve

    fn Imports::resolve(self : Imports, mod_name : String, name : String) -> ExternVal?

    InstanceAdmission

    pub struct InstanceAdmission {
    // private fields
    }

    Admission before instance initialization. A token belongs to one Store and can be consumed once. Cancel unused tokens explicitly; native also releases them through its last-owner finalizer.

    InstanceAdmission::cancel

    fn InstanceAdmission::cancel(self : InstanceAdmission) -> Unit

    Return an unused admission, including when the caller retains the token.

    InstantiationTransaction

    type InstantiationTransaction

    One rollback stack shared by every layer of an instantiation.

    Participants register inverse operations as they acquire state. Rollback runs them in reverse order; commit discards them. Both terminal operations are idempotent.

    InstantiationTransaction::commit

    InstantiationTransaction::new

    InstantiationTransaction::registrar

    InstantiationTransaction::rollback

    InterpreterLimits

    pub struct InterpreterLimits {
    max_frames : Int
    max_values : Int
    max_controls : Int
    max_reentry_depth : Int
    } derive(
    Debug
    )

    Interpreter budgets per invocation. Values count operand and local slots, not bytes; control frames include function and structured-control entries. Host calls and guest-continuation callbacks share a native nesting budget across interpreter contexts in the same Store. These limits do not configure JIT stacks or guest linear-memory stacks.

    InterpreterLimits::default

    InterpreterLimits::new

    fn InterpreterLimits::new(max_frames? : Int, max_values? : Int, max_controls? : Int, max_reentry_depth? : Int) -> InterpreterLimits raise RuntimeError

    Linker

    type Linker

    Linker for managing multiple module instances and their dependencies

    Linker::Linker

    fn Linker::Linker() -> Linker raise RuntimeError

    Create a new linker with a fresh store

    Linker::add_async_host_func

    fn Linker::add_async_host_func(self : Linker, mod_name : String, name : String, func : async (Array[
    Value
    ]) -> Array[
    Value
    ], func_type? :
    FuncType
    ) -> Unit raise RuntimeError

    Add an asynchronous host function to the linker.

    The function can only be invoked through an asynchronous Wasm call. Its future is polled while the Wasm continuation is parked.

    Linker::add_async_host_func_with_caller

    fn Linker::add_async_host_func_with_caller(self : Linker, mod_name : String, name : String, func : async (Caller, Array[
    Value
    ]) -> Array[
    Value
    ], func_type? :
    FuncType
    ) -> Unit raise RuntimeError

    Add an asynchronous host function that receives the caller context.

    Linker::add_global

    fn Linker::add_global(self : Linker, mod_name : String, name : String, global : GlobalInstance) -> Unit raise RuntimeError

    Add a global to the linker

    Linker::add_host_func

    fn Linker::add_host_func(self : Linker, mod_name : String, name : String, func : (Array[
    Value
    ]) -> Array[
    Value
    ] raise RuntimeError, func_type? :
    FuncType
    ) -> Unit raise RuntimeError

    Add a host function to the linker This function will be available as an import for all subsequently instantiated modules

    Linker::add_host_func_with_caller

    fn Linker::add_host_func_with_caller(self : Linker, mod_name : String, name : String, func : (Caller, Array[
    Value
    ]) -> Array[
    Value
    ] raise RuntimeError, func_type? :
    FuncType
    ) -> Unit raise RuntimeError

    Add a host function that receives the caller context.

    Linker::add_memory

    fn Linker::add_memory(self : Linker, mod_name : String, name : String, mem : Memory) -> Unit raise RuntimeError

    Add a memory to the linker

    Linker::add_table

    fn Linker::add_table(self : Linker, mod_name : String, name : String, table : Table) -> Unit raise RuntimeError

    Add a table to the linker

    Linker::build_imports

    fn Linker::build_imports(self : Linker) -> Imports

    Build Imports from all registered modules This allows a new module to import from any previously registered module

    Linker::close

    fn Linker::close(self : Linker) -> Unit

    Release this linker's store after all module execution has ended.

    This operation is idempotent and terminal.

    Linker::get_module

    fn Linker::get_module(self : Linker, name : String) -> ModuleInstance?

    Get a registered module instance by name

    Linker::get_store

    fn Linker::get_store(self : Linker) -> Store

    Get the underlying store

    Linker::register

    fn Linker::register(self : Linker, name : String, instance : ModuleInstance) -> Unit raise RuntimeError

    Register a module instance with a name The module's exports will be available as imports for subsequent modules

    Linker::register_rollback

    fn Linker::register_rollback(self : Linker, registrar : RollbackRegistrar) -> Unit

    Register rollback for core allocations and names added by an instantiation.

    Linker::with_store

    fn Linker::with_store(store : Store) -> Linker

    Create a new linker with an existing store

    MarkSweepHeap

    pub struct MarkSweepHeap {
    objects : Array[GCObject?]
    marks : Array[Bool]
    free_list : Array[Int]
    total_live : Int
    gc_threshold : Int
    collections : Int
    bytes_allocated : Int64
    bytes_collected : Int64
    // private fields
    } derive(
    Debug
    )

    GC Heap - manages all GC objects with mark-sweep garbage collection

    MarkSweepHeap::MarkSweepHeap

    fn MarkSweepHeap::MarkSweepHeap(resource_budget? : ResourceBudget?) -> MarkSweepHeap

    Create a new empty GC heap

    MarkSweepHeap::alloc_array

    fn MarkSweepHeap::alloc_array(self : MarkSweepHeap, type_idx : Int, elements : Array[
    Value
    ]) -> Int raise RuntimeError

    Allocate an array instance and return its reference index

    MarkSweepHeap::alloc_struct

    fn MarkSweepHeap::alloc_struct(self : MarkSweepHeap, type_idx : Int, fields : Array[
    Value
    ]) -> Int raise RuntimeError

    Allocate a struct instance and return its reference index

    MarkSweepHeap::array_copy

    fn MarkSweepHeap::array_copy(self : MarkSweepHeap, dst_idx : Int, dst_offset : Int, src_idx : Int, src_offset : Int, count : Int) -> Unit raise RuntimeError

    Copy elements between arrays

    MarkSweepHeap::array_fill

    fn MarkSweepHeap::array_fill(self : MarkSweepHeap, array_idx : Int, offset : Int, value :
    Value
    , count : Int) -> Unit raise RuntimeError

    Fill array elements with a value

    MarkSweepHeap::array_get

    fn MarkSweepHeap::array_get(self : MarkSweepHeap, array_idx : Int, elem_idx : Int) ->
    Value
    raise RuntimeError

    Get an array element value

    MarkSweepHeap::array_len

    fn MarkSweepHeap::array_len(self : MarkSweepHeap, array_idx : Int) -> Int raise RuntimeError

    Get array length

    MarkSweepHeap::array_set

    fn MarkSweepHeap::array_set(self : MarkSweepHeap, array_idx : Int, elem_idx : Int, value :
    Value
    ) -> Unit raise RuntimeError

    Set an array element value

    MarkSweepHeap::close

    fn MarkSweepHeap::close(self : MarkSweepHeap) -> Unit

    Release all objects and quota capacity. Closing is terminal and idempotent.

    MarkSweepHeap::collect

    Perform a full garbage collection cycle Returns the number of objects collected

    MarkSweepHeap::collection_count

    fn MarkSweepHeap::collection_count(self : MarkSweepHeap) -> Int

    MarkSweepHeap::force_collect

    fn MarkSweepHeap::force_collect(self : MarkSweepHeap, roots : Array[
    Value
    ]) -> Unit

    MarkSweepHeap::get

    fn MarkSweepHeap::get(self : MarkSweepHeap, idx : Int) -> GCObject raise RuntimeError

    Get an object by reference index

    MarkSweepHeap::get_array

    fn MarkSweepHeap::get_array(self : MarkSweepHeap, idx : Int) -> ArrayInstance raise RuntimeError

    Get an array instance by reference index

    MarkSweepHeap::get_struct

    fn MarkSweepHeap::get_struct(self : MarkSweepHeap, idx : Int) -> StructInstance raise RuntimeError

    Get a struct instance by reference index

    MarkSweepHeap::get_threshold

    fn MarkSweepHeap::get_threshold(self : MarkSweepHeap) -> Int

    Get the current GC threshold

    MarkSweepHeap::get_type_idx

    fn MarkSweepHeap::get_type_idx(self : MarkSweepHeap, idx : Int) -> Int raise RuntimeError

    Get the type index of an object

    MarkSweepHeap::is_alive

    fn MarkSweepHeap::is_alive(self : MarkSweepHeap, idx : Int) -> Bool

    Check if an object index is valid and alive

    MarkSweepHeap::is_valid

    fn MarkSweepHeap::is_valid(self : MarkSweepHeap, idx : Int) -> Bool

    Check if an object reference is valid and alive

    MarkSweepHeap::length

    fn MarkSweepHeap::length(self : MarkSweepHeap) -> Int

    Get total number of allocated objects (including free slots)

    MarkSweepHeap::mark

    fn MarkSweepHeap::mark(self : MarkSweepHeap, idx : Int) -> Unit

    Mark an object as reachable (and recursively mark referenced objects)

    MarkSweepHeap::mark_roots

    Mark all objects reachable from the given roots

    MarkSweepHeap::read_barrier

    fn MarkSweepHeap::read_barrier(_self : MarkSweepHeap, idx : Int) ->
    Value

    MarkSweepHeap::set_threshold

    fn MarkSweepHeap::set_threshold(self : MarkSweepHeap, threshold : Int) -> Unit

    Set the GC threshold

    MarkSweepHeap::should_collect

    fn MarkSweepHeap::should_collect(self : MarkSweepHeap) -> Bool

    Check if GC should be triggered based on allocation count

    MarkSweepHeap::stats

    fn MarkSweepHeap::stats(self : MarkSweepHeap) -> GCStats

    Get GC statistics

    MarkSweepHeap::struct_get

    fn MarkSweepHeap::struct_get(self : MarkSweepHeap, struct_idx : Int, field_idx : Int) ->
    Value
    raise RuntimeError

    Get a struct field value

    MarkSweepHeap::struct_set

    fn MarkSweepHeap::struct_set(self : MarkSweepHeap, struct_idx : Int, field_idx : Int, value :
    Value
    ) -> Unit raise RuntimeError

    Set a struct field value

    MarkSweepHeap::sweep

    fn MarkSweepHeap::sweep(self : MarkSweepHeap) -> Int

    Sweep phase: collect all unmarked objects

    MarkSweepHeap::with_threshold

    fn MarkSweepHeap::with_threshold(threshold : Int, resource_budget? : ResourceBudget?) -> MarkSweepHeap

    Create a new GC heap with custom threshold

    MarkSweepHeap::write_barrier

    fn MarkSweepHeap::write_barrier(_self : MarkSweepHeap, _obj_idx : Int, _old_value :
    Value
    , _new_value :
    Value
    ) -> Unit

    MarkSweepHeap::write_barrier_post

    fn MarkSweepHeap::write_barrier_post(_self : MarkSweepHeap, _obj_idx : Int, _new_value :
    Value
    ) -> Unit

    MarkSweepHeap::write_barrier_pre

    fn MarkSweepHeap::write_barrier_pre(_self : MarkSweepHeap, _obj_idx : Int, _old_value :
    Value
    , _new_value :
    Value
    ) -> Unit

    Memory

    Memory::Memory

    fn Memory::Memory(min : Int, max : Int?, is_memory64? : Bool, is_shared? : Bool, page_size_log2? : Int, resource_budget? : ResourceBudget?) -> Memory raise RuntimeError

    Memory::atomic_compare_exchange

    fn Memory::atomic_compare_exchange(self : Memory, offset : Int64, width : Int, expected : Int64, replacement : Int64) -> Int64 raise RuntimeError

    Memory::atomic_load

    fn Memory::atomic_load(self : Memory, offset : Int64, width : Int) -> Int64 raise RuntimeError

    Memory::atomic_notify

    fn Memory::atomic_notify(self : Memory, offset : Int64, count : UInt) -> UInt raise RuntimeError

    Memory::atomic_rmw

    fn Memory::atomic_rmw(self : Memory, operation : AtomicRmwOp, offset : Int64, width : Int, value : Int64) -> Int64 raise RuntimeError

    Memory::atomic_store

    fn Memory::atomic_store(self : Memory, offset : Int64, width : Int, value : Int64) -> Unit raise RuntimeError

    Memory::atomic_wait_begin

    fn Memory::atomic_wait_begin(self : Memory, offset : Int64, width : Int, expected : Int64, timeout : Int64) ->
    NativeAtomicWait
    raise RuntimeError

    Register a wait without blocking the embedding thread. The returned owner keeps the native shared memory live until cancellation or finalization.

    Memory::byte_len

    fn Memory::byte_len(self : Memory) -> Int64

    Memory::close

    fn Memory::close(self : Memory) -> Unit

    Memory::copy

    fn Memory::copy(self : Memory, dest : Int, src : Int, len : Int) -> Unit raise RuntimeError

    Copy memory within the same memory instance Handles overlapping regions correctly

    Memory::copy_at

    fn Memory::copy_at(self : Memory, destination : Int64, source : Int64, length : Int64) -> Unit raise RuntimeError

    Memory::copy_from

    fn Memory::copy_from(self : Memory, destination : Int64, source : Memory, source_offset : Int64, length : Int64) -> Unit raise RuntimeError

    Copy bytes after checking both ranges, including zero-length copies. Native memmove also handles aliases imported under different memory indices.

    Memory::desc_ptr

    Retain the native memory descriptor.

    Existing handles stay live across Store close; closed Memory aliases return an empty handle and reject further access through the Memory API.

    Memory::fill

    fn Memory::fill(self : Memory, dest : Int, value : Byte, len : Int) -> Unit raise RuntimeError

    Fill memory region with a byte value

    Memory::fill_at

    fn Memory::fill_at(self : Memory, destination : Int64, value : Byte, length : Int64) -> Unit raise RuntimeError

    Memory::from_type

    Allocate a validated module memory without narrowing its page limits.

    Memory::get_limits

    fn Memory::get_limits(self : Memory) -> (Int, Int?)

    Legacy 32-bit page counts. Maxima wider than 32 bits are omitted. Use get_limits64 for module type compatibility.

    Memory::get_limits64

    fn Memory::get_limits64(self : Memory) -> (Int64, Int64?)

    Return the full logical page limits for module import compatibility.

    Memory::grow

    fn Memory::grow(self : Memory, delta : Int) -> Int

    Memory::grow64

    fn Memory::grow64(self : Memory, delta : Int64) -> Int64

    Grow by an unsigned memory64 page count; negative bit patterns cannot fit.

    Memory::init_data

    fn Memory::init_data(self : Memory, dest : Int, data : Bytes) -> Unit raise RuntimeError

    Initialize memory with data segment

    Memory::init_data_at

    fn Memory::init_data_at(self : Memory, destination : Int64, data : Bytes) -> Unit raise RuntimeError

    Memory::is_memory64

    fn Memory::is_memory64(self : Memory) -> Bool

    Memory::is_shared

    fn Memory::is_shared(self : Memory) -> Bool

    Memory::load_byte

    fn Memory::load_byte(self : Memory, addr : Int) -> Byte raise RuntimeError

    Memory::load_byte_at

    fn Memory::load_byte_at(self : Memory, addr : Int64) -> Byte raise RuntimeError

    Memory::load_f32

    fn Memory::load_f32(self : Memory, addr : Int) -> Float raise RuntimeError

    Memory::load_f32_at

    fn Memory::load_f32_at(self : Memory, addr : Int64) -> Float raise RuntimeError

    Memory::load_f64

    fn Memory::load_f64(self : Memory, addr : Int) -> Double raise RuntimeError

    Memory::load_f64_at

    fn Memory::load_f64_at(self : Memory, addr : Int64) -> Double raise RuntimeError

    Memory::load_i32

    fn Memory::load_i32(self : Memory, addr : Int) -> Int raise RuntimeError

    Memory::load_i32_16s

    fn Memory::load_i32_16s(self : Memory, addr : Int) -> Int raise RuntimeError

    Memory::load_i32_16s_at

    fn Memory::load_i32_16s_at(self : Memory, addr : Int64) -> Int raise RuntimeError

    Load 16-bit signed integer, sign-extend to i32

    Memory::load_i32_16u

    fn Memory::load_i32_16u(self : Memory, addr : Int) -> Int raise RuntimeError

    Memory::load_i32_16u_at

    fn Memory::load_i32_16u_at(self : Memory, addr : Int64) -> Int raise RuntimeError

    Load 16-bit unsigned integer, zero-extend to i32

    Memory::load_i32_8s

    fn Memory::load_i32_8s(self : Memory, addr : Int) -> Int raise RuntimeError

    Memory::load_i32_8s_at

    fn Memory::load_i32_8s_at(self : Memory, addr : Int64) -> Int raise RuntimeError

    Load 8-bit signed integer, sign-extend to i32

    Memory::load_i32_8u

    fn Memory::load_i32_8u(self : Memory, addr : Int) -> Int raise RuntimeError

    Memory::load_i32_8u_at

    fn Memory::load_i32_8u_at(self : Memory, addr : Int64) -> Int raise RuntimeError

    Load 8-bit unsigned integer, zero-extend to i32

    Memory::load_i32_at

    fn Memory::load_i32_at(self : Memory, addr : Int64) -> Int raise RuntimeError

    Memory::load_i64

    fn Memory::load_i64(self : Memory, addr : Int) -> Int64 raise RuntimeError

    Memory::load_i64_16s

    fn Memory::load_i64_16s(self : Memory, addr : Int) -> Int64 raise RuntimeError

    Memory::load_i64_16s_at

    fn Memory::load_i64_16s_at(self : Memory, addr : Int64) -> Int64 raise RuntimeError

    Load 16-bit signed integer, sign-extend to i64

    Memory::load_i64_16u

    fn Memory::load_i64_16u(self : Memory, addr : Int) -> Int64 raise RuntimeError

    Memory::load_i64_16u_at

    fn Memory::load_i64_16u_at(self : Memory, addr : Int64) -> Int64 raise RuntimeError

    Load 16-bit unsigned integer, zero-extend to i64

    Memory::load_i64_32s

    fn Memory::load_i64_32s(self : Memory, addr : Int) -> Int64 raise RuntimeError

    Memory::load_i64_32s_at

    fn Memory::load_i64_32s_at(self : Memory, addr : Int64) -> Int64 raise RuntimeError

    Load 32-bit signed integer, sign-extend to i64

    Memory::load_i64_32u

    fn Memory::load_i64_32u(self : Memory, addr : Int) -> Int64 raise RuntimeError

    Memory::load_i64_32u_at

    fn Memory::load_i64_32u_at(self : Memory, addr : Int64) -> Int64 raise RuntimeError

    Load 32-bit unsigned integer, zero-extend to i64

    Memory::load_i64_8s

    fn Memory::load_i64_8s(self : Memory, addr : Int) -> Int64 raise RuntimeError

    Memory::load_i64_8s_at

    fn Memory::load_i64_8s_at(self : Memory, addr : Int64) -> Int64 raise RuntimeError

    Load 8-bit signed integer, sign-extend to i64

    Memory::load_i64_8u

    fn Memory::load_i64_8u(self : Memory, addr : Int) -> Int64 raise RuntimeError

    Memory::load_i64_8u_at

    fn Memory::load_i64_8u_at(self : Memory, addr : Int64) -> Int64 raise RuntimeError

    Load 8-bit unsigned integer, zero-extend to i64

    Memory::load_i64_at

    fn Memory::load_i64_at(self : Memory, addr : Int64) -> Int64 raise RuntimeError

    Memory::new_guarded_memory0

    fn Memory::new_guarded_memory0(min : Int, max : Int?, is_shared? : Bool) -> Memory raise RuntimeError

    Memory::page_size_bytes

    fn Memory::page_size_bytes(self : Memory) -> Int64

    Memory::read_byte

    fn Memory::read_byte(self : Memory, addr : Int) -> Byte

    Read a byte from memory (non-raising version for WASI)

    Memory::read_bytes

    fn Memory::read_bytes(self : Memory, addr : Int, len : Int) -> Bytes

    Read bytes from memory (non-raising version for WASI)

    Memory::read_i32

    fn Memory::read_i32(self : Memory, addr : Int) -> Int

    Read i32 from memory (non-raising version for WASI)

    Memory::read_i64

    fn Memory::read_i64(self : Memory, addr : Int) -> Int64

    Read i64 from memory (non-raising version for WASI)

    Memory::size_pages

    fn Memory::size_pages(self : Memory) -> Int

    Memory::store_byte

    fn Memory::store_byte(self : Memory, addr : Int, value : Byte) -> Unit raise RuntimeError

    Memory::store_byte_at

    fn Memory::store_byte_at(self : Memory, addr : Int64, value : Byte) -> Unit raise RuntimeError

    Memory::store_f32

    fn Memory::store_f32(self : Memory, addr : Int, value : Float) -> Unit raise RuntimeError

    Memory::store_f32_at

    fn Memory::store_f32_at(self : Memory, addr : Int64, value : Float) -> Unit raise RuntimeError

    Memory::store_f64

    fn Memory::store_f64(self : Memory, addr : Int, value : Double) -> Unit raise RuntimeError

    Memory::store_f64_at

    fn Memory::store_f64_at(self : Memory, addr : Int64, value : Double) -> Unit raise RuntimeError

    Memory::store_i32

    fn Memory::store_i32(self : Memory, addr : Int, value : Int) -> Unit raise RuntimeError

    Memory::store_i32_16

    fn Memory::store_i32_16(self : Memory, addr : Int, value : Int) -> Unit raise RuntimeError

    Memory::store_i32_16_at

    fn Memory::store_i32_16_at(self : Memory, addr : Int64, value : Int) -> Unit raise RuntimeError

    Store low 16 bits of i32

    Memory::store_i32_8

    fn Memory::store_i32_8(self : Memory, addr : Int, value : Int) -> Unit raise RuntimeError

    Memory::store_i32_8_at

    fn Memory::store_i32_8_at(self : Memory, addr : Int64, value : Int) -> Unit raise RuntimeError

    Store low 8 bits of i32

    Memory::store_i32_at

    fn Memory::store_i32_at(self : Memory, addr : Int64, value : Int) -> Unit raise RuntimeError

    Memory::store_i64

    fn Memory::store_i64(self : Memory, addr : Int, value : Int64) -> Unit raise RuntimeError

    Memory::store_i64_16

    fn Memory::store_i64_16(self : Memory, addr : Int, value : Int64) -> Unit raise RuntimeError

    Memory::store_i64_16_at

    fn Memory::store_i64_16_at(self : Memory, addr : Int64, value : Int64) -> Unit raise RuntimeError

    Store low 16 bits of i64

    Memory::store_i64_32

    fn Memory::store_i64_32(self : Memory, addr : Int, value : Int64) -> Unit raise RuntimeError

    Memory::store_i64_32_at

    fn Memory::store_i64_32_at(self : Memory, addr : Int64, value : Int64) -> Unit raise RuntimeError

    Store low 32 bits of i64

    Memory::store_i64_8

    fn Memory::store_i64_8(self : Memory, addr : Int, value : Int64) -> Unit raise RuntimeError

    Memory::store_i64_8_at

    fn Memory::store_i64_8_at(self : Memory, addr : Int64, value : Int64) -> Unit raise RuntimeError

    Store low 8 bits of i64

    Memory::store_i64_at

    fn Memory::store_i64_at(self : Memory, addr : Int64, value : Int64) -> Unit raise RuntimeError

    Memory::to_repr

    Memory::write_byte

    fn Memory::write_byte(self : Memory, addr : Int, value : Byte) -> Unit

    Write a byte to memory (non-raising version for WASI)

    Memory::write_i32

    fn Memory::write_i32(self : Memory, addr : Int, value : Int) -> Unit

    Write i32 to memory (non-raising version for WASI)

    Memory::write_i64

    fn Memory::write_i64(self : Memory, addr : Int, value : Int64) -> Unit

    Write i64 to memory (non-raising version for WASI)

    ModuleInstance

    pub struct ModuleInstance {
    types : ReadOnlyArray[
    SubType
    ]
    type_rec_groups : ReadOnlyArray[Int]
    canonical_type_indices : ReadOnlyArray[Int]
    func_addrs : ReadOnlyArray[Int]
    func_type_indices : ReadOnlyArray[Int]
    table_addrs : ReadOnlyArray[Int]
    mem_addrs : ReadOnlyArray[Int]
    global_addrs : ReadOnlyArray[Int]
    tag_addrs : ReadOnlyArray[Int]
    exports : ReadOnlyArray[
    Export
    ]
    elem_segments : ReadOnlyArray[
    Element
    ]
    data_segments : ReadOnlyArray[
    Data
    ]
    // private fields
    } derive(
    Debug
    )

    Runtime instance of a WebAssembly module

    ModuleInstance::ModuleInstance

    fn ModuleInstance::ModuleInstance() -> ModuleInstance

    ModuleInstance::bind_native_segments

    fn[T : SegmentDropBinding] ModuleInstance::bind_native_segments(self : ModuleInstance, context : T) -> Unit

    Native integration: bind the instance's drop state without exposing mutable arrays.

    ModuleInstance::data_dropped

    fn ModuleInstance::data_dropped(self : ModuleInstance, index : Int) -> Bool

    ModuleInstance::drop_data

    fn ModuleInstance::drop_data(self : ModuleInstance, index : Int) -> Unit raise RuntimeError

    ModuleInstance::drop_element

    fn ModuleInstance::drop_element(self : ModuleInstance, index : Int) -> Unit raise RuntimeError

    Retire evaluated element values as well as their guest-visible availability.

    ModuleInstance::element_dropped

    fn ModuleInstance::element_dropped(self : ModuleInstance, index : Int) -> Bool

    ModuleInstance::element_value

    fn ModuleInstance::element_value(self : ModuleInstance, segment : Int, index : Int) ->
    Value
    raise RuntimeError

    Read one evaluated element without copying a segment during bulk initialization.

    ModuleInstance::element_values

    fn ModuleInstance::element_values(self : ModuleInstance, index : Int) -> ReadOnlyArray[
    Value
    ] raise RuntimeError

    ModuleInstance::output

    fn ModuleInstance::output(self : ModuleInstance, logger : &Logger) -> Unit

    ModuleInstance::store_index

    fn ModuleInstance::store_index(self : ModuleInstance) -> Int

    ModuleInstance::to_string

    fn ModuleInstance::to_string(self : ModuleInstance) -> String

    ModuleInstance::validated_array_type_at

    fn ModuleInstance::validated_array_type_at(self : ModuleInstance, idx : Int) ->
    ArrayType

    The array type at idx, in an instance whose module passed validation.

    ModuleInstance::validated_func_type_at

    fn ModuleInstance::validated_func_type_at(self : ModuleInstance, idx : Int) ->
    FuncType

    The function type at idx, in an instance whose module passed validation.

    ModuleInstance::validated_struct_type_at

    fn ModuleInstance::validated_struct_type_at(self : ModuleInstance, idx : Int) ->
    StructType

    The struct type at idx, in an instance whose module passed validation.

    NativeGlobalBinding

    pub(all) struct NativeGlobalBinding {
    address : Int64
    root : () ->
    Value

    read : () ->
    Value
    raise RuntimeError
    write : (
    Value
    ) -> Unit raise RuntimeError
    release : () -> Unit
    }

    Shared native storage for one store global, independent of module indices.

    NativeGlobalBinding::to_repr

    ResourceBudget

    pub struct ResourceBudget {
    compilation_depth : Int
    // private fields
    } derive(
    Debug
    )

    Aggregate quotas shared by explicitly related Stores. Units are logical resource sizes, not process RSS. A reservation survives its Store when an independently retained native allocation still owns it.

    ResourceBudget::native_quota

    A low-level native allocator capability. Callers must retain reservations for the complete allocation lifetime; ordinary embedders use Store APIs.

    ResourceBudget::new

    fn ResourceBudget::new(compilation_depth? : Int, memory_bytes? : Int64, table_elements? : Int64, gc_bytes? : Int64, gc_objects? : Int64, instances? : Int64, code_bytes? : Int64, pending_work? : Int64, input_bytes? : Int64, compilation_units? : Int64) -> ResourceBudget raise RuntimeError

    ResourceBudget::reserve

    fn ResourceBudget::reserve(self : ResourceBudget, kind : ResourceKind, amount : Int64) -> ResourceLease raise RuntimeError

    Reserve before side effects. Copies share one reservation and release once.

    ResourceBudget::used

    fn ResourceBudget::used(self : ResourceBudget, kind : ResourceKind) -> Int64

    ResourceKind

    pub(all) enum ResourceKind {
    MemoryBytes
    TableElements
    GcBytes
    GcObjects
    Instances
    CodeBytes
    PendingWork
    InputBytes
    CompilationUnits
    } derive(Eq,
    Debug
    )

    Units admitted by one explicitly shared embedding budget.

    ResourceKind::equal

    ResourceKind::not_equal

    fn ResourceKind::not_equal(x : ResourceKind, y : ResourceKind) -> Bool

    ResourceLease

    pub struct ResourceLease {
    // private fields
    } derive(
    Debug
    )

    ResourceLease::release

    fn ResourceLease::release(self : ResourceLease) -> Unit

    ResourceLease::resize

    fn ResourceLease::resize(self : ResourceLease, amount : Int64) -> Bool

    Resize an explicitly owned work reservation before the next unit of work. Failure preserves the previous charge. Closed reservations cannot be reused.

    RollbackRegistrar

    type RollbackRegistrar

    RollbackRegistrar::on_finish

    fn RollbackRegistrar::on_finish(self : RollbackRegistrar, finalizer : () -> Unit) -> Unit

    RollbackRegistrar::on_rollback

    fn RollbackRegistrar::on_rollback(self : RollbackRegistrar, rollback : () -> Unit) -> Unit

    RootedValue

    pub struct RootedValue {
    // private fields
    }

    An embedding value with Store provenance and an explicit GC root lifetime. On native, MoonBit RC retires the root when this value is dropped. On wasm, explicitly close it (normally with defer). Close invalidates all aliases; Store.close also retires outstanding roots. Primitive values can be passed between Stores.

    RootedValue::close

    fn RootedValue::close(self : RootedValue) -> Unit

    RootedValue::f32

    fn RootedValue::f32(value : Float) -> RootedValue

    RootedValue::f64

    fn RootedValue::f64(value : Double) -> RootedValue

    RootedValue::i32

    fn RootedValue::i32(value : Int) -> RootedValue

    RootedValue::i64

    fn RootedValue::i64(value : Int64) -> RootedValue

    RootedValue::null

    fn RootedValue::null() -> RootedValue

    RootedValue::scalar

    Read a scalar without exposing Store-local reference indices.

    RootedValue::v128

    fn RootedValue::v128(bytes : Bytes) -> RootedValue raise RuntimeError

    RuntimeCapabilities

    pub struct RuntimeCapabilities {
    version : String
    interpreter : Bool
    jit : Bool
    simd : Bool
    relaxed_simd : Bool
    reference_types : Bool
    function_references : Bool
    tail_call : Bool
    exception_handling : Bool
    gc : Bool
    memory64 : Bool
    multi_memory : Bool
    component_model : Bool
    wasi_preview1 : Bool
    threads : Bool
    }

    Structured capability snapshot.

    RuntimeErrorContext

    pub struct RuntimeErrorContext {
    error : RuntimeError
    call_stack : Array[CallStackEntry]
    instruction : String?
    func_idx : Int?
    }

    Runtime error with additional context for debugging

    RuntimeErrorContext::RuntimeErrorContext

    fn RuntimeErrorContext::RuntimeErrorContext(error : RuntimeError) -> RuntimeErrorContext

    RuntimeErrorContext::format

    fn RuntimeErrorContext::format(self : RuntimeErrorContext) -> String

    Format the runtime error with full context for display

    RuntimeErrorContext::output

    fn RuntimeErrorContext::output(self : RuntimeErrorContext, logger : &Logger) -> Unit

    RuntimeErrorContext::to_string

    fn RuntimeErrorContext::to_string(self : RuntimeErrorContext) -> String

    RuntimeErrorContext::with_call_stack

    RuntimeErrorContext::with_func_idx

    fn RuntimeErrorContext::with_func_idx(self : RuntimeErrorContext, idx : Int) -> RuntimeErrorContext

    RuntimeErrorContext::with_instruction

    fn RuntimeErrorContext::with_instruction(self : RuntimeErrorContext, instr : String) -> RuntimeErrorContext

    RuntimeFeature

    pub(all) enum RuntimeFeature {
    Interpreter
    JIT
    SIMD
    RelaxedSIMD
    ReferenceTypes
    FunctionReferences
    TailCall
    ExceptionHandling
    GC
    Memory64
    MultiMemory
    ComponentModel
    WasiPreview1
    Threads
    }

    Capability key for generic feature checks.

    Stack

    @types.Value stack for operands

    Stack::Stack

    fn Stack::Stack(max_values? : Int) -> Stack

    Stack::active_values

    Snapshot currently live stack values [0, sp)

    Stack::clear

    fn Stack::clear(self : Stack) -> Unit

    Stack::pop_f32

    fn Stack::pop_f32(self : Stack) -> Float raise RuntimeError

    Stack::pop_f64

    fn Stack::pop_f64(self : Stack) -> Double raise RuntimeError

    Stack::pop_i32

    fn Stack::pop_i32(self : Stack) -> Int raise RuntimeError

    Stack::pop_i64

    fn Stack::pop_i64(self : Stack) -> Int64 raise RuntimeError

    Stack::pop_n

    Pop n values from the stack, returning them in order (first popped is last in array)

    Stack::pop_v128

    fn Stack::pop_v128(self : Stack) -> Bytes raise RuntimeError

    Stack::push

    fn Stack::push(self : Stack, value :
    Value
    ) -> Unit raise RuntimeError

    Stack::push_v128

    fn Stack::push_v128(self : Stack, v : Bytes) -> Unit raise RuntimeError

    Stack::release

    fn Stack::release(self : Stack, count : Int) -> Unit

    Stack::reserve

    fn Stack::reserve(self : Stack, count : Int) -> Unit raise RuntimeError

    Count frame locals against the same budget as live operand slots.

    Stack::size

    fn Stack::size(self : Stack) -> Int

    Stack::to_repr

    Store

    pub struct Store {
    nan_canonicalization : Bool
    interpreter_limits : InterpreterLimits
    resource_budget : ResourceBudget?
    native_execution :
    NativeExecutionState

    // private fields
    } derive(
    Debug
    )

    The store contains all global runtime state

    Store::Store

    fn Store::Store(nan_canonicalization? : Bool, interpreter_limits? : InterpreterLimits, resource_budget? : ResourceBudget?) -> Store raise RuntimeError

    Store::admit_module_work

    fn Store::admit_module_work(self : Store, module_ :
    Module
    ) -> ResourceLease? raise RuntimeError

    Temporarily admit validation or compilation of a caller-owned AST.

    Store::alloc_array

    fn Store::alloc_array(self : Store, type_idx : Int, elements : Array[
    Value
    ], instance? : ModuleInstance) -> Int raise RuntimeError

    Allocate an array instance and return its reference index

    Store::alloc_array_repeated

    fn Store::alloc_array_repeated(self : Store, type_idx : Int, length : Int, value :
    Value
    , instance? : ModuleInstance) -> Int raise RuntimeError

    Allocate a repeated array without constructing an unadmitted temporary array.

    Store::alloc_async_host_func

    fn Store::alloc_async_host_func(self : Store, func : async (Array[
    Value
    ]) -> Array[
    Value
    ], func_type? :
    FuncType
    , type_idx? : Int) -> Int raise RuntimeError

    Allocate an asynchronous host function with its type.

    Store::alloc_async_host_func_with_caller

    fn Store::alloc_async_host_func_with_caller(self : Store, func : async (Caller, Array[
    Value
    ]) -> Array[
    Value
    ], func_type? :
    FuncType
    , type_idx? : Int) -> Int raise RuntimeError

    Allocate an asynchronous host function that receives the caller context.

    Store::alloc_exn

    fn Store::alloc_exn(self : Store, tag_addr : Int, values : Array[
    Value
    ]) -> Int raise RuntimeError

    Allocate an exception instance and return its index

    Store::alloc_func

    fn Store::alloc_func(self : Store, module_ :
    ValidatedModule
    , index : Int) -> Int raise RuntimeError

    Allocate a WASM function with its type

    Store::alloc_global

    fn Store::alloc_global(self : Store, global : GlobalInstance) -> Int raise RuntimeError

    Store::alloc_host_func

    Allocate a host function with its type

    Store::alloc_host_func_with_caller

    fn Store::alloc_host_func_with_caller(self : Store, func : (Caller, Array[
    Value
    ]) -> Array[
    Value
    ] raise RuntimeError, func_type? :
    FuncType
    , type_idx? : Int) -> Int raise RuntimeError

    Allocate a host function that receives the caller context.

    Store::alloc_mem

    fn Store::alloc_mem(self : Store, mem : Memory) -> Int raise RuntimeError

    Store::alloc_shared_mem

    fn Store::alloc_shared_mem(self : Store, memory : Memory) -> Int raise RuntimeError

    Import shared memory with ownership independent of the source Store. Closing either Store invalidates only its own Memory handle.

    Store::alloc_struct

    fn Store::alloc_struct(self : Store, type_idx : Int, fields : Array[
    Value
    ], instance? : ModuleInstance) -> Int raise RuntimeError

    Allocate a struct instance and return its reference index

    Store::alloc_table

    fn Store::alloc_table(self : Store, table : Table, use_jit? : Bool) -> Int raise RuntimeError

    Allocate a table in the store Always creates a corresponding JIT table for cross-module sharing

    Store::alloc_tag

    fn Store::alloc_tag(self : Store, tag_type :
    FuncType
    , type_idx? : Int) -> Int raise RuntimeError

    Allocate a tag with its type (params from FuncType, results ignored)

    Store::array_copy

    fn Store::array_copy(self : Store, dst_idx : Int, dst_offset : Int, src_idx : Int, src_offset : Int, count : Int) -> Unit raise RuntimeError

    Copy elements between arrays

    Store::array_fill

    fn Store::array_fill(self : Store, array_idx : Int, offset : Int, value :
    Value
    , count : Int) -> Unit raise RuntimeError

    Fill array elements with a value

    Store::array_get

    fn Store::array_get(self : Store, array_idx : Int, elem_idx : Int) ->
    Value
    raise RuntimeError

    Get an array element value

    Store::array_len

    fn Store::array_len(self : Store, array_idx : Int) -> Int raise RuntimeError

    Get array length

    Store::array_set

    fn Store::array_set(self : Store, array_idx : Int, elem_idx : Int, value :
    Value
    ) -> Unit raise RuntimeError

    Set an array element value

    Store::begin_gc_tracing

    fn Store::begin_gc_tracing(self : Store) -> Unit

    Install the Store visitor only while native execution or a collection needs it. A permanent native closure would create a Store/heap reference cycle.

    Store::bind_native_callable_view

    fn Store::bind_native_callable_view(self : Store, refresh : (Array[Int], Array[(Int64, Int)]) -> Unit) -> Unit

    Publish the complete Store type universe to all installed callable contexts.

    Store::borrow_rooted_value

    fn Store::borrow_rooted_value(self : Store, value : RootedValue) ->
    Value
    raise RuntimeError

    Low-level execution bridge. Checks provenance and lease before revealing an index.

    Store::borrow_typed_rooted_value

    fn Store::borrow_typed_rooted_value(self : Store, value : RootedValue, instance : ModuleInstance, expected :
    ValueType
    ) ->
    Value
    raise RuntimeError

    Validate typed continuation transfer as well as Store/root identity.

    Store::check_instance

    fn Store::check_instance(self : Store, instance : ModuleInstance) -> Unit raise RuntimeError

    Store::check_instance_admission

    fn Store::check_instance_admission(self : Store, admission : InstanceAdmission, validated? :
    ValidatedModule
    ) -> Unit raise RuntimeError

    Store::close

    fn Store::close(self : Store) -> Unit

    Release resources owned by this store and break host-function reference cycles.

    This operation is idempotent and terminal. Every native invocation must have returned or been cancelled before the store is closed.

    Store::collect_garbage

    fn Store::collect_garbage(self : Store, additional_roots? : Array[
    Value
    ]) -> Int

    Reclaim unreachable objects and temporary reference handles. Host Values held outside guest execution must be pinned or supplied here.

    Store::collect_roots

    Collect the transitive object roots of this Store and explicit host roots.

    Store::counts

    fn Store::counts(self : Store) -> StoreCounts

    Store::current_types

    Store::decode_module

    fn Store::decode_module(self : Store, bytes : Bytes) ->
    Module
    raise

    Bound binary decoding before expanded locals/type vectors are allocated. The returned AST belongs to the caller; its lifetime is not charged to the Store. Instantiation separately admits and retains its compilation units.

    Store::decode_native_exception

    fn Store::decode_native_exception(self : Store, reference : Int64) ->
    Value
    raise RuntimeError

    Store::enable_c_heap

    fn Store::enable_c_heap(self : Store) -> Unit raise RuntimeError

    Enable C heap for this store

    Store::encode_native_exception

    fn Store::encode_native_exception(self : Store, index : Int) -> Int64 raise RuntimeError

    Store::end_gc_tracing

    fn Store::end_gc_tracing(self : Store) -> Unit

    Balance begin_gc_tracing even when native execution traps or suspends.

    Store::enter_interpreter_boundary

    fn Store::enter_interpreter_boundary(self : Store) -> Unit raise RuntimeError

    Reserve a native callback boundary before entering host or continuation code.

    Store::execution_scope

    fn Store::execution_scope(self : Store) -> ExecutionScope?

    Store::func_type_is_subtype

    fn Store::func_type_is_subtype(self : Store, address : Int, instance : ModuleInstance, expected : Int) -> Bool

    Store::function_identity

    fn Store::function_identity(self : Store, address : Int) -> FunctionIdentity raise RuntimeError

    Low-level handle support: retain an allocation's identity without its closure.

    Store::gc_type_is_subtype

    fn Store::gc_type_is_subtype(self : Store, reference : Int, instance : ModuleInstance, expected : Int) -> Bool

    Store::get_c_heap_ptr

    Get the C heap pointer (for JIT)

    Store::get_exn

    fn Store::get_exn(self : Store, idx : Int) -> ExnInstance raise RuntimeError

    Get an exception instance by index

    Store::get_func

    Get function code for a store address that is known to refer to a Wasm function.

    Store::get_func_canonical_type_idx

    fn Store::get_func_canonical_type_idx(self : Store, func_addr : Int) -> Int

    Get canonical type index for a function by store address Returns the canonical type index from the function's owning module Returns -1 if the function or owner is not found

    Store::get_func_inst

    fn Store::get_func_inst(self : Store, idx : Int) -> FuncInst raise RuntimeError

    Store::get_func_inst_opt

    fn Store::get_func_inst_opt(self : Store, idx : Int) -> FuncInst?

    Get function instance by store address (returns None if out of range).

    This is useful for embedding/JIT callbacks that must not raise.

    Store::get_func_owner

    fn Store::get_func_owner(self : Store, func_addr : Int) -> ModuleInstance?

    Get the owning module instance for a function address

    Store::get_func_owner_idx

    fn Store::get_func_owner_idx(self : Store, func_addr : Int) -> Int

    Get the owning module instance index for a function address Returns -1 if no owner (host function or unowned)

    Store::get_func_type

    fn Store::get_func_type(self : Store, idx : Int) ->
    FuncType
    raise RuntimeError

    Get function type by store address

    Store::get_func_type_idx

    fn Store::get_func_type_idx(self : Store, idx : Int) -> Int

    Get function type index by store address (for structural comparison)

    Store::get_func_type_opt

    fn Store::get_func_type_opt(self : Store, idx : Int) ->
    FuncType
    ?

    Get function type by store address (returns None if out of range).

    This is useful for embedding/JIT callbacks that must not raise.

    Store::get_gc_stats

    fn Store::get_gc_stats(self : Store) -> (Int64, Int64, Int, Int, Int)

    Get GC statistics for the C heap Returns (size, capacity, object_count, total_allocations, total_collections) or (0, 0, 0, 0, 0) if no C heap is enabled

    Store::get_gc_type_idx

    fn Store::get_gc_type_idx(self : Store, idx : Int) -> Int raise RuntimeError

    Get the type index of a GC object

    Store::get_global

    fn Store::get_global(self : Store, idx : Int) -> GlobalInstance raise RuntimeError

    Store::get_instance

    fn Store::get_instance(self : Store, index : Int) -> ModuleInstance raise RuntimeError

    Store::get_jit_table

    Get the JIT table corresponding to a runtime table (if exists)

    Store::get_mem

    fn Store::get_mem(self : Store, idx : Int) -> Memory raise RuntimeError

    Store::get_memory

    fn Store::get_memory(self : Store, idx : Int) -> Memory raise RuntimeError

    Get memory by index, rejecting missing memories without fabricating a handle.

    Store::get_table

    fn Store::get_table(self : Store, idx : Int) -> Table raise RuntimeError

    Store::get_tag_owner

    fn Store::get_tag_owner(self : Store, tag_addr : Int) -> ModuleInstance?

    Get the owner module for a tag

    Store::get_tag_type

    fn Store::get_tag_type(self : Store, idx : Int) ->
    FuncType
    raise RuntimeError

    Store::get_tag_type_idx

    fn Store::get_tag_type_idx(self : Store, tag_addr : Int) -> Int

    Get the original type index for a tag

    Store::get_wasi_ctx_handle

    fn Store::get_wasi_ctx_handle(self : Store) -> Int

    Get the WASI context handle (for WAST runner to retrieve WASI context)

    Store::get_wasi_memory

    fn Store::get_wasi_memory(self : Store) -> Memory raise RuntimeError

    Get WASI module's memory Uses the stored wasi_mem_addr if set, otherwise falls back to index 0

    Store::has_c_heap

    fn Store::has_c_heap(self : Store) -> Bool

    Check if C heap is enabled

    Store::has_guest_continuation

    fn Store::has_guest_continuation(self : Store, handle : Int64) -> Bool

    Store::host_call_instance

    fn Store::host_call_instance(self : Store, address : Int) -> ModuleInstance raise RuntimeError

    Construct a Store-owned call context for an existing host function.

    Store::host_exports

    fn Store::host_exports(self : Store, exports : ArrayView[(String, ExternVal)]) -> ModuleInstance raise RuntimeError

    Publish a checked namespace of host exports in this Store.

    Store::identity

    fn Store::identity(self : Store) -> StoreIdentity

    Store::in_execution_scope

    fn[T, E : Error] Store::in_execution_scope(self : Store, captured : ExecutionScope?, run : () -> T raise E) -> T raise E

    Drive captured work without resetting its limits. Any currently active parent policy is also applied, with each shared controller charged once.

    Store::is_closed

    fn Store::is_closed(self : Store) -> Bool

    Store::is_gc_valid

    fn Store::is_gc_valid(self : Store, idx : Int) -> Bool

    Check if a GC object reference is valid

    Store::jit_funcref_entries

    fn Store::jit_funcref_entries(self : Store) -> Array[StoreFuncrefEntry]

    Store::leave_interpreter_boundary

    fn Store::leave_interpreter_boundary(self : Store) -> Unit

    Store::lookup_jit_funcref_ptr

    fn Store::lookup_jit_funcref_ptr(self : Store, store_addr : Int) -> Int64?

    Store::lookup_jit_funcref_store_addr

    fn Store::lookup_jit_funcref_store_addr(self : Store, func_ptr : Int64) -> Int?

    Store::maybe_collect

    fn Store::maybe_collect(self : Store, additional_roots? : Array[
    Value
    ], threshold? : Double) -> Int

    Perform garbage collection if heap usage exceeds the threshold Returns the number of objects collected, or 0 if GC was not triggered

    Store::native_callable_registry

    Share Store-wide callable identities while each context owns its local maps. Returns None after the Store is closed.

    Store::native_execution_state

    Return the Store-owned native invocation registry.

    Store::native_heap

    Native integration capability; not part of the portable embedding interface.

    Store::native_type_indices

    fn Store::native_type_indices(self : Store, instance : ModuleInstance) -> Array[Int]

    Store::native_type_parents

    fn Store::native_type_parents(self : Store) -> Array[Int]

    Store::new_instance

    fn Store::new_instance(self : Store, validated :
    ValidatedModule
    , func_addrs~ : ArrayView[Int], table_addrs~ : ArrayView[Int], mem_addrs~ : ArrayView[Int], global_addrs~ : ArrayView[Int], tag_addrs~ : ArrayView[Int], elem_values~ : Array[Array[
    Value
    ]], admission? : InstanceAdmission) -> ModuleInstance raise RuntimeError

    Publish a validated module's address maps into this Store. Addresses are Store-local low-level integration indices, checked before publication.

    Store::pin_gc_roots

    fn Store::pin_gc_roots(self : Store, values : Array[
    Value
    ]) -> GcRootLease raise RuntimeError

    Store::publish_core_instance

    fn Store::publish_core_instance(self : Store) -> Unit

    Core segment/start traps preserve prior writes to imported resources. Once an instance can escape through those writes, keep its addresses and budget alive. An enclosing Component transaction keeps its own commit boundary.

    Store::put_guest_continuation

    fn Store::put_guest_continuation(self : Store, body : GuestContinuationBody) -> Int64 raise RuntimeError

    Store::register_instance

    fn Store::register_instance(self : Store, instance : ModuleInstance, admission? : InstanceAdmission) -> Int raise RuntimeError

    Register a module instance and set ownership for its functions Only sets ownership for functions that don't already have an owner (imported functions already belong to their original module)

    Store::register_jit_funcrefs

    fn Store::register_jit_funcrefs(self : Store, entries : Array[StoreFuncrefEntry], release_owner? : () -> Unit) -> StoreFuncrefRegistration

    Store::register_suspended_execution

    fn Store::register_suspended_execution(self : Store, cancel : () -> Unit) -> Int64 raise RuntimeError

    Register parked execution for cancellation on terminal Store close. The executor removes this registration before resuming or cancelling it.

    Store::release_suspended_execution

    fn Store::release_suspended_execution(self : Store, id : Int64) -> Unit

    Detach parked execution before running any of its cleanup callbacks.

    Store::reserve_gc_array_work

    fn Store::reserve_gc_array_work(self : Store, length : Int) -> (ResourceLease, ResourceLease)? raise RuntimeError

    Admit the temporary representation before decoding/copying an array payload. Release immediately before handing that payload to the heap allocator, which performs the final admission. This bounds staging work, not process RSS.

    Store::reserve_instance

    fn Store::reserve_instance(self : Store, module_? :
    Module
    ) -> InstanceAdmission raise RuntimeError

    Store::reserve_retained_resource

    fn Store::reserve_retained_resource(self : Store, kind : ResourceKind, amount : Int64) -> Unit raise RuntimeError

    Admit Store-owned metadata. A failed instantiation returns its reservations through the current transaction; committed metadata stays charged until close.

    Store::root_raw_value

    fn Store::root_raw_value(self : Store, value :
    Value
    ) -> RootedValue raise RuntimeError

    Low-level bridge from Store-local raw values. Raw reference indices must originate in this Store; portable clients should use executor.Function results.

    Store::root_result_value

    Low-level result bridge: the caller guarantees the declared result contract.

    Store::set_module_types

    fn Store::set_module_types(self : Store, types : Array[
    SubType
    ], rec_groups? : Array[Int]) -> Unit raise RuntimeError

    Set module types and rec groups (needed for CHeap type lookups and canonical indices)

    Store::set_wasi_ctx_handle

    fn Store::set_wasi_ctx_handle(self : Store, handle : Int) -> Unit raise RuntimeError

    Set the WASI context handle (for WAST runner to store WASI context)

    Store::set_wasi_mem_addr

    fn Store::set_wasi_mem_addr(self : Store, addr : Int) -> Unit raise RuntimeError

    Set the current WASI module's memory address Should be called after instantiating a module that uses WASI

    Store::should_collect

    fn Store::should_collect(self : Store, threshold? : Double) -> Bool

    Check if GC should be triggered based on heap usage Returns true if heap usage exceeds the threshold (default 75%)

    Store::struct_get

    fn Store::struct_get(self : Store, struct_idx : Int, field_idx : Int) ->
    Value
    raise RuntimeError

    Get a struct field value

    Store::struct_set

    fn Store::struct_set(self : Store, struct_idx : Int, field_idx : Int, value :
    Value
    ) -> Unit raise RuntimeError

    Set a struct field value

    Store::take_guest_continuation

    fn Store::take_guest_continuation(self : Store, handle : Int64) -> GuestContinuationBody raise RuntimeError

    Consume before executing or rebinding. Handles are never reused in a Store. The returned body owns its roots until run or cancel; the caller must finish one of those operations, or transfer its leases to a rebound body.

    Store::to_repr

    Store::unwrap_extern

    Unwrap an externref back to its internal value For host externrefs (positive index), returns the ExternRef unchanged For wrapped internals (negative index), returns the original value

    Store::with_async_instantiation

    async fn[T, E : Error] Store::with_async_instantiation(self : Store, run : async () -> T raise E) -> T raise E

    Store::with_c_heap

    fn Store::with_c_heap(nan_canonicalization? : Bool, interpreter_limits? : InterpreterLimits, resource_budget? : ResourceBudget?) -> Store raise RuntimeError

    Create a store with C heap enabled (for JIT mode)

    Store::with_execution_limits

    fn[T] Store::with_execution_limits(self : Store, run : () -> T raise, timeout_ms? : Int?, safepoints? : Int64?, cancel? : () -> Bool?) -> T raise

    Bound a group of calls and any continuations they publish. Safepoint units count cooperative polls, not Wasm instructions or equivalent engine fuel. Blocking synchronous host callbacks are checked after returning, not interrupted.

    Store::with_instantiation

    fn[T, E : Error] Store::with_instantiation(self : Store, run : () -> T raise E) -> T raise E

    Join an enclosing component transaction, or own rollback for a Core entry.

    Store::wrap_as_extern

    Wrap an internal GC value as an externref Returns ExternRef with negative index pointing to wrapped_externs

    StoreCounts

    pub struct StoreCounts {
    funcs : Int
    func_types : Int
    func_type_indices : Int
    tables : Int
    mems : Int
    globals : Int
    tags : Int
    tag_type_indices : Int
    tag_owners : Int
    exns : Int
    wrapped_externs : Int
    func_owners : Int
    instances : Int
    jit_tables : Int
    heap_slots : Int
    heap_live : Int
    wrapped_extern_capacity : Int
    } derive(
    Debug
    )

    Read-only diagnostic counts; no mutable backing storage is exposed.

    StoreFuncrefEntry

    pub struct StoreFuncrefEntry {
    store_addr : Int
    func_ptr : Int64
    } derive(Eq,
    Debug
    )

    One Store-local function address and its native executable pointer.

    StoreFuncrefEntry::StoreFuncrefEntry

    fn StoreFuncrefEntry::StoreFuncrefEntry(store_addr~ : Int, func_ptr~ : Int64) -> StoreFuncrefEntry

    StoreFuncrefEntry::equal

    StoreFuncrefEntry::not_equal

    fn StoreFuncrefEntry::not_equal(x : StoreFuncrefEntry, y : StoreFuncrefEntry) -> Bool

    StoreFuncrefRegistration

    type StoreFuncrefRegistration

    StoreFuncrefRegistration::release

    StoreIdentity

    pub struct StoreIdentity {
    // private fields
    }

    Opaque Store identity. Holding this token does not keep the Store alive.

    StoreIdentity::matches

    fn StoreIdentity::matches(self : StoreIdentity, store : Store) -> Bool

    StructInstance

    pub(all) struct StructInstance {
    type_idx : Int
    fields : Array[
    Value
    ]
    } derive(
    Debug
    )

    Struct instance - stores field values

    StructInstance::output

    fn StructInstance::output(self : StructInstance, logger : &Logger) -> Unit

    StructInstance::to_string

    fn StructInstance::to_string(self : StructInstance) -> String

    Table

    WebAssembly table with target-specific backing storage

    Table::Table

    fn Table::Table(elem_type :
    ValueType
    , min : Int, max : Int?, init_value? :
    Value
    , is_table64? : Bool, resource_budget? : ResourceBudget?) -> Table raise RuntimeError

    Table::close

    fn Table::close(self : Table) -> Unit

    Table::copy_from

    fn Table::copy_from(self : Table, dest : Int, src_table : Table, src : Int, n : Int) -> Unit raise RuntimeError

    Table::copy_from_at

    fn Table::copy_from_at(self : Table, dest : Int64, src_table : Table, src : Int64, n : Int64) -> Unit raise RuntimeError

    Table::fill

    fn Table::fill(self : Table, dest : Int, value :
    Value
    , n : Int) -> Unit raise RuntimeError

    Fill a range of table elements with a value table.fill: fill table[d..d+n] with value

    Table::fill_at

    fn Table::fill_at(self : Table, dest : Int64, value :
    Value
    , n : Int64) -> Unit raise RuntimeError

    Table::from_type

    Allocate a module table without narrowing its declared limits.

    Table::get

    Table::get_at

    fn Table::get_at(self : Table, idx : Int64) ->
    Value
    raise RuntimeError

    Table::get_elem_type

    Get element type for type checking

    Table::get_limits

    fn Table::get_limits(self : Table) -> (Int, Int?)

    Get table limits (min, max) for type checking

    Table::get_limits64

    fn Table::get_limits64(self : Table) -> (Int64, Int64?)

    Full declared limits for import compatibility and native growth checks.

    Table::grow

    fn Table::grow(self : Table, delta : Int, init :
    Value
    ) -> Int

    Table::grow64

    fn Table::grow64(self : Table, delta : Int64, init :
    Value
    ) -> Int64 raise RuntimeError

    Grow using an unsigned table64 count, preserving allocation failures.

    Table::is_table64

    fn Table::is_table64(self : Table) -> Bool

    Check if this is a table64 (i64-indexed table)

    Table::set

    fn Table::set(self : Table, idx : Int, value :
    Value
    ) -> Unit raise RuntimeError

    Table::set_at

    fn Table::set_at(self : Table, idx : Int64, value :
    Value
    ) -> Unit raise RuntimeError

    Table::size

    fn Table::size(self : Table) -> Int

    Table::to_repr

    atomic_fence

    fn atomic_fence() -> Unit

    format_runtime_error

    fn format_runtime_error(error : RuntimeError) -> String

    Format a basic RuntimeError without context

    normalize_async_host_error

    fn normalize_async_host_error(error : Error) -> RuntimeError

    runtime_capabilities

    fn runtime_capabilities() -> RuntimeCapabilities

    Structured capability query.

    runtime_version

    fn runtime_version() -> String

    Query runtime version.

    supports_component_model

    fn supports_component_model() -> Bool

    supports_exception_handling

    fn supports_exception_handling() -> Bool

    supports_feature

    fn supports_feature(feature : RuntimeFeature) -> Bool

    Generic capability query.

    supports_function_references

    fn supports_function_references() -> Bool

    supports_gc

    fn supports_gc() -> Bool

    supports_interpreter

    fn supports_interpreter() -> Bool

    supports_jit

    fn supports_jit() -> Bool

    supports_memory64

    fn supports_memory64() -> Bool

    supports_multi_memory

    fn supports_multi_memory() -> Bool

    supports_reference_types

    fn supports_reference_types() -> Bool

    supports_relaxed_simd

    fn supports_relaxed_simd() -> Bool

    supports_simd

    fn supports_simd() -> Bool

    supports_tail_call

    fn supports_tail_call() -> Bool

    supports_threads

    fn supports_threads() -> Bool

    supports_wasi_preview1

    fn supports_wasi_preview1() -> Bool

    with_async_host_call_driver

    async fn[X] with_async_host_call_driver(body : async (AsyncHostCallDriver) -> X) -> X

    Run one asynchronous Wasm invocation with structured ownership of every host task it starts.