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
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•3 years 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•3 years ago
|
||
I have a patch that does this.
| Assignee | ||
Comment 3•3 years 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.
Comment 5•3 years ago
|
||
| bugherder | ||
Description
•