Thursday, December 03, 2026

WASM 3.0 GC languages support

WebAssembly Garbage Collection (WasmGC) now enabled by default in Chrome  |  Blog  |  Chrome for Developers

Bytecode Alliance — GC and Exceptions in Wasmtime

appcypher/awesome-wasm-langs:
😎 A curated list of languages that compile directly to or have their VMs in WebAssembly

WebAssembly, or wasm for short, is a low-level bytecode format that runs in the browser just like JavaScript. It is designed to be faster to parse than JavaScript, as well as faster to execute which makes it a suitable compilation target for new and existing languages.

languages targeting wasmGC - Google Search

Programming languages that target or have active support/ports for WasmGC (WebAssembly Garbage Collection) rely on its native struct and array heap types rather than bundling their own custom garbage collectors: [1, 2]

  • Java (J2Wasm / TeaVM): Compiles Java bytecode and object models directly to WasmGC constructs instead of shipping a bundled JVM memory manager. [1, 2, 3]
  • Kotlin (Kotlin/Wasm): Targets WasmGC to run Kotlin multiplatform code cleanly and efficiently in browsers with smaller binary footprints. [1, 2, 3]
  • Dart: Compiles Dart code to WasmGC to integrate directly with host VM garbage collectors and improve web app performance. [1, 2, 3]
  • C# / .NET: Leverages WasmGC capabilities to align .NET’s managed heap and runtime execution with WebAssembly's native GC proposal. [1, 2]
  • Ocaml (wasm_of_ocaml): Adapts OCaml compilation pipelines to harness WasmGC for object representation and memory handling. [1]
  • Scheme (Hoot Scheme / Guile Hoot): A Scheme implementation targeting WasmGC for functional language execution in WebAssembly runtimes. [1]
  • Julia (WasmTarget.jl / Therapy.jl): Experimental compilers bringing Julia to WebAssembly by leveraging WasmGC's native garbage collection features. [1]
  • AssemblyScript: A TypeScript-like language designed to compile cleanly to WebAssembly, supporting GC and low-level memory control options. [1]
Read more about technical porting strategies on the v8 WasmGC Porting Guide or explore runtime support via the Bytecode Alliance Wasmtime GC Article. [1, 2]


Because the general awesome-wasm lists track any language with any form of WebAssembly compilation (including heavy, non-GC engines compiled via linear memory), they obscure which tools actually utilize native Wasm 3.0 / WasmGC features. [1, 2]
While there is no single, canonical "WasmGC-only" GitHub list yet, you can track exact implementation status through specific language-family and runtime ecosystems.
1. The Wasm 3.0 Spec & Feature Tracking
The official definition of "Full Wasm 3.0 with GC" comes directly from the WebAssembly Feature Status Page and the Wasm 3.0 Release Track. This standard natively includes Garbage Collection (struct and array heap types), Tail Calls, and Extended Constant Expressions. [1, 2]
2. Languages Built Specifically/Exclusively for WasmGC
If you want to look at languages that didn't just port to WasmGC but were designed or heavily restructured for it from the ground up:
  • Guile Hoot (Scheme): This is the most vocal flag-bearer for pure WasmGC. It is an implementation of Scheme built explicitly to target the Wasm 3.0 GC spec without linear-memory workarounds. [1]
  • Grain: A functional, strongly-typed language built specifically for WebAssembly that has native integration tracks for Wasm runtime features.
3. Production Language Toolchains Using True WasmGC
For major languages, you must look at the specific compiler backend being used, as most languages have multiple Wasm backends (e.g., linear memory vs. WasmGC):
LanguageThe True WasmGC ToolchainStatus
Dart / Flutterdart compile wasmProduction Stable. Fully bypasses JS-interop memory and relies entirely on WasmGC.
KotlinKotlin/Wasm target (IR compiler)Stable. Built specifically to utilize Wasm 3.0 GC features to keep binary sizes minimal.
JavaJ2Wasm (by Google) & TeaVM (WasmGC backend)Production/Stable. Converts Java class structures directly into WasmGC structs.
OCamlwasm_of_ocamlActive. Translates OCaml's GC representation directly into Wasm 3.0 types.
Where to monitor updates
To see which languages are actively moving over to the native Wasm 3.0 runtime spec, the best place to look is the source implementation discussions on the WebAssembly GC GitHub Repository, where compiler engineers from Google (V8), Dart, Kotlin, and the Guile Hoot teams actively document how they map their language features to the spec. [1]


