Closed Bug 1789698 Opened 1 year ago Closed 1 year ago

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


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




109 Branch
Tracking Status
firefox109 --- fixed


(Reporter: yury, Assigned: rhunt)


(Blocks 1 open bug)



(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


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
wasm: Relax global.get to allow previous globals with GC. r=jseward
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
You need to log in before you can comment on or make changes to this bug.