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

WebAssembly: JS String Builtins #343

Open
ajklein opened this issue May 3, 2024 · 0 comments
Open

WebAssembly: JS String Builtins #343

ajklein opened this issue May 3, 2024 · 0 comments
Assignees
Labels
topic: javascript Spec relates to the JavaScript programming language topic: web assembly venue: W3C Web Assembly WG

Comments

@ajklein
Copy link

ajklein commented May 3, 2024

WebKittens

@ddegazio

Title of the spec

JS String Builtins

URL to the spec

https://github.com/WebAssembly/js-string-builtins/blob/main/proposals/js-string-builtins/Overview.md

URL to the spec's repository

https://github.com/WebAssembly/js-string-builtins

Issue Tracker URL

No response

Explainer URL

No response

TAG Design Review URL

w3ctag/design-reviews#940

Mozilla standards-positions issue URL

No response

WebKit Bugzilla URL

No response

Radar URL

No response

Description

JavaScript runtimes have a rich set of builtin objects and primitives. Some languages targeting WebAssembly may have compatible primitives and would benefit from being able to use the equivalent JavaScript primitive for their implementation. The most pressing use-case here is for languages who would like to use the JavaScript String type to implement their strings. This proposal aims to provide a minimal and general mechanism for importing specific JavaScript primitives for efficient usage in WebAssembly code.

This is done by first adding a set of wasm builtin functions for performing JavaScript String operations. These builtin functions mirror a subset of the JavaScript String API and adapt it to be efficiently callable without JavaScript glue code. Then a mechanism for importing these wasm builtin functions is added to the WebAssembly JS-API. These two pieces in combination allow runtimes to reliably emit optimal code sequences for JavaScript String operations within WebAssembly modules. In the future, other JS builtin objects or JS primitives can be exposed through new wasm builtins.

Note: the proposal is championed by @eqrion of Mozilla. I'm filing this standards position issue as part of the Blink API process: Chrome is currently running an Origin Trial for this feature, and we expect to ship it once it's finalized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: javascript Spec relates to the JavaScript programming language topic: web assembly venue: W3C Web Assembly WG
Projects
None yet
Development

No branches or pull requests

6 participants