Repository navigation
Add wasm_esm_integration_builtins compat flag for runtime-compiled Wasm - #7685
Open
guybedford wants to merge 3 commits into
Open
guybedford wants to merge 3 commits into
guybedford wants to merge 3 commits into
Conversation
Contributor
|
Since last review: 0 resolved, 0 still open, 0 new. Not re-run: tests, api-compat, docs, compat-flags, design-simplicity, jsg-gc, kj-style, memory-safety (no author changes in their files since the last review) Reviewed commit: b25c2849 · github run |
Compile Wasm modules with the js-string builtins and imported string
constants enabled, equivalent to the JS options
`{ builtins: ['js-string'], importedStringConstants: 'wasm:js/string-constants' }`.
These are strictly per-module opt-in in V8 with no global flag, so pass
them via WasmModuleObject::CompileOptions in jsg::compileWasmModule, which
covers all runtime-compiled Wasm: ESM import / import source in both module
registries, and the deprecated Service Worker syntax wasmModule binding.
The proposal is still in the implementation phase, so this is gated behind
the opt-in wasm_esm_integration_builtins compat flag with no enable date.
…matches A WebAssembly.Module passed to the worker loader carries compiled code that bakes in the compile-time imports of the isolate that compiled it. Both module registries previously reused that code unconditionally, so the child worker's wasm_esm_integration_builtins setting was never applied to loader- provided modules. Record the parent's mode alongside the compiled module and recompile from the wire bytes when the child's setting differs.
Covers the reverse direction of the compiled-module sharing check: a parent compiled with wasm_esm_integration_builtins passing a module to a child that has the flag disabled must recompile, so the child does not gain the builtins.
guybedford
force-pushed
the
gbedford/wasm-js-string-builtins
branch
from
October 10, 2026 06:37
62d89d9 to
b25c284
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a
wasm_esm_integration_builtinscompatibility flag that compiles Wasm modules with the js-string builtins and imported string constants enabled, resolves #6811. Equivalent to the JS-visible options:V8 has no global flag for these; they are strictly per-module opt-in, so workerd-compiled modules (which never go through the JS constructor) couldn't use them. V8 now exposes
WasmModuleObject::CompilewithCompileOptions, so when the flag is setjsg::compileWasmModulepasses:Since this is the single shared compile helper, it covers all runtime-compiled Wasm:
import/import sourcein both module registries, and the deprecated Service Worker syntaxwasmModulebinding. The flag is plumbed throughIsolateBaselike the other module-related compat flags.The js-string-builtins proposal is still in the implementation phase, so the flag is opt-in with no enable date.
Test coverage: adds a
js-string-builtins.watfixture importing the js-stringlengthbuiltin and a"hello world"string constant, which only links if both features are enabled.new-module-registry-test(flag on) assertsconstantLength()returns11across normal import, staticimport source, and dynamicimport.source(), using query-distinct specifiers so each path gets its own compile.wasm-js-string-builtins-test(flag off, legacy registry) asserts thewasm:js-stringimport is treated as an ordinary unsupplied import.