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.

Post-MVP host mappings for GC objects #496

@ericvergnaud

Description

@ericvergnaud

Reading the discussions re mappings between GC objects and host objects, I see that they focus mostly on structs.

I'm wondering if it would make sense to treat arrays separately. The reasons for that are:

  • there could be a significant performance benefit in directly mapping WebAssembly arrays, thanks to 0-copy.
  • they could be used as an intermediate 0-copy solution for strings until the Strings proposal is reprioritized and delivered.
  • unlike structs, the meaning of arrays doesn't vary significantly across programming languages. It could help reach consensus on the spec more rapidly for arrays than for structs, and see a MVP soon after.
  • it would free the structs mapping spec from array related constraints.

As an example, an i32 unpacked array would map to:

  • Int32Array in JS
  • int[] in Java
  • int[] in C#
    ...
    similarly, an i32 array packed using Int8 would map to:
  • Int8Array in JS
  • byte[] in Java
  • sbyte[] in C#
    ...

Would it make sense to submit a draft Post-MVP PR focused on array mapping ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Post-MVPIdeas for Post-MVP extensions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions