Bug 260039
| Summary: | [Wasm-GC] Module linking should take subtyping into account | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Asumu Takikawa <asumu> |
| Component: | WebAssembly | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Bug Depends on: | |||
| Bug Blocks: | 247394 | ||
Asumu Takikawa
Right now, module linking checks for exact type index equality to make sure linked functions satisfy their types. The GC proposal extends this to work with subtypes, instead of exact match, but this isn't implemented yet.
For example, this test fragment is from the GC proposal repo test suite:
```
(module
(type $t0 (sub (func (result (ref null func)))))
(rec (type $t1 (sub $t0 (func (result (ref null $t1))))))
(rec (type $t2 (sub $t1 (func (result (ref null $t2))))))
(func (export "f0") (type $t0) (ref.null func))
(func (export "f1") (type $t1) (ref.null $t1))
(func (export "f2") (type $t2) (ref.null $t2))
)
(register "M")
(module
(type $t0 (sub (func (result (ref null func)))))
(rec (type $t1 (sub $t0 (func (result (ref null $t1))))))
(rec (type $t2 (sub $t1 (func (result (ref null $t2))))))
(func (import "M" "f0") (type $t0))
(func (import "M" "f1") (type $t0))
(func (import "M" "f1") (type $t1))
(func (import "M" "f2") (type $t0))
(func (import "M" "f2") (type $t1))
(func (import "M" "f2") (type $t2))
)
```
The import "f1" takes a function that has type `$t1` (subtype of `$t0`) and tries to import it under type `$t0`. This currently fails, but is supposed to succeed.
It should be relatively easy to fix, by changing the index equality check to a `isSubtype` call.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/114045477>
Asumu Takikawa
Pull request: https://github.com/WebKit/WebKit/pull/21875
EWS
Committed 272226@main (3015bbe0e8ab): <https://commits.webkit.org/272226@main>
Reviewed commits have been landed. Closing PR #21875 and removing active labels.