Closed Bug 1825088 Opened 3 years ago Closed 2 years ago

Add support for final types in GC proposal

Categories

(Core :: JavaScript: WebAssembly, task, P3)

task

Tracking

()

RESOLVED FIXED
117 Branch
Tracking Status
firefox117 --- fixed

People

(Reporter: rhunt, Assigned: jpages)

References

Details

Attachments

(2 files)

The GC proposal now supports marking some type definitions as 'final' which means that no type may declare themselves a subtype of that one. [1]

The motivation for this is that when you downcast to a final type, you can just compare the object's type definition directly without doing a full subtype check.

To support this we need:

  1. Update wasm-tools to parse and encode a final flag
  2. Add a 'isFinal' flag to wasm::TypeDef
  3. Don't allow a type to declare a parent type that is final (see TypeDef::canBeSubtypeOf)
  4. Decode the 'isFinal' flag while reading type definitions (see DecodeTypeSection)

[1] https://github.com/WebAssembly/gc/blob/main/proposals/gc/MVP.md#type-definitions

Assignee: nobody → jpages

See https://github.com/bytecodealliance/wasm-tools/pull/1043

PR for final types is currently a draft and needs some changes in wasm-tools first: https://phabricator.services.mozilla.com/D178384

A final type can't have any subtypes. All wasm types
are now final by default unless the sub keyword is used.
To make a type non final use: (type $foo (sub)).
Use final with the following syntax: (type $foo (sub final)).

Attachment #9334716 - Attachment description: WIP: Bug 1825088 - wasm: Add support for final types. → Bug 1825088 - wasm: Add support for final types. r=rhunt
Pushed by jpages@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c910266f6c42 wasm: Add support for final types. r=rhunt

Backed out for causing SM bustages on br-on-cast.js

Backout link

Push with failures

Failure log

Flags: needinfo?(jpages)
Pushed by jpages@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7d6d051e0abd wasm: Add support for final types. r=rhunt
Pushed by jpages@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e6b123be310c wasm: Add support for final types. r=rhunt https://hg.mozilla.org/integration/autoland/rev/c40b6292592f wasm: Bump crate versions for wast and wasm-smith. r=rhunt,supply-chain-reviewers
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
Flags: needinfo?(jpages)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: