From 4b73a6dcc9382047807bfb589d8ae19c91b702d7 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 15 Jan 2026 17:01:38 -0800 Subject: [PATCH 1/3] Shared string builtins Describe overloading the existing string builtins to be importable with shared versions of the existing signatures. --- proposals/shared-everything-threads/Overview.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/proposals/shared-everything-threads/Overview.md b/proposals/shared-everything-threads/Overview.md index 546010d..836179b 100644 --- a/proposals/shared-everything-threads/Overview.md +++ b/proposals/shared-everything-threads/Overview.md @@ -562,6 +562,18 @@ Waitqueue references are converted to `WebAssembly.WaitQueue` objects, described [proposal-structs]: https://github.com/tc39/proposal-structs +#### Shared String Builtins + +As mentioned above, JS strings will be able to be converted to `(ref extern)` or +`(ref (shared extern)` when entering WebAssembly. To facilitate working with shared strings, +the [string builtins][string-builtins] will each be updated to be importable with two function types: +the current function type using `extern` and a new function type that is equivalent except that 1) it +is shared, and 2) uses `(shared extern)` in place of `extern` (and also shared versions of any other +heap types, e.g. the array parameter in `fromCharCodeArray`). Mixing shared and unshared heap types +in the same signature is not allowed. + +[string-builtins]: https://webassembly.github.io/spec/js-api/#builtins-js-string + #### Shared Annotations Just like the original threads proposal exposed shared memories in the JS API, this proposal exposes From 7f4a48c70395fb233f310738d80f0fcdc2e92c1d Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 16 Jan 2026 10:59:39 -0800 Subject: [PATCH 2/3] Apply suggestion from @jakobkummerow Co-authored-by: jakobkummerow --- proposals/shared-everything-threads/Overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/shared-everything-threads/Overview.md b/proposals/shared-everything-threads/Overview.md index 836179b..97535c0 100644 --- a/proposals/shared-everything-threads/Overview.md +++ b/proposals/shared-everything-threads/Overview.md @@ -565,7 +565,7 @@ Waitqueue references are converted to `WebAssembly.WaitQueue` objects, described #### Shared String Builtins As mentioned above, JS strings will be able to be converted to `(ref extern)` or -`(ref (shared extern)` when entering WebAssembly. To facilitate working with shared strings, +`(ref (shared extern))` when entering WebAssembly. To facilitate working with shared strings, the [string builtins][string-builtins] will each be updated to be importable with two function types: the current function type using `extern` and a new function type that is equivalent except that 1) it is shared, and 2) uses `(shared extern)` in place of `extern` (and also shared versions of any other From 50f6497b0993b5bea5def0c2cdb82539a6553407 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 16 Jan 2026 11:06:38 -0800 Subject: [PATCH 3/3] Add paragraph about imported strings --- proposals/shared-everything-threads/Overview.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proposals/shared-everything-threads/Overview.md b/proposals/shared-everything-threads/Overview.md index 97535c0..451ccf6 100644 --- a/proposals/shared-everything-threads/Overview.md +++ b/proposals/shared-everything-threads/Overview.md @@ -572,6 +572,11 @@ is shared, and 2) uses `(shared extern)` in place of `extern` (and also shared v heap types, e.g. the array parameter in `fromCharCodeArray`). Mixing shared and unshared heap types in the same signature is not allowed. +Similarly, imported string constants can also be shared. They are imported from the same configured +`importedStringModule` as non-shared string constants, but are imported as globals with type +`(ref (shared extern))` or `(ref null (shared extern))`. Notably, no spec changes are required for +this to work once strings are allowed to enter Wasm as shared extern references. + [string-builtins]: https://webassembly.github.io/spec/js-api/#builtins-js-string #### Shared Annotations