This repository was archived by the owner on Apr 25, 2025. It is now read-only.
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
Un-restricting globals initialization #189
Closed
Description
This proposal currently marks i31.new
, rtt.canon
and rtt.sub
as constant instructions, which means they can be used to initialize globals. Notably, struct/array allocating instructions are not categorized as constant (whereas ref.func
from the function-references proposal is). I got the following feedback from the J2CL team:
We are storing our vtables (which are structs) in globals and it would be nice if those could be initialized in the global definition and declared immutable rather than having them mutable and initialize them in the start function.
Is there a particular reason to be so restrictive about which instructions are allowed in global initializers? Can we loosen the restrictions somewhat?
Metadata
Metadata
Assignees
Labels
No labels