bytecodealliance / bytecodealliance/wasmtime

Investigate moving `StoreGcData` into `GcStore`

Open
#13,862 0 comments 0 reactions 0 assignees View on GitHub
wasm-proposal:gc
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

Spawned from [this comment](https://github.com/bytecodealliance/wasmtime/pull/13843#discussion_r3560241072), this is something we may want to push more on in the future. In an initial attempt to do this I was stymied pretty quickly:

* `gc_host_alloc_types` would be difficult to move because this field is currently accessed before a `GcStore` is allocated. Callers would have to switch to `ensure_gc_store` and `async` to make this work.
* `pending_exception` is difficult because right now barriers require the entire `GcStore`, so the preexisting barrier functions can't be used if this field is stored witin the `GcStore` itself.
* `gc_roots` is difficult because during timming liveness flags for `OwnedRooted` that takes a simultaneous borrow on `GcStore` and the `RootSet`. If these lived in the same object it's more difficult to handle them in tandem.

However `gc_roots_list` and `subtype_check_cache` are likely easy to move. Given the difficulty in moving the prior ones though I didn't want to do a halfway migration so I'm going to leave this for a future refactoring.

Contributor guide

Open the contributing guide

Research direction

Start with the discussion linked from pull request 13843 and trace StoreGcData together with gc_host_alloc_types, pending_exception, gc_roots, gc_roots_list, and subtype_check_cache. Determine whether the easy fields can move without a halfway migration or whether the borrowing, barrier, and allocation constraints require a broader refactoring; done means documenting a viable scope or confirming that the work should wait.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.