When compiling C# or Blazor to WebAssembly, .NET does not use WasmGC; it bundles and ships its own custom garbage collector inside the application payload.
The entire .NET runtime (dotnet.wasm) is compiled down to Wasm linear memory. When your Blazor app runs in the browser, it manages its own managed heap and triggers its own garbage collection sweeps completely independently of the browser's native GC engine. [1, 2]
The .NET team has kept its own internal GC for several distinct reasons:
  • Object Model Incompatibilities: The WasmGC specification treats objects as rigid, typed structs or arrays. The .NET object model relies heavily on features like interior pointers, interior references (ref and in structs), and unmanaged memory casting that do not map directly onto the current WasmGC proposal. [1, 2]
  • Semantics Preservation: Adopting WasmGC right now would require the .NET team to either fundamentally alter the runtime behavior of existing C# code or strictly limit major language features within the standard C# base libraries. [1]
  • The "Jiterpreter" Approach: Rather than refactoring the memory architecture for WasmGC, Microsoft focused on building an on-the-fly JIT engine layer for Wasm (the "Jiterpreter") to boost runtime execution speeds while keeping the traditional .NET memory manager. [1]
While third-party community frameworks (like the Uno Platform) and ecosystem advocates track Wasm 3.0 closely, native WasmGC support within official .NET/Blazor releases remains missing for the foreseeable future. [1]


Just like .NET, standard Go compiles down to a monolithic WebAssembly module that bundles its own entire runtime environment—including its own custom garbage collector and goroutine scheduler. [1]
This is why a simple "Hello World" compiled with mainline Go (GOOS=js GOARCH=wasm) yields a binary size that easily exceeds 2MB. The application manages its own allocations inside WebAssembly's linear memory array instead of trusting the host browser to do it. [1, 2]
Go faces nearly identical structural friction points as .NET when it comes to adopting WasmGC:
  • Interior Pointers: This is the biggest technical blocker for Go. In Go, you can point a reference directly to a specific field inside a struct, or an element inside an array. The current WasmGC specification treats objects as rigid heap entities and does not allow you to hold a pointer to the middle of a struct. [1, 2]
  • Non-Moving Garbage Collector: Go's runtime relies on a concurrent, non-moving garbage collector (objects stay in the same memory slot once allocated). WasmGC architectures are free to use moving/compacting collectors, which would completely break the memory assumptions built into Go's compiler. [1]
The Alternative: TinyGo
If you want to use Go on the web without dragging a massive standalone garbage collector along, developers use TinyGo. TinyGo is an alternate Go compiler designed specifically for microcontrollers and WebAssembly. It drops the heavy standard runtime, replaces the complex Go GC with a drastically simpler, lightweight allocation strategy, and shrinks binary sizes down from megabytes to just a few kilobytes. [1, 2]


Dart, Java, and Kotlin were able to adopt WasmGC because their underlying object models naturally mirror the high-level, structured memory concepts that WasmGC provides.
Unlike Go and C#, which allow low-level, unconstrained pointers and raw memory layout manipulation, these three languages are strictly "managed" and object-oriented. They compile to target abstract runtime representations (like Java Bytecode or Dart Kernel AST) rather than directly mapping fields to raw physical byte offsets.
The engineering teams at Google, JetBrains, and Oracle worked closely with the Wasm standard committee to design WasmGC precisely around their languages' needs, using several key strategies:
1. Mapping Objects to Wasm Structs and Arrays
WasmGC introduced high-level heap types—mainly struct and array—directly into the WebAssembly engine.
  • Instead of flattening a class into an unformatted array of bytes (linear memory), Kotlin/Wasm and J2Wasm compile an object into a native WasmGC struct.
  • A class field becomes a typed field inside that struct (e.g., (field $age i32)).
  • Because the browser’s JavaScript engine already understands structs and objects, it can traverse this memory effortlessly.
