Skip to content

Avoid wasm-instantiate run dependency when not using WASM_ASYNC_COMPILATION. NFC #24925

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

Merged
merged 1 commit into from
Aug 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/preamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,11 +895,14 @@ function getWasmImports() {
#if DECLARE_ASM_MODULE_EXPORTS
assignWasmExports(wasmExports);
#endif
#if WASM_ASYNC_COMPILATION
removeRunDependency('wasm-instantiate');
#endif
return wasmExports;
}
// wait for the pthread pool (if any)
#if WASM_ASYNC_COMPILATION
addRunDependency('wasm-instantiate');
#endif

#if LOAD_SOURCE_MAP
{{{ runIfMainThread("addRunDependency('source-map');") }}}
Expand Down
16 changes: 8 additions & 8 deletions test/code_size/test_unoptimized_code_size.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"hello_world.js": 54086,
"hello_world.js.gz": 17172,
"hello_world.js": 54043,
"hello_world.js.gz": 17154,
"hello_world.wasm": 15143,
"hello_world.wasm.gz": 7452,
"no_asserts.js": 26819,
"no_asserts.js.gz": 8991,
"no_asserts.js": 26776,
"no_asserts.js.gz": 8968,
"no_asserts.wasm": 12227,
"no_asserts.wasm.gz": 6008,
"strict.js": 52136,
"strict.js.gz": 16504,
"strict.js": 52093,
"strict.js.gz": 16485,
"strict.wasm": 15143,
"strict.wasm.gz": 7438,
"total": 175554,
"total_gz": 63565
"total": 175425,
"total_gz": 63505
}
5 changes: 2 additions & 3 deletions test/other/codesize/test_codesize_minimal_O0.expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,6 @@ async function createWasm() {
removeRunDependency('wasm-instantiate');
return wasmExports;
}
// wait for the pthread pool (if any)
addRunDependency('wasm-instantiate');

// Prefer streaming instantiation if available.
Expand Down Expand Up @@ -1311,8 +1310,8 @@ var _global_val = Module['_global_val'] = 65536;var wasmImports = {

var wasmExports;

// With async instantation wasmExports is assigned asyncronously when the
// the instance is received.
// With async instantation wasmExports is assigned asynchronously when the
// instance is received.
createWasm();

var calledRun;
Expand Down
Loading