Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

JS API for SIMD: WA.Global<v128>, lane accessors, coercions at calls #502

@lars-t-hansen

Description

@lars-t-hansen

(Yeah, I know we're done but I figured it was more natural to file the issue here than in relaxed-simd. Looking for feedback.)

Generally JS does not have a representation for v128 so things become a little awkward; JS can't easily talk about v128 values. But JS can talk about WA.Global objects of type v128, and it can talk about the individual lanes in such an object if accessors were provided. There are a couple of things we could do to make life easier for the JS programmer who interacts with wasm SIMD code:

  • provide lane getter and setter methods on WA.Global when the type is v128, we probably should have done this already
  • allow WA.Global objects to be passed to exported wasm functions for parameters of type v128 and also make such exported functions return new WA.Global objects when a return type is v128. In effect, WA.Global becomes the JS representation of v128.

(This is based on some work @eqrion is doing for our testing infrastructure, where we rely on a variant of this system, see https://bugzilla.mozilla.org/show_bug.cgi?id=1703105.)

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