Software Engineering

Wasmtime 47 enables WebAssembly GC and exceptions by default

Key Takeaway

Wasmtime 47 introduces native support for the WebAssembly Garbage Collection and Exceptions proposals, reducing binary size and improving performance for high-level languages.

Summary

The Wasmtime 47 release enables the WebAssembly GC and Exceptions proposals by default. These features allow high-level languages to use the runtime's built-in garbage collector and exception handling instead of embedding custom, heavy implementations. This change aims to make WebAssembly a more efficient target for languages with object-and-reference data models.

Technical details of Wasmtime's GC

  • Uses a Cheney-style semi-space copying collector.
  • The GC heap is implemented using WebAssembly linear memory, using 32-bit indices instead of native pointers for safety and compactness.
  • Allocation is handled via a simple bump pointer within the active semi-space.
  • The implementation avoids read or write barriers.
  • Uses virtual-memory guard pages to eliminate explicit bounds checks.

Why it matters

By supporting these proposals, Wasmtime enables more high-level languages to target WebAssembly efficiently without the overhead of custom memory management or exception-handling logic.

Original reference: bytecodealliance.org →