Skip to content

Enable wasm GC support (native) - #10

Merged
konsumer merged 6 commits into
mainfrom
enable-wasm-gc
Aug 21, 2026
Merged

Enable wasm GC support (native)#10
konsumer merged 6 commits into
mainfrom
enable-wasm-gc

Conversation

@konsumer

@konsumer konsumer commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

  • WAMR_BUILD_GC 1 in host/cmake/Findwamr.cmake - native host now accepts modules using wasm-GC struct types
  • No code changes needed elsewhere: cart_gc()/cart_alloc_tracked manage a separate linear-memory arena for host-returned struct/string buffers, unrelated to WAMR's own GC heap, which the runtime collects automatically
  • Web host needs no change - it already runs carts through the browser's own WebAssembly engine (not WAMR), and modern browsers ship wasm-GC already
  • README: new "probably will not support" section documenting Kotlin/dart2wasm/janet with concrete reasons
  • Doc accuracy pass across .claude/skills/ and AGENTS.md (see below)

Verification

  • Hand-written .wat cart using struct.new/struct.get + a null0 import loads and runs cleanly under the GC-enabled host for 300+ frames, zero errors
  • Full clean rebuild (rm -rf build), confirmed -DWASM_ENABLE_GC=1 actually compiled into 52 build steps and GC symbols (wasm_obj_is_struct_obj etc.) present in the binary - not a stale/cached build
  • Regression pass: all 18 supported cart languages (24 example carts) rebuilt fresh via their docker images and run against the GC-enabled host - all ran clean for their full duration, no crashes or new errors

What's still blocked (documented in the skill, not fixed here)

  • Kotlin/Wasm's wasm-wasi target is genuinely close (standalone WASI + custom-module imports, real GC struct usage) but hits a real WAMR loader gap: it unconditionally rejects any GC array type with anyref elements, which sits deep in Kotlin's stdlib. Also needs -Xwasm-use-traps-instead-of-exceptions since WAMR's fast interpreter and exception-handling are a hard-incompatible build combination.
  • dart2wasm's default output isn't standalone - it imports a dart2wasm JS namespace and the JS-string-builtins proposal, ruled out by the existing "no JS glue" rule, same as emscripten.

Doc accuracy pass

Went through AGENTS.md and every .claude/skills/*/SKILL.md checking claims against the actual codebase:

  • AGENTS.md: fixed the stale "No wasm GC proposal" line, added detail on the fast-interp/exception-handling build incompatibility
  • add-api-function/SKILL.md: added Tilemap/i32[] (existing types the skill's list omitted) and gui.yml/tile.yml (existing API groups missing from the example list)
  • tools/docker/README.md: python was listed under "experimental (can't call null0 host-functions yet)" and missing from the build/publish command lists - confirmed by screenshot that python carts do call host functions correctly (clear/draw_rectangle render fine), moved it into the normal list
  • Regenerated API.md and a few language bindings that had a stale NULL0_VERSION constant (npm run gen hadn't been re-run since the last version bump)
  • fix-host-bug/SKILL.md, make-cart/SKILL.md + references/languages.md checked against source - no drift found

Test plan

  • CI passes (no host behavior change for existing carts)

@konsumer
konsumer merged commit 7ff5f37 into main Aug 21, 2026
20 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant