Trait wasmtime_runtime::GcRuntime
source · pub unsafe trait GcRuntime: 'static + Send + Sync {
// Required method
fn new_gc_heap(&self) -> Result<Box<dyn GcHeap>>;
}
Expand description
Trait for integrating a garbage collector with the runtime.
This trait is responsible for:
-
GC barriers used by runtime code (as opposed to compiled Wasm code)
-
Creating and managing GC heaps for individual stores
-
Running garbage collection
§Safety
The collector, its GC heaps, and GC barriers when taken together as a whole
must be safe. Additionally, they must work with the GC barriers emitted into
compiled Wasm code via the collector’s corresponding GcCompiler
implementation. That is, if callers only call safe methods on this trait
(while pairing it with its associated GcCompiler
, GcHeap
, and etc…)
and uphold all the documented safety invariants of this trait’s unsafe
methods, then it must be impossible for callers to violate memory
safety. Implementations of this trait may not add new safety invariants, not
already documented in this trait’s interface, that callers need to uphold.
Required Methods§
sourcefn new_gc_heap(&self) -> Result<Box<dyn GcHeap>>
fn new_gc_heap(&self) -> Result<Box<dyn GcHeap>>
Construct a new GC heap.