Brifing

GC and Exception Support in Wasmtime 47

High-level language support expands in WebAssembly ecosystem.

1Key Features of Wasmtime 47

Wasmtime 47 release enables WebAssembly's garbage collection (GC) and exception handling proposals by default. This advancement paves the way for more efficient compilation of high-level languages to WebAssembly. Supporting these features represents years of engineering effort in the runtime.

2Significance of GC Support

Early WebAssembly versions required object-and-reference languages to embed their own garbage collectors, resulting in bloated binaries. The GC proposal allows using the runtime's collector instead, reducing binary sizes and improving performance for these languages.

3Exception Handling Simplified

The exceptions proposal eliminates the need for custom calling conventions in exception-using languages. Previous implementations increased binary sizes. The new system natively supports try/catch constructs with zero overhead on the common execution path.

4Wasmtime's GC Implementation

Wasmtime employs a Cheney-style semi-space copying collector. The GC heap divides into two semi-spaces with live objects copied between them. Reusing linear memories provides security, performance, and portability benefits for the GC implementation.

5Security and Performance Benefits

Implementing GC heap on linear memory prevents malicious Wasm programs from accessing host memory. 32-bit references are more cache-efficient than 64-bit pointers. Virtual memory guard pages eliminate explicit bounds checks, boosting performance.

6Testing and Validation

The team extended fuzzing infrastructure to verify GC correctness. They enhanced wasm-smith to support GC proposals and added two specialized fuzzers: one for complex object graphs and another to detect heap corruption issues.

7Future Expectations

Wasmtime developers initially focused on collector correctness. More work remains for performance optimizations. These improvements will solidify WebAssembly's position as an ideal target platform for diverse programming languages.

Original article: Hacker News (news.ycombinator.com) — Wasmtime 47'de GC ve İstisna Desteği