GC and Exceptions in Wasmtime
5 days ago
- Wasmtime 47 enables Wasm GC and exceptions by default, supporting more languages on WebAssembly.
- Wasm GC eliminates the need for embedded garbage collectors by adding struct/array types and automatic lifecycle management.
- Wasm Exceptions provides efficient try/catch constructs, replacing custom calling conventions and reducing binary size and overhead.
- Wasmtime uses a Cheney-style copying collector with 32-bit GC references based on linear memory for safety and portability.
- Performance is secondary to correctness for now; the collector is optimized for many short-lived Wasm instances.
- Future work includes alias-analysis optimizations and GC integration with the component model via lazy value lowering.