Add constant GC instructions to wasm::InitExpr
Categories
(Core :: JavaScript: WebAssembly, task, P3)
Tracking
()
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
Reporter | ||
Comment 1•2 years ago
|
||
See bug 1784497 for how this may affect tables.
Reporter | ||
Comment 2•2 years ago
|
||
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.
Assignee | ||
Comment 3•2 years ago
|
||
- add struct.new, .new_default instructions
- add array.new, .new_default, .new_fixed instructions
Updated•2 years ago
|
Assignee | ||
Comment 4•2 years ago
|
||
(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
Comment 6•2 years ago
|
||
bugherder |
Description
•