From 312cd77e01792acd97a922fdd854873be5b661cd Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 13 Aug 2025 17:17:34 -0700 Subject: [PATCH] Avoid `wasm-instantiate` run dependency when not using WASM_ASYNC_COMPILATION. NFC --- src/preamble.js | 5 ++++- test/code_size/test_unoptimized_code_size.json | 16 ++++++++-------- .../test_codesize_minimal_O0.expected.js | 5 ++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/preamble.js b/src/preamble.js index 6116378b89fb5..4a99a1a58e65d 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -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');") }}} diff --git a/test/code_size/test_unoptimized_code_size.json b/test/code_size/test_unoptimized_code_size.json index 7bc8dac1f6808..2a73aa8d38480 100644 --- a/test/code_size/test_unoptimized_code_size.json +++ b/test/code_size/test_unoptimized_code_size.json @@ -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 } diff --git a/test/other/codesize/test_codesize_minimal_O0.expected.js b/test/other/codesize/test_codesize_minimal_O0.expected.js index 34cc27f5d169e..f1214a7d0ed21 100644 --- a/test/other/codesize/test_codesize_minimal_O0.expected.js +++ b/test/other/codesize/test_codesize_minimal_O0.expected.js @@ -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. @@ -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;