-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Open
Labels
Description
Its currently not possible to define Wasm globals with a non-default value.
E.g.:
.globaltype foo, i32, immutableproduces:
global i32 i32.const 0Unfortunately simply adding a parameter to .globaltype wouldn't be enough because in reality Wasm potentially supports a whole instruction sequence here.
Instead I would propose the following:
.globaltype foo, i32, immutable
.globalinit foo
i32.const -1
end_function // or some other more appropriate directivewould produce:
global i32 i32.const -1Happy to do the implementation on a design sign-off.
Pinging @sbc100 as a target maintainer.