2. Strict Reference Enforcement (No Interior Pointers)
Java, Kotlin, and Dart do not natively allow "interior pointers"—you cannot take a reference to a single variable inside an object or pointing halfway through an array element. You can only reference the object as a whole.
  • This constraint fits WasmGC perfectly. WasmGC strictly forbids interior pointers because the browser needs to safely know where an object starts and ends so it can move or clean it up.
  • Because these languages already enforced this rule, their compilers didn't have to break any core language features to comply with WasmGC.
3. Smart Virtual Table (VTable) Routing
Object-oriented languages require dynamic dispatch (knowing which overridden method to call at runtime).
  • To do this without linear memory, WasmGC compilers create an internal Wasm struct that acts as a VTable.
  • The VTable contains an array of function references (funcref). Every instance of a class holds a pointer to its class's VTable. When a method is called, Wasm queries the VTable struct and executes the typed function pointer directly.
4. Direct DOM and JavaScript Interop
In a linear memory setup (.NET/Go), passing a string or object to JavaScript requires deep-copying bytes back and forth across a "bridge."
  • Because WasmGC objects are tracked natively by the browser's engine, Dart, Java, and Kotlin can pass object references (externref or typed struct references) straight to JavaScript or the browser DOM.
  • JavaScript can manipulate or pass these references back without any serialization penalty.
Directly Comparing Compiler Architectures
FeatureDart / Kotlin / Java (WasmGC Approach).NET / Go (Linear Memory Approach)
Memory AllocationRequested dynamically from the host browser engine.Allocated inside a rigid, pre-allocated block of physical bytes.
Object RepresentationBrowser-visible, strongly-typed Wasm struct.Abstract blobs of bytes inside a raw array.
Garbage CollectorBypassed completely; handled by the browser's own GC.Bundled entirely inside the payload as thousands of lines of compiled code.
Pointer MechanicsStrict object references only; no indexing hacks.Supports interior pointers and unmanaged memory casting.


No, AssemblyScript does not have proper, native support for WasmGC.
While the fundamental design of AssemblyScript looks like TypeScript, its architecture remains strictly anchored to WebAssembly's traditional linear memory model. [1]
AssemblyScript maps objects and arrays into its own custom-allocated blocks of physical linear memory bytes and uses its own lightweight, bundled garbage collection library (a variant of a Managed Reference Counting / TLSF allocator). [1]
The primary reasons AssemblyScript has not migrated to proper WasmGC include:
1. Dual Use-Case Architecture (Low-Level Control)
AssemblyScript was designed to allow web developers to write code that looks like JavaScript, but functions like C. It explicitly gives developers low-level access to raw linear memory macros (like load<u32> and store<u8>). Completely rewriting the compiler's frontend to output structured WasmGC struct and array types would break this hybrid identity, stripping away the direct memory manipulation capabilities that many AssemblyScript developers rely on. [1, 2]
2. Frontend Compiler Divergence
The underlying optimization engine that AssemblyScript uses (Binaryen) has complete support for WasmGC. However, AssemblyScript's own frontend parser and type-checker are not natively wired to transform TypeScript classes into WasmGC heap structures. [1]
3. Limited Ecosystem Pressure
Unlike Dart or Kotlin—which needed WasmGC to survive on the web without dropping heavy multi-megabyte runtimes into the browser—AssemblyScript's bundled linear-memory GC is already incredibly minimal (adding only a few kilobytes to a project). Because it doesn't suffer from the massive payload penalties of .NET or Go, the motivation to overhaul the entire compiler architecture for WasmGC has been significantly lower.
If you are aiming to write a frontend application using TypeScript-like syntax with genuine WasmGC integration, would you like to explore how Kotlin/Wasm manages its syntax, or look into experimental JavaScript-to-Wasm pipelines?

Native Garbage Collection (WasmGC) is officially a core part of the WebAssembly 3.0 specification. [1, 2]
Following the W3C's completion and announcement of the finalized Wasm 3.0 standard, several foundational, long-awaited language-enablement proposals were officially frozen and merged into the main specification. [1, 2]
Instead of treating it as an experimental flag or a separate proposal, any modern runtime claimining full Wasm 3.0 compliance natively supports the following memory features: [1, 2]
  • Low-Level Managed Types (WasmGC): Runtimes must natively support struct and array heap types, leaving tracking, lifetime, and garbage collection entirely up to the host engine. [1, 2]
  • Typed Function References: Essential for building safe, recursive, and optimized Object Virtual Tables (VTables) without breaking the type system. [1]
  • Fully General Tail Calls: Crucial for languages that rely heavily on recursion (like functional or declarative languages) to execute without blowing up the Wasm stack. [1, 2]
  • 64-Bit Memory Expansion (Memory64): Lifting the old 4GB memory barrier to allow modules to address up to 16GB of address space natively. [1, 2]
