WebAssembly 3.0 also improves garbage collection in the WasmGC extension. In addition to expanding the capabilities of raw linear memories, support was added for a new form of storage that is managed by the Wasm runtime automatically. WasmGC is low-level; a compiler targeting Wasm can declare the memory layout of its runtime data structures in terms of struct and array types, plus unboxed tagged integers, whose allocation and lifetime are then handled by Wasm. The WasmGC extension, which is built upon a substantial extension to the Wasm type system, also now supports much richer type references.
In the realm of memory, a single module now can declare multiple memories and directly access them, including copying data between them. This improvement allows tools like wasm-merge
, which perform “static linking” on two or more Wasm modules by merging them into one, to work for all Wasm modules. It also paves the way for new uses of separate address spaces; examples provided were for security (separating private data), buffering, or instrumentation.
Wasm 3.0 already is shipping in most major web browsers, and support in standalone engines like Wasmtime is on track to completion, said proponents. Other improvements include: