Sign in

    Milky2018/wasmoon_runtime/native/ffi does not have a README file

    ContextLayout

    Immutable layout retained by a loaded module and shared by its instances.

    NativeCallableRegistry

    Store-local callable identities, built and owned by MoonBit.

    GCMetadataError

    pub suberror GCMetadataError {
    InvalidTypeStride
    PayloadCountMismatch
    PayloadTooLarge
    } derive(
    Debug
    )

    Invalid native metadata must be rejected before publishing any pointers.

    GCMetadataError::output

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

    GCMetadataError::to_string

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

    NativeAllocationError

    pub(all) suberror NativeAllocationError {
    OutOfMemory
    } derive(
    Debug
    )

    A native owner could not allocate its backing state.

    NativeAllocationError::output

    fn NativeAllocationError::output(_self : NativeAllocationError, logger : &Logger) -> Unit

    NativeAllocationError::to_string

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

    CleanupOwner

    pub type CleanupOwner

    A managed cleanup callback. The finalizer calls and releases its closure exactly once; close performs the same cleanup early. The callback must not raise.

    CleanupOwner::close

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

    CleanupOwner::new

    fn CleanupOwner::new(action : () -> Unit) -> CleanupOwner

    ExecCodeHandle

    type ExecCodeHandle

    ExecCodeHandle::bind_reservation

    fn ExecCodeHandle::bind_reservation(self : ExecCodeHandle, reservation : Reservation) -> Bool

    GCHeapHandle

    pub type GCHeapHandle

    Shared managed GC heap. Contexts and parked root registrations retain it.

    GCHeapHandle::bind_reservations

    fn GCHeapHandle::bind_reservations(self : GCHeapHandle, bytes : Reservation, objects : Reservation) -> Bool

    GCHeapHandle::bind_root_visitor

    fn GCHeapHandle::bind_root_visitor(self : GCHeapHandle, visitor : (Int, FixedArray[Int64]) -> FixedArray[Int64]) -> Unit

    GCHeapHandle::clear_root_visitor

    fn GCHeapHandle::clear_root_visitor(self : GCHeapHandle) -> Unit

    GCHeapHandle::execution_roots

    fn GCHeapHandle::execution_roots(self : GCHeapHandle) -> FixedArray[Int64]

    Snapshot active and parked native execution roots without collecting. A single -2 word reports that a complete snapshot was unavailable.

    GCHeapHandle::is_null

    fn GCHeapHandle::is_null(self : GCHeapHandle) -> Bool

    GCHeapHandle::new

    fn GCHeapHandle::new(capacity : Int64) -> GCHeapHandle

    Create a managed heap with the closed native allocation policy installed.

    GCHeapHandle::null

    GCHeapHandle::quota_denied

    fn GCHeapHandle::quota_denied(self : GCHeapHandle) -> Int

    GCHeapHandle::reference_candidates

    fn GCHeapHandle::reference_candidates(self : GCHeapHandle, reference : Int) -> FixedArray[Int64]

    GCHeapHandle::to_repr

    JITContext

    pub type JITContext

    Managed native context. Its finalizer releases retained native views and arrays.

    JITContext::bind_callable_registry

    fn JITContext::bind_callable_registry(self : JITContext, registry :
    NativeCallableRegistry
    , locals : FixedArray[Int], tags : FixedArray[Int], functions? : FixedArray[Int]) -> Unit

    Retain the shared view and per-instance mappings without copying their storage. Callers must not mutate these mappings during guest execution.

    JITContext::bind_continuation_arena

    fn JITContext::bind_continuation_arena(self : JITContext, arena : NativeContinuationArena) -> Unit

    JITContext::bind_exception_arena

    fn JITContext::bind_exception_arena(self : JITContext, arena : NativeExceptionArena) -> Unit

    Bind a shared exception registry; contexts retain its native callback view.

    JITContext::bind_gc_function_addresses

    fn JITContext::bind_gc_function_addresses(self : JITContext, addresses : FixedArray[Int64]) -> Unit

    Retain a function-address snapshot. The snapshot does not own executable code. Bind outside execution and do not mutate the array while it is bound.

    JITContext::bind_gc_metadata

    fn JITContext::bind_gc_metadata(self : JITContext, types : FixedArray[Int], canonical : FixedArray[Int], functions : FixedArray[Int]) -> Unit raise GCMetadataError

    Retain all three GC metadata arrays, replacing even empty mappings. Types use six Int slots per entry, matching the native GC type-cache ABI. Bind outside guest execution and do not mutate arrays while they are bound.

    JITContext::bind_gc_safepoints

    fn JITContext::bind_gc_safepoints(self : JITContext, function : Int, blob : Bytes, offsets : FixedArray[Int]) -> Bool

    Retain the payloads in a stable native descriptor. Bind outside execution; callers must not mutate offsets while they are bound.

    JITContext::bind_globals

    fn JITContext::bind_globals(self : JITContext, globals : FixedArray[Int64]) -> Int64

    JITContext::bind_prepared_safepoints

    fn JITContext::bind_prepared_safepoints(self : JITContext, prepared : PreparedSafepoints) -> Bool

    Bind outside execution. The context retains the owner independently of callers.

    JITContext::bind_segment_drop_flags

    fn JITContext::bind_segment_drop_flags(self : JITContext, data : FixedArray[Bool], elements : FixedArray[Bool]) -> Unit

    JITContext::define_continuation_type

    fn JITContext::define_continuation_type(self : JITContext, index : Int, trampoline : Int64, params : Int, results : Int, roots : FixedArray[Int]) -> Bool

    JITContext::new

    fn JITContext::new(func_count : Int) -> JITContext

    JITContext::new_shaped

    JITContext::set_segments

    fn JITContext::set_segments(self : JITContext, data : Array[Bytes], elements : Array[Array[Int64]]) -> Bool

    Replace instance segments outside guest execution. Empty payloads represent dropped segments. Snapshot mutable arrays so guest drop is instance-local; immutable data Bytes are shared. Elements are encoded as (value, type) pairs.

    JITContext::snapshot_gc_function_addresses

    fn JITContext::snapshot_gc_function_addresses(self : JITContext, table : Int64, count : Int) -> Unit

    Copy a legacy native pointer table into a typed snapshot and bind it. The source must contain count readable native pointers.

    MemoryDescriptor

    pub type MemoryDescriptor

    Shared managed linear-memory allocation. Each handle keeps the descriptor and its backing memory alive independently of a Store or JIT context.

    MemoryDescriptor::bind_reservation

    fn MemoryDescriptor::bind_reservation(self : MemoryDescriptor, reservation : Reservation) -> Bool

    MemoryDescriptor::equal

    MemoryDescriptor::is_null

    fn MemoryDescriptor::is_null(self : MemoryDescriptor) -> Bool

    MemoryDescriptor::matches_quota

    fn MemoryDescriptor::matches_quota(self : MemoryDescriptor, quota : Quota) -> Int

    MemoryDescriptor::not_equal

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

    MemoryDescriptor::null

    MemoryDescriptor::to_repr

    NativeContinuationArena

    pub struct NativeContinuationArena {
    // private fields
    }

    Store-owned continuation identities. The bridge retains state, while state owns physical storage and never retains the bridge or a native context.

    NativeContinuationArena::bind_quota

    fn NativeContinuationArena::bind_quota(self : NativeContinuationArena, quota : Quota) -> Bool

    NativeContinuationArena::clear

    NativeContinuationArena::gc_roots

    fn NativeContinuationArena::gc_roots(self : NativeContinuationArena, reference : Int64) -> FixedArray[Int64]

    NativeContinuationArena::is_live

    fn NativeContinuationArena::is_live(self : NativeContinuationArena, reference : Int64) -> Bool

    NativeContinuationArena::new

    NativeContinuationArena::reclaim_retired

    fn NativeContinuationArena::reclaim_retired(self : NativeContinuationArena) -> Unit

    NativeExceptionArena

    pub struct NativeExceptionArena {
    // private fields
    }

    Store-owned immutable exception snapshots shared by native instances.

    NativeExceptionArena::bind_quotas

    fn NativeExceptionArena::bind_quotas(self : NativeExceptionArena, bytes : Quota, objects : Quota) -> Bool

    NativeExceptionArena::clear

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

    NativeExceptionArena::define_tag

    Describe reference-bearing payload words; scalar and SIMD words are never retained as accidental GC roots.

    NativeExceptionArena::enable_reclamation

    fn NativeExceptionArena::enable_reclamation(self : NativeExceptionArena) -> Unit

    Store-managed arenas reclaim snapshots through the heap's root visitor.

    NativeExceptionArena::insert

    fn NativeExceptionArena::insert(self : NativeExceptionArena, heap : GCHeapHandle, tag : Int, values : Array[Int64]) -> Int64

    NativeExceptionArena::new

    NativeExceptionArena::quota_denied

    fn NativeExceptionArena::quota_denied(self : NativeExceptionArena) -> Int

    NativeExceptionArena::release_snapshot

    fn NativeExceptionArena::release_snapshot(self : NativeExceptionArena, reference : Int64) -> Unit

    NativeExceptionArena::snapshot

    fn NativeExceptionArena::snapshot(self : NativeExceptionArena, reference : Int64) -> (Int, Array[Int64])?

    NativeTableHandle

    pub type NativeTableHandle

    Managed shared table identity. Native context bindings retain this object.

    NativeTableHandle::bind_reservation

    fn NativeTableHandle::bind_reservation(self : NativeTableHandle, reservation : Reservation) -> Bool

    NativeTableHandle::copy_from

    fn NativeTableHandle::copy_from(self : NativeTableHandle, offset : Int, source : NativeTableHandle, source_offset : Int, length : Int) -> Bool

    NativeTableHandle::fill

    fn NativeTableHandle::fill(self : NativeTableHandle, offset : Int, length : Int, value : Int64, metadata : Int) -> Bool

    NativeTableHandle::grow

    fn NativeTableHandle::grow(self : NativeTableHandle, delta : Int64) -> Int64

    NativeTableHandle::grow_value

    fn NativeTableHandle::grow_value(self : NativeTableHandle, delta : Int64, value : Int64, type_index : Int) -> Int64

    NativeTableHandle::invalidate

    fn NativeTableHandle::invalidate(self : NativeTableHandle) -> Unit

    Close runtime storage through every retained context binding.

    NativeTableHandle::is_null

    fn NativeTableHandle::is_null(self : NativeTableHandle) -> Bool

    NativeTableHandle::null

    NativeTableHandle::revision

    fn NativeTableHandle::revision(self : NativeTableHandle) -> Int64

    Mutation revision of the shared descriptor, including guest writes and growth.

    NativeTableHandle::size

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

    NativeTableHandle::to_repr

    NativeTableHandle::use_store_references

    fn NativeTableHandle::use_store_references(self : NativeTableHandle) -> Unit

    NativeTableHandle::uses_store_references

    fn NativeTableHandle::uses_store_references(self : NativeTableHandle) -> Bool

    NativeTableHandle::word

    fn NativeTableHandle::word(self : NativeTableHandle, index : Int, slot : Int) -> Int64

    PreparedSafepoints

    pub type PreparedSafepoints

    Immutable native views retaining their MoonBit payloads through a finalizer.

    PreparedSafepoints::check_count

    fn PreparedSafepoints::check_count(count : Int) -> Unit raise GCMetadataError

    Check the native descriptor's representable size before allocating arrays.

    PreparedSafepoints::new

    fn PreparedSafepoints::new(blobs : FixedArray[Bytes], offsets : FixedArray[FixedArray[Int]]) -> PreparedSafepoints raise GCMetadataError

    Quota

    pub type Quota

    Native atomic accounting primitive. The embedding layer owns policy and units.

    Quota::new

    fn Quota::new(limit : Int64) -> Quota

    Quota::to_repr

    Quota::used

    fn Quota::used(self : Quota) -> Int64

    Reservation

    pub type Reservation

    An RC-owned reservation; its last reference returns the units to its quota.

    Reservation::close

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

    Reservation::matches

    fn Reservation::matches(self : Reservation, quota : Quota) -> Bool

    Reservation::new

    fn Reservation::new(quota : Quota, amount : Int64) -> Reservation

    Reservation::resize

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

    Reservation::to_repr

    Reservation::valid

    fn Reservation::valid(self : Reservation) -> Bool

    alloc_exec_managed

    fn alloc_exec_managed(code : FixedArray[Byte], size : Int) -> ExecCodeHandle

    exec_code_pointer

    fn exec_code_pointer(exec_code : ExecCodeHandle) -> Int64

    finalize_exec_managed

    fn finalize_exec_managed(exec_code : ExecCodeHandle, code : FixedArray[Byte], size : Int) -> Int

    is_windows

    fn is_windows() -> Bool

    release_exec_managed

    fn release_exec_managed(exec_code : ExecCodeHandle) -> Int

    stage_exec_managed

    fn stage_exec_managed(size : Int) -> ExecCodeHandle