Closed Bug 1789698 Opened 2 years ago Closed 2 years ago

Enable non-import global.get instruction in wasm::InitExpr

Categories

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

task

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: yury, Assigned: rhunt)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

With GC proposal 'global.get' can get preceding immutable global definitions, not just imports. [1].

    global.get is a constant instruction and can access preceding (immutable) global definitions, not just imports as in the MVP

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

One complication of this how it interacts with section ordering. I think the way the current spec works there are three cases:

  1. Global initializers - can refer only to preceding immutable global definitions
  2. Table default elements (new in the GC proposal) - cannot refer to any globals, the table section is before the global section
  3. Elem section, data section initializers - can refer to any global, these sections are after the global section.

When we implement this, we should file an issue to double check if this is intended.

If it simplifies an initial implementation, we could collapse cases (2) and (3) together and disallow initializers outside the global section from referring to other globals.

I have a patch that does this.

Assignee: nobody → rhunt
Severity: -- → N/A
Priority: -- → P2

global.get is only allowed to target immutable imported globals when
used as an initializer in the MVP. GC relaxes this to allow targeting
any previously defined global. This commit implements this by adding
a constantGlobalGet method which will find the previously evaluated
global's resulting value.

Pushed by rhunt@eqrion.net:
https://hg.mozilla.org/integration/autoland/rev/0144704e1ea5
wasm: Relax global.get to allow previous globals with GC. r=jseward
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: