Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esm: WebAssembly.Global unwrapping for Wasm Namespaces #57525

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

guybedford
Copy link
Contributor

This is a draft PR implementing a Wasm ESM Integration PR for global unwrapping in WebAssembly/esm-integration#104.

Opening here as a draft only for feedback and discussion, as it helps to have a concrete implementation for understanding and experimentation.

With this change, WebAssembly namespaces exporting globals have the global value provided directly on the namespace exports, instead of exporting WebAssembly.Global requiring a global.value getter access in turn to retrieve the underlying binding. With this, Wasm namespaces can effectively export any JS binding type when using Wasm GC, instead of just Memory, Table, Function and Global.

We do this by unwrapping the global on the Wasm namespace exports interface, while still linking Wasm - Wasm imports to the underlying global. Ideally this would support live exported bindings as well, but that would require V8 work in turn.

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run. labels Mar 18, 2025
@guybedford guybedford force-pushed the wasm-globals-ns-unwrapping branch from 2565b77 to 610b7dd Compare March 18, 2025 07:01
@guybedford guybedford force-pushed the wasm-globals-ns-unwrapping branch from 610b7dd to 0f49b0a Compare March 18, 2025 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
esm Issues and PRs related to the ECMAScript Modules implementation. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants