Enable non-import global.get instruction in wasm::InitExpr
Categories
(Core :: JavaScript: WebAssembly, task, P2)
Tracking
()
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
Assignee | ||
Comment 1•1 year ago
|
||
One complication of this how it interacts with section ordering. I think the way the current spec works there are three cases:
- Global initializers - can refer only to preceding immutable global definitions
- Table default elements (new in the GC proposal) - cannot refer to any globals, the table section is before the global section
- 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.
Assignee | ||
Comment 2•1 year ago
|
||
I have a patch that does this.
Assignee | ||
Comment 3•1 year ago
|
||
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
Comment 5•1 year ago
|
||
bugherder |
Description
•