Closed Bug 1784156 Opened 2 years ago Closed 2 years ago

Add constant GC instructions to wasm::InitExpr

Categories

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

task

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: rhunt, Assigned: yury)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The GC proposal includes several instructions as 'constant instructions' which means they're valid as initializer expressions in globals [1].

Constant Expressions

In order to allow RTTs to be initialised as globals, the following extensions are made to the definition of constant expressions:

    i31.new is a constant instruction
    struct.new_canon and struct.new_canon_default are constant instructions
    array.new_canon, array.new_canon_default, and array.new_canon_fixed are constant instructions
        Note: array.new_canon_data and array.new_canon_elem are not for the time being, see above
    global.get is a constant instruction and can access preceding (immutable) global definitions, not just imports as in the MVP

So we'll need to update wasm::InitExpr to be able to validate and interpret these instructions.

One interesting addition is that 'global.get' can get preceding immutable global definitions, not just imports.

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

Blocks: 1784497

See bug 1784497 for how this may affect tables.

i31.new is blocked on adding i31 support, which we're deferring for now.
array.new_canon_fixed is blocked on the advanced array work Julian is doing in bug 1774840.

The rest should be available to do.

I think "global.get is a constant instruction and can access preceding (immutable) global definitions" should be separated into a different bug, as there is some subtlety to it from a discussion in the last CG meeting.

  • add struct.new, .new_default instructions
  • add array.new, .new_default, .new_fixed instructions
Assignee: nobody → ydelendik
Attachment #9293370 - Attachment description: WIP: Bug 1784156 - Add struct.new and array.new instructions to wasm::InitExpr. → Bug 1784156 - Add struct.new and array.new instructions to wasm::InitExpr. r?rhunt
Status: NEW → ASSIGNED
Depends on: 1789698

(In reply to Ryan Hunt [:rhunt] from comment #2)

I think "global.get is a constant instruction and can access preceding (immutable) global definitions" should be separated into a different bug, as there is some subtlety to it from a discussion in the last CG meeting.

Tracking that in bug 1789698

Pushed by ydelendik@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0da02291b4a7 Add struct.new and array.new instructions to wasm::InitExpr. r=rhunt
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
Regressions: 1790586
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: