#940: JS String Builtins for WebAssembly
Discussions
2024-07-01
Looking to enlist some external expertise in this area. To review, get on a call, or find someone else.
stringref is a competing-ish proposal, but:
What I describe is what the stringref proposal gives you. We don’t yet have consensus on this proposal in the Wasm standardization group, and we may never reach there, although I think it’s still possible. As I understand them, the objections are two-fold:
WebAssembly is an instruction set, like AArch64 or x86. Strings are too high-level, and should be built on top, for example with (array i8).
The requirement to support fast WTF-16 code unit access will mean that we are effectively standardizing JavaScript strings.
That suggests that there are bodies buried in the vicinity.
2024-07-29
Martin: it's a big one and also not a big one... really interesting. there was some discussion in Seattle. But not enough time to get into it...
Dan: is there something that could be brought to our issue?
Martin: not right now... We need help. We need someone who has more context but is not directly connected to the work. It could be that this is non-contraversial in TC39...
2024-08-19
Thank you for your patience while waiting for us to take a look at this.
The <abbr title="Technical Architecture Group">TAG</abbr> currently lacks domain expertise in the internals of JavaScript and WASM implementations, so we're ill-equiped to do a deep dive here. You've clearly put a ton of effort into this, and your document more than adequately addresses the handful of things that came to our minds while reviewing it. We don't see any obvious issues with the proposal as it stands.
We'll close this review for now. Please let us know if your design substantively changes, and we'll take another look.
</blockquote>Posted and closed as satisfied.
2024-08-19
Yves: it makes sense. Would require people well versed in intricate optimisation of js engine to say if it's okay. They considered i18n, many issues, it makes sense
Tess: you can tell they put a lot of effort into it. We don't have the expertise. It's very dense. It's probably fine.
Yves: the fact they were discussing issues with different encodings and things like that is good
Tess: if you want someone who is not working on it and has all the domain knowledge...
Yves: the number of people able to know that is very limited
Amy: if there are no conflicts or issue with other things in the web platform, that's probably all we can bring at this point
Tess: I don't think it's architecturally unsound to do this. They do seem to be tackling someof the challenges head on.
Yves: did they have i18n review?
Tess: don't know what kind of HR the WASM folks do. A lot of this happens in the CG.
Yves: Looks good to us, but if they are looking at an edge case please ask the i18n WG to review this
Tess: works for me
Draft closing comment, to be reviewed before plenary:
<blockquote>Thank you for your patience while waiting for us to take a look at this.
Whenever dealing with strings on the web platform, <abbr title=internationalization>i18n</abbr> issues inevitably arise. Have the <abbr title=WebAssembly>WASM</abbr> folk gotten i18n review of this?
Otherwise, the <abbr title="Technical Architecture Group">TAG</abbr> currently lacks domain expertise in the internals of JavaScript and WASM implementations, so we're ill-equiped to do a deep dive here. You've clearly put a ton of effort into this, and your document more than adequately addresses the handful of things that came to our minds while reviewing it.
We'll close this review for now. Please let us know if your design substantively changes, and we'll take another look.
</blockquote>
OpenedMar 14, 2024
こんにちは TAG-さん!
I'm requesting a TAG review of JS String Builtins for WebAssembly.
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.
Further details:
You should also know that...
The current design is a result of extensive discussion in the Wasm CG over the past year (see above meeting notes), and follows a previous approach to dealing with strings directly in core Wasm, https://github.com/WebAssembly/stringref, which faced significant opposition in the CG.
We'd prefer the TAG provide feedback as (please delete all but the desired option):
💬 leave review feedback as a comment in this issue and @-notify eqrion and ajklein