Skip to content

[js-api] Allow creating i64 globals #827

Closed
@rossberg

Description

@rossberg

The JS API does not yet support i64 for functions or globals because JS cannot represent int64.

However, there is no reason to disallow creating WebAssembly.Global instances of type i64. It is sufficient to disallow accessing them from JS through the getter and setter. After all, such objects can already be created indirectly by exporting an i64 global from a module.

I hence suggest the following relaxations:

  • The algorithm ToValueType does not throw on "i64" but return i64.
  • The algorithm DefaultValue does not throw on i64 but return (i64.const 0).

That way, a Global of type i64 can be created in JS but only with a default initialisation value.

Motivation: It is problematic for a generic linker, mocker or other module-level abstractions if they cannot externally create every possible export object (even if unusable in JS).

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