Bug 240982 - [Wasm-GC] Change externref to anyref
Summary: [Wasm-GC] Change externref to anyref
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebAssembly (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 247394
  Show dependency treegraph
 
Reported: 2022-05-26 14:58 PDT by Asumu Takikawa
Modified: 2022-11-02 17:15 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Asumu Takikawa 2022-05-26 14:58:56 PDT
The Wasm GC proposal unifies the externref type and anyref type (https://github.com/WebAssembly/gc/pull/271).

Right now, externref allows host values and has no subtyping relationship with other types. With the change to anyref, an anyref will allow host types, but it will also be allowed to be downcast to more specific reference types once casting operations are added. An anyref type parameter, e.g. for a function, will accept other reference types in the hierarchy as well.

(It is possible funcrefs will be excluded from the anyref hierarchy https://github.com/WebAssembly/gc/issues/293)

When Wasm GC is disabled, externref should still function as it does right now.
Comment 1 Radar WebKit Bug Importer 2022-06-02 14:59:13 PDT
<rdar://problem/94312718>
Comment 2 Asumu Takikawa 2022-07-01 13:17:21 PDT
There is still a lot of discussion about what the role of `anyref`, `externref`, etc should be in the GC proposal: https://github.com/WebAssembly/gc/issues/307

I think until this is clear, it's best to avoid implementing `anyref` (it's unclear if a "top type" is even going to be in the final type hierarchy). It might make sense to instead implement types like `dataref` (structs & arrays) and `eqref` (dataref + i31ref) initially.
Comment 3 Asumu Takikawa 2022-07-21 14:20:08 PDT
Recent discussions (in issue https://github.com/WebAssembly/gc/issues/307) and subsequent changes to the spec (https://github.com/WebAssembly/gc/pull/310) have actually undone the unification of externref and anyref types in the GC proposal.

So this issue can be closed unless the design changes again. Instead, for the GC proposal we will need to add an anyref as a new supertype of all GC datatypes.