Skip to content
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
@jakobkummerow

Description

@jakobkummerow

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions