WebAssembly / WebAssembly/spec

[js-api] Are Wasm-gc abstract heap types included in the JS API of e.g. WebAssembly.Global?

Open
#1,980 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
3.5k
Forks
539
Avg merge
2d 1h
Merged PRs (30d)
13

Description

The WebAssembly JS-API spec mentions the following types for globals:

enum ValueType {
  "i32",
  "i64",
  "f32",
  "f64",
  "v128",
  "externref",
  "anyfunc",
};

However, both V8 and SpiderMonkey support multiple more values like "anyref" or "i31ref".
After some code-search in V8, I found my commit which added it in 2022 when anyref was introduced for wasm-gc as a separate type hierarchy vs. the existing externref.
In later changes we added more of these new types like i31ref probably assuming some kind of consistency to the already present anyref.

It seems that JavaScriptCore doesn't accept these values.

The wasm-gc JS API document does not list any extensions to these existing APIs.
So from a spec perspective, it looks like this is a bug in V8 and SpiderMonkey?
Was it a conscious decision to not add support for the new abstract heap types to the existing JS APIs?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the JS-API specification's globals section and the wasm-gc MVP-JS.md document, then review the reported V8, SpiderMonkey, and JavaScriptCore behavior. Done means establishing whether abstract heap types belong in the existing JavaScript APIs and recording the resulting specification change or clarification.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, wasm
Domain
api, compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.