Do you know if there is a runtime or mechanism to test Components that use Wasm GC? I'm building a toy compiler that targets both and I'd like to test the output.
Latest Firefox and Chrome support WasmGC, but no components.
The reference interpreter https://github.com/WebAssembly/gc/tree/main/interpreter supports GC but no components.
https://github.com/bytecodealliance/wasm-tools and wasmtime lacks support for GC.
I know there is work in progress to support WasmGC on wasm-tools and wasmtime, but I'm asking here because you might know an alternative for the short term.
Thanks in advance :)
jco supports components in web browsers (including Firefox and Chrome). I haven't tried using WasmGC in a component myself, though -- I'll be interested to hear how it goes.
But yeah, if wasm-tools
won't be able to help you create such a component, you may be stuck.
I'm also not aware of anything for in the short term unfortunately. The component-related tooling I know of all goes through wasm-tools
so that's required to get updated first.
I would love to try wasm-tools
with Wasm GC modules produced by Kotlin toolchain. I'm seeing some progress in GC support and wondering if there is a place to track its readiness?
currently we don't have a tracking issue or location for all the various bits of work, fitzgen (currently on vacation) is doing most of the work at the moment and would know best
The main branch of wasm-tools is now able to parse some of the WasmGC modules produced by Kotlin toolchain :tada: . Thanks fitzgen!
I'm trying to set up a full pipeline for experimenting with Components and WASI Preview2, while using some library code that currently uses Preview1 reactor ABI, and without built-in Component support in compiler. Does the following sequence make sense?
wit-bindgen
: world.wit
-> bindings.kt
*.kt
-> core.wasm
wasm-tools component embed --encoding=utf16 world.wit core.wasm -o core.wasm
wasm-tools component new --adapt wasi_snapshot_preview1.reactor.wasm core.wasm -o component.wasm
jco transpile component.wasm -o out-dir
At the step 4 I had troubles with wasm-tools component new
not validating modules with wasm exceptions and GC. I hacked WasmFeatures::default()
to return WasmFeatures::all()
to unblock myself locally and it worked! Would it make sense to add an CLI flag to skip validation or enable non-default features?
I also tried to hack GC support into jco transpile
and got bumped by assertion failed: ty.is_final
in wasmtime-environ. I didn't know jco used wasmtime under the hood.
yes, jco uses wasmtime-environ as the implementation of the algorithm that parses components into modules and a description of how to instantiate them
theres no wasmtime present at runtime, its just used for code generation
Would it make sense to add an CLI flag to skip validation or enable non-default features?
Good find! I think it makes sense to use ::all()
there
We use a trick to test components with WasmGC and jco. First, to make jco happy, we give jco transpile
a component with a "stub" of the core wasm module, using Wasm 1.0 imports and unreachable-bodied exports, but no GC. Then, we swap out this transpiled stub with a real WasmGC core module and run it in Node.js. You can find the setup here: https://github.com/skuzmich/kotlin-wasm-cm-experiments
Last updated: Nov 22 2024 at 16:03 UTC