The baseline Wasm 1.0 (2017) was strictly optimized for raw linear memory and manual memory management (C/C++/Rust). WebAssembly 3.0 represents the turning point where the spec officially adapted to natively handle managed, object-oriented, and garbage-collected programming languages. [1]
Flutter apps are fully capable of running via Wasm in modern web browsers. [1]
Google has stabilized its native WasmGC toolchain (dart2wasm), meaning Flutter web apps can bypass JavaScript compilation entirely, utilizing native browser garbage collection for up to a 2x–3x boost in runtime execution speed. [1, 2]

Do they render on Canvas or HTML DOM?
Flutter Web apps compiled with Wasm render almost exclusively onto a Canvas-like pixel surface (WebGL/WebGPU) via its Skwasm or CanvasKit rendering engines. [1, 2]
  • The Canvas Approach (99% of the app): Flutter completely owns its rendering pipeline. It does not convert a Container into a <div> or a Text widget into a <p>. Instead, the browser's DOM contains just a few wrapper elements and a massive <canvas> viewport. The Flutter engine draws your entire application UI manually inside that canvas, pixel by pixel. [1, 2]
  • The HTML Exception (Accessibility/Inputs): To prevent broken browser interactions, Flutter dynamically manages a invisible "Semantics Tree" overlay of raw HTML elements directly over the canvas. This ensures that native browser inputs, text selection, screen readers, and password managers still function exactly as expected. [1]

How do those apps adjust to responsive resize?
Because Flutter draws everything on a canvas, window resizing does not use standard CSS Media Queries or Flexbox grids. Instead, the Flutter engine instantly stretches the <canvas> HTML element to match the browser's new viewport width/height, forces a re-layout, and repaints the entire screen.
Developers manage this fluid layout within the Dart codebase using several built-in layout mechanisms:
  1. MediaQuery (Global Dimensions):
    You can query the current window bounds inside your widget tree using MediaQuery.of(context).size. When a user resizes the browser window, this triggers an immediate reactive rebuild.
    [1, 2]
    dart
    if (MediaQuery.of(context).size.width > 840) {
      return DesktopLayout(); // e.g., shows a sidebar
    } else {
      return MobileLayout();  // e.g., shows a bottom nav bar
    }
    
    Use code with caution.
  2. LayoutBuilder (Local Constraints):
    Instead of looking at the total screen size, LayoutBuilder evaluates the constraints passed down from a parent widget. This lets you build components that naturally shift from a grid layout to a single-column layout depending on how much box space they are given.
    [1]
  3. Flex Widgets (Row, Column, Flexible, Expanded):
    Flutter's layout model uses a "Constraints go down, sizes go up" architecture. Widgets like Row and Column calculate the expanding canvas geometry mathematically and distribute the available pixels automatically during the resize event.
For production projects, many teams rely on community layout managers like the Responsive Framework Package to automatically scale UI proportions down proportionally on smaller viewports, mimicking mobile pixel densities perfectly on desktop screens. [1]


Flutter web has two different rendering engines that developers can choose from, 
  • DomCavas is essentially an HTML DOM-based model that combines HTML/CSS/JS and the Canvas API to build, layout, and paint Flutter widgets on the web. Flutter for Web, which started with this strategy, as of now uses DomCanvas by default.
  • CanvasKit, by Skia, in contrast, uses WebAssembly and WebGL, which enables the browser to take advantage of hardware acceleration. This improves the ability to render complex and intensive graphics efficiently. CanvasKit is still being worked on, so be wary of using it in production.
While CanvasKit seems to be the right place to go, there is one major drawback — its initial payload which can go upwards of 8MB before the user can even see the application. Unless users are aware of this beforehand — most won’t stick around to wait for the app to load.



No comments: