wasmtime icon indicating copy to clipboard operation
wasmtime copied to clipboard

Implement the WebAssembly GC Proposal

Open Srinivasa314 opened this issue 2 years ago • 28 comments

Tracking issue for implementation of the WebAssembly GC proposal

### Tasks
- [ ] https://github.com/bytecodealliance/wasmtime/issues/9351
- [ ] Implement the null GC described in the RFC: https://github.com/bytecodealliance/rfcs/blob/main/accepted/wasm-gc.md
- [ ] Implement the copying collector described in the RFC: https://github.com/bytecodealliance/rfcs/blob/main/accepted/wasm-gc.md
- [ ] https://github.com/bytecodealliance/wasmtime/issues/9350
- [ ] add gc support to general/differential fuzzing info
- [ ] rewrite the `table_ops` fuzzer to hammer on all GC/reference types things
- [ ] write an announcement blog post that we support Wasm GC
- [ ] prototype wasm GC & component model canonical ABI support
- [ ] support struct/array/i31 in wasmtime's C API

Srinivasa314 avatar Oct 07 '22 10:10 Srinivasa314

FYI we are now able to run a Kotlin/Wasm HTTP server via KoWasm on Node.js and I would be happy to leverage Wasmtime to run it as soon as it will get GC support.

This would be a really good fit since we would like to leverage WASI Preview2+ and Wasm Component Model asap.

See also my blog post The huge potential of Kotlin/Wasm for more context.

sdeleuze avatar Feb 27 '23 06:02 sdeleuze

Heads up: I am working on an RFC to work out the design of our Wasm GC support. I expect to start implementing Wasm GC once that RFC reaches consensus and merges and I've finished implementing Wasm tail calls.

fitzgen avatar Mar 30 '23 20:03 fitzgen

RFC is up: https://github.com/bytecodealliance/rfcs/pull/31

fitzgen avatar Apr 15 '23 15:04 fitzgen

hey there! any updates on this front? Really looking forward to use Kotlin/WASM with this runtime. For now only V8 is feasible, as it includes a GC and has implemented the proposal

tw-atroehrsm avatar Oct 24 '23 08:10 tw-atroehrsm

There is work on parsing and validation, and refactors setting the stage for these things, happening in the wasm-tools repository, since we need to be able to parse and validate Wasm before we can compile and run it.

fitzgen avatar Oct 25 '23 16:10 fitzgen

@fitzgen could you provide links to the issues over there? I want to keep track with the progress due to the impact on Kotlin

smndtrl avatar Jan 04 '24 12:01 smndtrl

@smndtrl since https://github.com/bytecodealliance/wasm-tools/pull/1346 merged, all GC spec tests are passing in wasm-tools.

You can look at https://github.com/bytecodealliance/rfcs/blob/main/accepted/wasm-gc.md#incremental-implementation-plan and https://docs.wasmtime.dev/contributing-implementing-wasm-proposals.html to get an idea of what is still to be done.

fitzgen avatar Jan 04 '24 17:01 fitzgen

So it there any timeline, roadmap when this will be available at least with the null GC?

this was merged in may 2023 so can be marked as done? image

https://github.com/bytecodealliance/wasmtime/pull/5288

what could one do to support this effort?

tw-atroehrsm avatar Feb 06 '24 10:02 tw-atroehrsm

The function references proposal still needs to be exposed in the embedder API.

I am actively working on that and the rest of getting Wasm GC implemented. Right now it mostly involves some refactoring to the runtime's internals to pave the way for future changes. Unfortunately, there isn't much that can be split out and implemented in parallel right now.

fitzgen avatar Feb 06 '24 17:02 fitzgen

FYI: https://github.com/bytecodealliance/wasmtime/pull/7943 finishes the function references proposal and takes the first baby steps towards Wasm GC inside Wasmtime, adding support for Wasm GC's nofunc and a Config::wasm_gc(enabled) knob.

fitzgen avatar Feb 15 '24 00:02 fitzgen

It looks like all gc types declarations are supported.

Can we create an issue to track the progress of the gc proposal, such as

  • gc instruction support
  • non-collection runtime
  • baseline gc runtime

oovm avatar May 26 '24 17:05 oovm

Yes all the types are supported now, but instantiating them is not implemented yet; I'm working on it. Then the various instructions. Then the collector itself. (Right now we are reusing the deferred reference-counting collector that Wasmtime already has, so we can collect some garbage, but not cycles).

Personally, I'm not a huge fan of opening a bunch of tracking issues for things already effectively tracked by this issue. Happy to cross-link more PRs here as they come in though.

fitzgen avatar May 29 '24 00:05 fitzgen