RESOLVED FIXED 239666
[Wasm-GC] Add support for recursion groups
https://bugs.webkit.org/show_bug.cgi?id=239666
Summary [Wasm-GC] Add support for recursion groups
Asumu Takikawa
Reported 2022-04-22 12:23:43 PDT
The latest version of the Wasm GC proposal introduces a notion of a "recursion group" (https://github.com/WebAssembly/gc/blob/main/proposals/gc/MVP.md#type-definitions), which is a way to explicitly introduce recursive types in an iso-recursive type system. These type definitions use the operator `rec` to introduce types. An example `rec` type declaration: ``` (module (rec (type $f (func (result (ref 0)))) (type $s (struct)))) ``` JSC will need to support these and also new `sub` types to fully support the GC proposal. The basic implementation of rec types is thankfully not too difficult in JSC thanks to the fact that Wasm type definitions are already hash-consed. (the iso-recursive type system design makes it easy to support a bottom-up, hash-consed implementation strategy)
Attachments
Patch (75.06 KB, patch)
2022-04-22 14:26 PDT, Asumu Takikawa
no flags
Patch (82.38 KB, patch)
2022-04-28 11:15 PDT, Asumu Takikawa
no flags
Patch (81.97 KB, patch)
2022-05-05 11:03 PDT, Asumu Takikawa
asumu: review?
ews-feeder: commit-queue-
Asumu Takikawa
Comment 1 2022-04-22 14:26:13 PDT
EWS Watchlist
Comment 2 2022-04-22 14:27:47 PDT
This patch modifies one of the wasm.json files. Please ensure that any changes in one have been mirrored to the other. You can find the wasm.json files at "Source/JavaScriptCore/wasm/wasm.json" and "JSTests/wasm/wasm.json".
Asumu Takikawa
Comment 3 2022-04-22 22:30:25 PDT
I've marked this for review now since EWS is looking green. If this patch lands after more Wasm GC struct patches land, it will likely need to change to also put in type expansion in appropriate places for struct operations. (if it lands before, then the struct patches should change for the same reason)
Asumu Takikawa
Comment 4 2022-04-27 16:31:07 PDT
I'm rebasing this now on top of recent Wasm GC patches that landed (there are some conflicts). The patch also needs some modification because I found a bug in the GC reference interpreter (https://github.com/WebAssembly/gc/issues/290), which changes some of expectations for test cases. (Specifically, function signatures should be tracked as type indices in more places because, e.g., import or call_indirect signature checks need to use the type index of the recursion group projection instead of just the underlying function)
Asumu Takikawa
Comment 5 2022-04-28 11:15:06 PDT
Radar WebKit Bug Importer
Comment 6 2022-04-29 12:24:15 PDT
Asumu Takikawa
Comment 7 2022-05-05 11:03:49 PDT
Asumu Takikawa
Comment 8 2022-05-05 11:04:45 PDT
Rebased and made some small refactorings to prepare it better for the `sub` type patch. I've also mostly finished a patch for sub types, which I'll upload after `rec` types land.
Asumu Takikawa
Comment 9 2022-05-18 12:37:49 PDT
EWS
Comment 10 2022-08-16 16:15:35 PDT
Committed 253491@main (5f3859595e5e): <https://commits.webkit.org/253491@main> Reviewed commits have been landed. Closing PR #740 and removing active labels.
WebKit Commit Bot
Comment 11 2022-08-17 15:20:03 PDT
Re-opened since this is blocked by bug 244062
Asumu Takikawa
Comment 12 2022-08-23 17:07:19 PDT
EWS
Comment 13 2022-08-24 12:40:13 PDT
Committed 253736@main (38c77df13331): <https://commits.webkit.org/253736@main> Reviewed commits have been landed. Closing PR #3599 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.