GcRefStore

open class GcRefStore(instance: Instance)

Store for GC-managed references keyed by auto-assigned integers.

Uses epoch-based deferred collection: refs are never swept during wasm execution. Collection only happens at safe points between top-level calls when the wasm operand stack and all call frames are empty. At that point the only roots are globals and tables.

Constructors

Link copied to clipboard
constructor(instance: Instance)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
operator fun get(key: Int): WasmGcRef?

Retrieves a value by key, or null if missing.

Link copied to clipboard
Link copied to clipboard
fun put(value: WasmGcRef): Int

Inserts a value with an automatically assigned key.

Link copied to clipboard
fun safePoint()

Called at safe points (between top-level calls).