From dd5920b9d5f05f7c6140a4d01d4b3f33cfd08683 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 27 Mar 2025 15:04:00 +0100 Subject: [PATCH 1/7] Move `sharedModules` object to `libcore.js` --- src/lib/libcore.js | 6 ++++++ src/lib/libdylink.js | 6 ++++++ src/lib/libpthread.js | 1 + src/postamble.js | 6 ------ test/test_core.py | 3 +++ test/test_other.py | 12 ++++++++++-- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/lib/libcore.js b/src/lib/libcore.js index a5a3c329e3f69..65079bfd82571 100644 --- a/src/lib/libcore.js +++ b/src/lib/libcore.js @@ -395,6 +395,12 @@ addToLibrary({ // the initial values of the environment accessible by getenv. $ENV: {}, +#if MAIN_MODULE && PTHREADS + // Map of modules to be shared with new threads. This gets populated by the + // main thread and shared with all new workers via the initial `load` message. + $sharedModules: {}, +#endif + #if !STANDALONE_WASM // ========================================================================== // assert.h diff --git a/src/lib/libdylink.js b/src/lib/libdylink.js index 6eb5e4fe635b7..b60543d7dda1f 100644 --- a/src/lib/libdylink.js +++ b/src/lib/libdylink.js @@ -599,6 +599,9 @@ var LibraryDylink = { '$updateTableMap', '$wasmTable', '$addOnPostCtor', +#if PTHREADS + '$sharedModules', +#endif ], $loadWebAssemblyModule: (binary, flags, libName, localScope, handle) => { #if DYLINK_DEBUG @@ -952,6 +955,9 @@ var LibraryDylink = { #endif #if DYNCALLS || !WASM_BIGINT '$registerDynCallSymbols', +#endif +#if PTHREADS + '$sharedModules', #endif ], $loadDynamicLibrary__docs: ` diff --git a/src/lib/libpthread.js b/src/lib/libpthread.js index 38582276c55f4..d1e1234d48d20 100644 --- a/src/lib/libpthread.js +++ b/src/lib/libpthread.js @@ -63,6 +63,7 @@ var LibraryPThread = { '$addOnPreRun', #if MAIN_MODULE '$markAsFinished', + '$sharedModules', #endif '$spawnThread', '_emscripten_thread_free_data', diff --git a/src/postamble.js b/src/postamble.js index 3785f3f29da66..06728478ec55e 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -132,12 +132,6 @@ function stackCheckInit() { } #endif -#if MAIN_MODULE && PTHREADS -// Map of modules to be shared with new threads. This gets populated by the -// main thread and shared with all new workers via the initial `load` message. -var sharedModules = {}; -#endif - #if MAIN_READS_PARAMS function run(args = arguments_) { #else diff --git a/test/test_core.py b/test/test_core.py index 2495ad84ced8d..3e2630e3e412b 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -9320,6 +9320,9 @@ def test_Module_dynamicLibraries(self, args): create_file('lib.js', ''' addToLibrary({ +#if PTHREADS + mainCallback__deps: ['$sharedModules'], +#endif mainCallback: () => { #if PTHREADS err('sharedModules: ' + Object.keys(sharedModules)); diff --git a/test/test_other.py b/test/test_other.py index e336e41ec54df..2acde697b5d7d 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -15265,6 +15265,10 @@ def test_preload_module(self, args): #include #include + #ifdef __EMSCRIPTEN_PTHREADS__ + EM_JS_DEPS(main, "$sharedModules"); + #endif + int main() { // Check the file exists in the VFS struct stat statbuf; @@ -15272,19 +15276,23 @@ def test_preload_module(self, args): // Check that it was preloaded. // The preloading actually only happens on the main thread where the filesystem - // lives. On worker threads the module object is shared via preloadedModules. + // lives. On worker threads the module object is shared via sharedModules. if (emscripten_is_main_runtime_thread()) { int found = EM_ASM_INT( return preloadedWasm['/library.so'] !== undefined; ); assert(found); - } else { + } + #ifdef __EMSCRIPTEN_PTHREADS__ + else { int found = EM_ASM_INT( err(sharedModules); return sharedModules['/library.so'] !== undefined; ); assert(found); } + #endif + void *lib_handle = dlopen("/library.so", RTLD_NOW); assert(lib_handle); typedef int (*voidfunc)(); From da0b4df48a9bc1f6d55909416fdc71e90591ff44 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 27 Mar 2025 17:38:13 +0100 Subject: [PATCH 2/7] Revert unnecessary test changes --- test/test_core.py | 3 --- test/test_other.py | 10 +--------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/test/test_core.py b/test/test_core.py index 3e2630e3e412b..2495ad84ced8d 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -9320,9 +9320,6 @@ def test_Module_dynamicLibraries(self, args): create_file('lib.js', ''' addToLibrary({ -#if PTHREADS - mainCallback__deps: ['$sharedModules'], -#endif mainCallback: () => { #if PTHREADS err('sharedModules: ' + Object.keys(sharedModules)); diff --git a/test/test_other.py b/test/test_other.py index 2acde697b5d7d..e621b1c460681 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -15265,10 +15265,6 @@ def test_preload_module(self, args): #include #include - #ifdef __EMSCRIPTEN_PTHREADS__ - EM_JS_DEPS(main, "$sharedModules"); - #endif - int main() { // Check the file exists in the VFS struct stat statbuf; @@ -15282,17 +15278,13 @@ def test_preload_module(self, args): return preloadedWasm['/library.so'] !== undefined; ); assert(found); - } - #ifdef __EMSCRIPTEN_PTHREADS__ - else { + } else { int found = EM_ASM_INT( err(sharedModules); return sharedModules['/library.so'] !== undefined; ); assert(found); } - #endif - void *lib_handle = dlopen("/library.so", RTLD_NOW); assert(lib_handle); typedef int (*voidfunc)(); From ba18f68215e0a7b202c17871a6aad8d39424b16a Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 27 Mar 2025 17:40:47 +0100 Subject: [PATCH 3/7] Incorporate review comment --- src/lib/libcore.js | 6 ------ src/lib/libdylink.js | 6 ------ src/lib/libpthread.js | 1 - src/runtime_pthread.js | 6 ++++++ 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/lib/libcore.js b/src/lib/libcore.js index 65079bfd82571..a5a3c329e3f69 100644 --- a/src/lib/libcore.js +++ b/src/lib/libcore.js @@ -395,12 +395,6 @@ addToLibrary({ // the initial values of the environment accessible by getenv. $ENV: {}, -#if MAIN_MODULE && PTHREADS - // Map of modules to be shared with new threads. This gets populated by the - // main thread and shared with all new workers via the initial `load` message. - $sharedModules: {}, -#endif - #if !STANDALONE_WASM // ========================================================================== // assert.h diff --git a/src/lib/libdylink.js b/src/lib/libdylink.js index b60543d7dda1f..6eb5e4fe635b7 100644 --- a/src/lib/libdylink.js +++ b/src/lib/libdylink.js @@ -599,9 +599,6 @@ var LibraryDylink = { '$updateTableMap', '$wasmTable', '$addOnPostCtor', -#if PTHREADS - '$sharedModules', -#endif ], $loadWebAssemblyModule: (binary, flags, libName, localScope, handle) => { #if DYLINK_DEBUG @@ -955,9 +952,6 @@ var LibraryDylink = { #endif #if DYNCALLS || !WASM_BIGINT '$registerDynCallSymbols', -#endif -#if PTHREADS - '$sharedModules', #endif ], $loadDynamicLibrary__docs: ` diff --git a/src/lib/libpthread.js b/src/lib/libpthread.js index d1e1234d48d20..38582276c55f4 100644 --- a/src/lib/libpthread.js +++ b/src/lib/libpthread.js @@ -63,7 +63,6 @@ var LibraryPThread = { '$addOnPreRun', #if MAIN_MODULE '$markAsFinished', - '$sharedModules', #endif '$spawnThread', '_emscripten_thread_free_data', diff --git a/src/runtime_pthread.js b/src/runtime_pthread.js index 15eb085d71f40..86aed2a1be28e 100644 --- a/src/runtime_pthread.js +++ b/src/runtime_pthread.js @@ -14,6 +14,12 @@ var workerID = 0; #endif +#if MAIN_MODULE +// Map of modules to be shared with new threads. This gets populated by the +// main thread and shared with all new workers via the initial `load` message. +var sharedModules = {}; +#endif + if (ENVIRONMENT_IS_PTHREAD) { #if !MINIMAL_RUNTIME var wasmModuleReceived; From 3854ac7192d6a9158c7851faf75a438c53ceb545 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 27 Mar 2025 18:57:51 +0100 Subject: [PATCH 4/7] Add test --- test/test_other.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/test_other.py b/test/test_other.py index e621b1c460681..99d27f412a16d 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -2175,6 +2175,29 @@ def test(link_flags, lib_suffix): test(['-lfile'], '') # -l, auto detection from library path test(['libdir/libfile.so.3.1.4.1.5.9'], '.3.1.4.1.5.9') # handle libX.so.1.2.3 as well + @node_pthreads + @also_with_modularize + def test_dylink_pthread(self): + create_file('library.c', r''' + int answer() { + return 42; + } + ''') + self.run_process([EMCC, 'library.c', '-pthread', '-Wno-experimental', '-sSIDE_MODULE', '-o', 'side.wasm']) + create_file('main.c', r''' + #include + #include + + extern int answer(); + + int main() { + assert(answer() == 42); + printf("done\n"); + return 0; + } + ''') + self.do_runf('main.c', 'done\n', emcc_args=['-sMAIN_MODULE=2', '-pthread', '-Wno-experimental', 'side.wasm']) + @node_pthreads def test_dylink_pthread_static_data(self): # Test that a side module uses the same static data region for global objects across all threads From 995c887f02f439c8f04e067b1b1903c36177fea7 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 27 Mar 2025 19:08:29 +0100 Subject: [PATCH 5/7] Automatic rebaseline of codesize expectations. NFC This is an automatic change generated by tools/maint/rebaseline_tests.py. The following (25) test expectation files were updated by running the tests with `--rebaseline`: ``` code_size/embind_hello_wasm.json: 16994 => 16994 [+0 bytes / +0.00%] code_size/embind_val_wasm.json: 16647 => 16647 [+0 bytes / +0.00%] code_size/hello_webgl2_wasm.json: 13122 => 13122 [+0 bytes / +0.00%] code_size/hello_webgl2_wasm2js.json: 18420 => 18420 [+0 bytes / +0.00%] code_size/hello_webgl_wasm.json: 12660 => 12660 [+0 bytes / +0.00%] code_size/hello_webgl_wasm2js.json: 17947 => 17947 [+0 bytes / +0.00%] code_size/random_printf_wasm.json: 12494 => 12494 [+0 bytes / +0.00%] code_size/random_printf_wasm2js.json: 17262 => 17262 [+0 bytes / +0.00%] other/codesize/test_codesize_cxx_ctors1.gzsize: 8219 => 8244 [+25 bytes / +0.30%] other/codesize/test_codesize_cxx_ctors2.gzsize: 8207 => 8232 [+25 bytes / +0.30%] other/codesize/test_codesize_cxx_except.gzsize: 9217 => 9239 [+22 bytes / +0.24%] other/codesize/test_codesize_cxx_except_wasm.gzsize: 8165 => 8190 [+25 bytes / +0.31%] other/codesize/test_codesize_cxx_except_wasm_legacy.gzsize: 8165 => 8190 [+25 bytes / +0.31%] other/codesize/test_codesize_cxx_lto.gzsize: 8234 => 8258 [+24 bytes / +0.29%] other/codesize/test_codesize_cxx_mangle.gzsize: 9255 => 9279 [+24 bytes / +0.26%] other/codesize/test_codesize_cxx_noexcept.gzsize: 8219 => 8244 [+25 bytes / +0.30%] other/codesize/test_codesize_cxx_wasmfs.gzsize: 3440 => 3444 [+4 bytes / +0.12%] other/codesize/test_codesize_files_js_fs.gzsize: 7528 => 7544 [+16 bytes / +0.21%] other/codesize/test_codesize_files_wasmfs.gzsize: 2682 => 2685 [+3 bytes / +0.11%] other/codesize/test_codesize_hello_O0.gzsize: 7940 => 7958 [+18 bytes / +0.23%] other/codesize/test_codesize_hello_O1.gzsize: 2547 => 2548 [+1 bytes / +0.04%] other/codesize/test_codesize_hello_dylink.gzsize: 5860 => 5866 [+6 bytes / +0.10%] other/codesize/test_codesize_hello_single_file.gzsize: 3690 => 3693 [+3 bytes / +0.08%] other/codesize/test_codesize_minimal_O0.gzsize: 6284 => 6296 [+12 bytes / +0.19%] other/codesize/test_codesize_minimal_pthreads.gzsize: 4037 => 4042 [+5 bytes / +0.12%] Average change: +0.14% (+0.00% - +0.31%) ``` --- test/code_size/embind_hello_wasm.json | 6 +++--- test/code_size/embind_val_wasm.json | 6 +++--- test/code_size/hello_webgl2_wasm.json | 4 ++-- test/code_size/hello_webgl2_wasm2js.json | 4 ++-- test/code_size/hello_webgl_wasm.json | 4 ++-- test/code_size/hello_webgl_wasm2js.json | 4 ++-- test/code_size/random_printf_wasm.json | 4 ++-- test/code_size/random_printf_wasm2js.json | 4 ++-- test/other/codesize/test_codesize_cxx_ctors1.gzsize | 2 +- test/other/codesize/test_codesize_cxx_ctors2.gzsize | 2 +- test/other/codesize/test_codesize_cxx_except.gzsize | 2 +- test/other/codesize/test_codesize_cxx_except_wasm.gzsize | 2 +- .../codesize/test_codesize_cxx_except_wasm_legacy.gzsize | 2 +- test/other/codesize/test_codesize_cxx_lto.gzsize | 2 +- test/other/codesize/test_codesize_cxx_mangle.gzsize | 2 +- test/other/codesize/test_codesize_cxx_noexcept.gzsize | 2 +- test/other/codesize/test_codesize_cxx_wasmfs.gzsize | 2 +- test/other/codesize/test_codesize_files_js_fs.gzsize | 2 +- test/other/codesize/test_codesize_files_wasmfs.gzsize | 2 +- test/other/codesize/test_codesize_hello_O0.gzsize | 2 +- test/other/codesize/test_codesize_hello_O1.gzsize | 2 +- test/other/codesize/test_codesize_hello_dylink.gzsize | 2 +- test/other/codesize/test_codesize_hello_single_file.gzsize | 2 +- test/other/codesize/test_codesize_minimal_O0.gzsize | 2 +- test/other/codesize/test_codesize_minimal_pthreads.gzsize | 2 +- 25 files changed, 35 insertions(+), 35 deletions(-) diff --git a/test/code_size/embind_hello_wasm.json b/test/code_size/embind_hello_wasm.json index 2fcd2e346f049..8c39761c0b71b 100644 --- a/test/code_size/embind_hello_wasm.json +++ b/test/code_size/embind_hello_wasm.json @@ -2,9 +2,9 @@ "a.html": 552, "a.html.gz": 380, "a.js": 9094, - "a.js.gz": 3993, + "a.js.gz": 4002, "a.wasm": 7348, - "a.wasm.gz": 3378, + "a.wasm.gz": 3379, "total": 16994, - "total_gz": 7751 + "total_gz": 7761 } diff --git a/test/code_size/embind_val_wasm.json b/test/code_size/embind_val_wasm.json index 141f08c8f3bfd..25e8952d6b5db 100644 --- a/test/code_size/embind_val_wasm.json +++ b/test/code_size/embind_val_wasm.json @@ -2,9 +2,9 @@ "a.html": 552, "a.html.gz": 380, "a.js": 6940, - "a.js.gz": 3000, + "a.js.gz": 3001, "a.wasm": 9155, - "a.wasm.gz": 4722, + "a.wasm.gz": 4725, "total": 16647, - "total_gz": 8102 + "total_gz": 8106 } diff --git a/test/code_size/hello_webgl2_wasm.json b/test/code_size/hello_webgl2_wasm.json index 615e1ec8f922a..8f3328f397712 100644 --- a/test/code_size/hello_webgl2_wasm.json +++ b/test/code_size/hello_webgl2_wasm.json @@ -4,7 +4,7 @@ "a.js": 4382, "a.js.gz": 2251, "a.wasm": 8286, - "a.wasm.gz": 5617, + "a.wasm.gz": 5618, "total": 13122, - "total_gz": 8196 + "total_gz": 8197 } diff --git a/test/code_size/hello_webgl2_wasm2js.json b/test/code_size/hello_webgl2_wasm2js.json index a16aec433c5ca..2f37a6b5e10ac 100644 --- a/test/code_size/hello_webgl2_wasm2js.json +++ b/test/code_size/hello_webgl2_wasm2js.json @@ -2,7 +2,7 @@ "a.html": 346, "a.html.gz": 262, "a.js": 18074, - "a.js.gz": 9773, + "a.js.gz": 9808, "total": 18420, - "total_gz": 10035 + "total_gz": 10070 } diff --git a/test/code_size/hello_webgl_wasm.json b/test/code_size/hello_webgl_wasm.json index a36f5c68782cf..f289b17d42f26 100644 --- a/test/code_size/hello_webgl_wasm.json +++ b/test/code_size/hello_webgl_wasm.json @@ -4,7 +4,7 @@ "a.js": 3920, "a.js.gz": 2089, "a.wasm": 8286, - "a.wasm.gz": 5617, + "a.wasm.gz": 5618, "total": 12660, - "total_gz": 8034 + "total_gz": 8035 } diff --git a/test/code_size/hello_webgl_wasm2js.json b/test/code_size/hello_webgl_wasm2js.json index 0f1d034fd4e06..370e78e9f0a3f 100644 --- a/test/code_size/hello_webgl_wasm2js.json +++ b/test/code_size/hello_webgl_wasm2js.json @@ -2,7 +2,7 @@ "a.html": 346, "a.html.gz": 262, "a.js": 17601, - "a.js.gz": 9608, + "a.js.gz": 9639, "total": 17947, - "total_gz": 9870 + "total_gz": 9901 } diff --git a/test/code_size/random_printf_wasm.json b/test/code_size/random_printf_wasm.json index 1e0edd812059a..aa879d5ceafb8 100644 --- a/test/code_size/random_printf_wasm.json +++ b/test/code_size/random_printf_wasm.json @@ -1,6 +1,6 @@ { "a.html": 12494, - "a.html.gz": 6820, + "a.html.gz": 6843, "total": 12494, - "total_gz": 6820 + "total_gz": 6843 } diff --git a/test/code_size/random_printf_wasm2js.json b/test/code_size/random_printf_wasm2js.json index e4aeb83a30f5f..e3fe269065c9c 100644 --- a/test/code_size/random_printf_wasm2js.json +++ b/test/code_size/random_printf_wasm2js.json @@ -1,6 +1,6 @@ { "a.html": 17262, - "a.html.gz": 7542, + "a.html.gz": 7568, "total": 17262, - "total_gz": 7542 + "total_gz": 7568 } diff --git a/test/other/codesize/test_codesize_cxx_ctors1.gzsize b/test/other/codesize/test_codesize_cxx_ctors1.gzsize index 47d8481e26395..8302b01826eac 100644 --- a/test/other/codesize/test_codesize_cxx_ctors1.gzsize +++ b/test/other/codesize/test_codesize_cxx_ctors1.gzsize @@ -1 +1 @@ -8219 +8244 diff --git a/test/other/codesize/test_codesize_cxx_ctors2.gzsize b/test/other/codesize/test_codesize_cxx_ctors2.gzsize index 348fae5d25831..d8f3dc7482479 100644 --- a/test/other/codesize/test_codesize_cxx_ctors2.gzsize +++ b/test/other/codesize/test_codesize_cxx_ctors2.gzsize @@ -1 +1 @@ -8207 +8232 diff --git a/test/other/codesize/test_codesize_cxx_except.gzsize b/test/other/codesize/test_codesize_cxx_except.gzsize index a7c037571b56e..7df5f58064c29 100644 --- a/test/other/codesize/test_codesize_cxx_except.gzsize +++ b/test/other/codesize/test_codesize_cxx_except.gzsize @@ -1 +1 @@ -9217 +9239 diff --git a/test/other/codesize/test_codesize_cxx_except_wasm.gzsize b/test/other/codesize/test_codesize_cxx_except_wasm.gzsize index a6fb412e17821..65a282dc9f29a 100644 --- a/test/other/codesize/test_codesize_cxx_except_wasm.gzsize +++ b/test/other/codesize/test_codesize_cxx_except_wasm.gzsize @@ -1 +1 @@ -8165 +8190 diff --git a/test/other/codesize/test_codesize_cxx_except_wasm_legacy.gzsize b/test/other/codesize/test_codesize_cxx_except_wasm_legacy.gzsize index a6fb412e17821..65a282dc9f29a 100644 --- a/test/other/codesize/test_codesize_cxx_except_wasm_legacy.gzsize +++ b/test/other/codesize/test_codesize_cxx_except_wasm_legacy.gzsize @@ -1 +1 @@ -8165 +8190 diff --git a/test/other/codesize/test_codesize_cxx_lto.gzsize b/test/other/codesize/test_codesize_cxx_lto.gzsize index 0b9cf696bb395..dd601261add0e 100644 --- a/test/other/codesize/test_codesize_cxx_lto.gzsize +++ b/test/other/codesize/test_codesize_cxx_lto.gzsize @@ -1 +1 @@ -8234 +8258 diff --git a/test/other/codesize/test_codesize_cxx_mangle.gzsize b/test/other/codesize/test_codesize_cxx_mangle.gzsize index d5ba7638b38b0..4a1c9b53b9bb8 100644 --- a/test/other/codesize/test_codesize_cxx_mangle.gzsize +++ b/test/other/codesize/test_codesize_cxx_mangle.gzsize @@ -1 +1 @@ -9255 +9279 diff --git a/test/other/codesize/test_codesize_cxx_noexcept.gzsize b/test/other/codesize/test_codesize_cxx_noexcept.gzsize index 47d8481e26395..8302b01826eac 100644 --- a/test/other/codesize/test_codesize_cxx_noexcept.gzsize +++ b/test/other/codesize/test_codesize_cxx_noexcept.gzsize @@ -1 +1 @@ -8219 +8244 diff --git a/test/other/codesize/test_codesize_cxx_wasmfs.gzsize b/test/other/codesize/test_codesize_cxx_wasmfs.gzsize index ce6800c84df61..6486a3aaf5ba3 100644 --- a/test/other/codesize/test_codesize_cxx_wasmfs.gzsize +++ b/test/other/codesize/test_codesize_cxx_wasmfs.gzsize @@ -1 +1 @@ -3440 +3444 diff --git a/test/other/codesize/test_codesize_files_js_fs.gzsize b/test/other/codesize/test_codesize_files_js_fs.gzsize index ef8e0e613aa5d..f0b6611c0e0c3 100644 --- a/test/other/codesize/test_codesize_files_js_fs.gzsize +++ b/test/other/codesize/test_codesize_files_js_fs.gzsize @@ -1 +1 @@ -7528 +7544 diff --git a/test/other/codesize/test_codesize_files_wasmfs.gzsize b/test/other/codesize/test_codesize_files_wasmfs.gzsize index 1f62501d6c9d3..47fe54a35ade7 100644 --- a/test/other/codesize/test_codesize_files_wasmfs.gzsize +++ b/test/other/codesize/test_codesize_files_wasmfs.gzsize @@ -1 +1 @@ -2682 +2685 diff --git a/test/other/codesize/test_codesize_hello_O0.gzsize b/test/other/codesize/test_codesize_hello_O0.gzsize index b59bd0a89971a..ec712152324cd 100644 --- a/test/other/codesize/test_codesize_hello_O0.gzsize +++ b/test/other/codesize/test_codesize_hello_O0.gzsize @@ -1 +1 @@ -7940 +7958 diff --git a/test/other/codesize/test_codesize_hello_O1.gzsize b/test/other/codesize/test_codesize_hello_O1.gzsize index efbf27c074661..5cf23a56c5b19 100644 --- a/test/other/codesize/test_codesize_hello_O1.gzsize +++ b/test/other/codesize/test_codesize_hello_O1.gzsize @@ -1 +1 @@ -2547 +2548 diff --git a/test/other/codesize/test_codesize_hello_dylink.gzsize b/test/other/codesize/test_codesize_hello_dylink.gzsize index 3fb524c7bdfc3..69b0804d31634 100644 --- a/test/other/codesize/test_codesize_hello_dylink.gzsize +++ b/test/other/codesize/test_codesize_hello_dylink.gzsize @@ -1 +1 @@ -5860 +5866 diff --git a/test/other/codesize/test_codesize_hello_single_file.gzsize b/test/other/codesize/test_codesize_hello_single_file.gzsize index efeb812131571..7f0e18ca00cc8 100644 --- a/test/other/codesize/test_codesize_hello_single_file.gzsize +++ b/test/other/codesize/test_codesize_hello_single_file.gzsize @@ -1 +1 @@ -3690 +3693 diff --git a/test/other/codesize/test_codesize_minimal_O0.gzsize b/test/other/codesize/test_codesize_minimal_O0.gzsize index 3352be8311244..db19baab5693c 100644 --- a/test/other/codesize/test_codesize_minimal_O0.gzsize +++ b/test/other/codesize/test_codesize_minimal_O0.gzsize @@ -1 +1 @@ -6284 +6296 diff --git a/test/other/codesize/test_codesize_minimal_pthreads.gzsize b/test/other/codesize/test_codesize_minimal_pthreads.gzsize index cc3387d70aed5..97a67bc728a46 100644 --- a/test/other/codesize/test_codesize_minimal_pthreads.gzsize +++ b/test/other/codesize/test_codesize_minimal_pthreads.gzsize @@ -1 +1 @@ -4037 +4042 From 35fbdb37d22af0e00272fca1a794d36b5e3bc3d9 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 27 Mar 2025 19:08:46 +0100 Subject: [PATCH 6/7] Revert "Automatic rebaseline of codesize expectations. NFC" This reverts commit 995c887f02f439c8f04e067b1b1903c36177fea7. --- test/code_size/embind_hello_wasm.json | 6 +++--- test/code_size/embind_val_wasm.json | 6 +++--- test/code_size/hello_webgl2_wasm.json | 4 ++-- test/code_size/hello_webgl2_wasm2js.json | 4 ++-- test/code_size/hello_webgl_wasm.json | 4 ++-- test/code_size/hello_webgl_wasm2js.json | 4 ++-- test/code_size/random_printf_wasm.json | 4 ++-- test/code_size/random_printf_wasm2js.json | 4 ++-- test/other/codesize/test_codesize_cxx_ctors1.gzsize | 2 +- test/other/codesize/test_codesize_cxx_ctors2.gzsize | 2 +- test/other/codesize/test_codesize_cxx_except.gzsize | 2 +- test/other/codesize/test_codesize_cxx_except_wasm.gzsize | 2 +- .../codesize/test_codesize_cxx_except_wasm_legacy.gzsize | 2 +- test/other/codesize/test_codesize_cxx_lto.gzsize | 2 +- test/other/codesize/test_codesize_cxx_mangle.gzsize | 2 +- test/other/codesize/test_codesize_cxx_noexcept.gzsize | 2 +- test/other/codesize/test_codesize_cxx_wasmfs.gzsize | 2 +- test/other/codesize/test_codesize_files_js_fs.gzsize | 2 +- test/other/codesize/test_codesize_files_wasmfs.gzsize | 2 +- test/other/codesize/test_codesize_hello_O0.gzsize | 2 +- test/other/codesize/test_codesize_hello_O1.gzsize | 2 +- test/other/codesize/test_codesize_hello_dylink.gzsize | 2 +- test/other/codesize/test_codesize_hello_single_file.gzsize | 2 +- test/other/codesize/test_codesize_minimal_O0.gzsize | 2 +- test/other/codesize/test_codesize_minimal_pthreads.gzsize | 2 +- 25 files changed, 35 insertions(+), 35 deletions(-) diff --git a/test/code_size/embind_hello_wasm.json b/test/code_size/embind_hello_wasm.json index 8c39761c0b71b..2fcd2e346f049 100644 --- a/test/code_size/embind_hello_wasm.json +++ b/test/code_size/embind_hello_wasm.json @@ -2,9 +2,9 @@ "a.html": 552, "a.html.gz": 380, "a.js": 9094, - "a.js.gz": 4002, + "a.js.gz": 3993, "a.wasm": 7348, - "a.wasm.gz": 3379, + "a.wasm.gz": 3378, "total": 16994, - "total_gz": 7761 + "total_gz": 7751 } diff --git a/test/code_size/embind_val_wasm.json b/test/code_size/embind_val_wasm.json index 25e8952d6b5db..141f08c8f3bfd 100644 --- a/test/code_size/embind_val_wasm.json +++ b/test/code_size/embind_val_wasm.json @@ -2,9 +2,9 @@ "a.html": 552, "a.html.gz": 380, "a.js": 6940, - "a.js.gz": 3001, + "a.js.gz": 3000, "a.wasm": 9155, - "a.wasm.gz": 4725, + "a.wasm.gz": 4722, "total": 16647, - "total_gz": 8106 + "total_gz": 8102 } diff --git a/test/code_size/hello_webgl2_wasm.json b/test/code_size/hello_webgl2_wasm.json index 8f3328f397712..615e1ec8f922a 100644 --- a/test/code_size/hello_webgl2_wasm.json +++ b/test/code_size/hello_webgl2_wasm.json @@ -4,7 +4,7 @@ "a.js": 4382, "a.js.gz": 2251, "a.wasm": 8286, - "a.wasm.gz": 5618, + "a.wasm.gz": 5617, "total": 13122, - "total_gz": 8197 + "total_gz": 8196 } diff --git a/test/code_size/hello_webgl2_wasm2js.json b/test/code_size/hello_webgl2_wasm2js.json index 2f37a6b5e10ac..a16aec433c5ca 100644 --- a/test/code_size/hello_webgl2_wasm2js.json +++ b/test/code_size/hello_webgl2_wasm2js.json @@ -2,7 +2,7 @@ "a.html": 346, "a.html.gz": 262, "a.js": 18074, - "a.js.gz": 9808, + "a.js.gz": 9773, "total": 18420, - "total_gz": 10070 + "total_gz": 10035 } diff --git a/test/code_size/hello_webgl_wasm.json b/test/code_size/hello_webgl_wasm.json index f289b17d42f26..a36f5c68782cf 100644 --- a/test/code_size/hello_webgl_wasm.json +++ b/test/code_size/hello_webgl_wasm.json @@ -4,7 +4,7 @@ "a.js": 3920, "a.js.gz": 2089, "a.wasm": 8286, - "a.wasm.gz": 5618, + "a.wasm.gz": 5617, "total": 12660, - "total_gz": 8035 + "total_gz": 8034 } diff --git a/test/code_size/hello_webgl_wasm2js.json b/test/code_size/hello_webgl_wasm2js.json index 370e78e9f0a3f..0f1d034fd4e06 100644 --- a/test/code_size/hello_webgl_wasm2js.json +++ b/test/code_size/hello_webgl_wasm2js.json @@ -2,7 +2,7 @@ "a.html": 346, "a.html.gz": 262, "a.js": 17601, - "a.js.gz": 9639, + "a.js.gz": 9608, "total": 17947, - "total_gz": 9901 + "total_gz": 9870 } diff --git a/test/code_size/random_printf_wasm.json b/test/code_size/random_printf_wasm.json index aa879d5ceafb8..1e0edd812059a 100644 --- a/test/code_size/random_printf_wasm.json +++ b/test/code_size/random_printf_wasm.json @@ -1,6 +1,6 @@ { "a.html": 12494, - "a.html.gz": 6843, + "a.html.gz": 6820, "total": 12494, - "total_gz": 6843 + "total_gz": 6820 } diff --git a/test/code_size/random_printf_wasm2js.json b/test/code_size/random_printf_wasm2js.json index e3fe269065c9c..e4aeb83a30f5f 100644 --- a/test/code_size/random_printf_wasm2js.json +++ b/test/code_size/random_printf_wasm2js.json @@ -1,6 +1,6 @@ { "a.html": 17262, - "a.html.gz": 7568, + "a.html.gz": 7542, "total": 17262, - "total_gz": 7568 + "total_gz": 7542 } diff --git a/test/other/codesize/test_codesize_cxx_ctors1.gzsize b/test/other/codesize/test_codesize_cxx_ctors1.gzsize index 8302b01826eac..47d8481e26395 100644 --- a/test/other/codesize/test_codesize_cxx_ctors1.gzsize +++ b/test/other/codesize/test_codesize_cxx_ctors1.gzsize @@ -1 +1 @@ -8244 +8219 diff --git a/test/other/codesize/test_codesize_cxx_ctors2.gzsize b/test/other/codesize/test_codesize_cxx_ctors2.gzsize index d8f3dc7482479..348fae5d25831 100644 --- a/test/other/codesize/test_codesize_cxx_ctors2.gzsize +++ b/test/other/codesize/test_codesize_cxx_ctors2.gzsize @@ -1 +1 @@ -8232 +8207 diff --git a/test/other/codesize/test_codesize_cxx_except.gzsize b/test/other/codesize/test_codesize_cxx_except.gzsize index 7df5f58064c29..a7c037571b56e 100644 --- a/test/other/codesize/test_codesize_cxx_except.gzsize +++ b/test/other/codesize/test_codesize_cxx_except.gzsize @@ -1 +1 @@ -9239 +9217 diff --git a/test/other/codesize/test_codesize_cxx_except_wasm.gzsize b/test/other/codesize/test_codesize_cxx_except_wasm.gzsize index 65a282dc9f29a..a6fb412e17821 100644 --- a/test/other/codesize/test_codesize_cxx_except_wasm.gzsize +++ b/test/other/codesize/test_codesize_cxx_except_wasm.gzsize @@ -1 +1 @@ -8190 +8165 diff --git a/test/other/codesize/test_codesize_cxx_except_wasm_legacy.gzsize b/test/other/codesize/test_codesize_cxx_except_wasm_legacy.gzsize index 65a282dc9f29a..a6fb412e17821 100644 --- a/test/other/codesize/test_codesize_cxx_except_wasm_legacy.gzsize +++ b/test/other/codesize/test_codesize_cxx_except_wasm_legacy.gzsize @@ -1 +1 @@ -8190 +8165 diff --git a/test/other/codesize/test_codesize_cxx_lto.gzsize b/test/other/codesize/test_codesize_cxx_lto.gzsize index dd601261add0e..0b9cf696bb395 100644 --- a/test/other/codesize/test_codesize_cxx_lto.gzsize +++ b/test/other/codesize/test_codesize_cxx_lto.gzsize @@ -1 +1 @@ -8258 +8234 diff --git a/test/other/codesize/test_codesize_cxx_mangle.gzsize b/test/other/codesize/test_codesize_cxx_mangle.gzsize index 4a1c9b53b9bb8..d5ba7638b38b0 100644 --- a/test/other/codesize/test_codesize_cxx_mangle.gzsize +++ b/test/other/codesize/test_codesize_cxx_mangle.gzsize @@ -1 +1 @@ -9279 +9255 diff --git a/test/other/codesize/test_codesize_cxx_noexcept.gzsize b/test/other/codesize/test_codesize_cxx_noexcept.gzsize index 8302b01826eac..47d8481e26395 100644 --- a/test/other/codesize/test_codesize_cxx_noexcept.gzsize +++ b/test/other/codesize/test_codesize_cxx_noexcept.gzsize @@ -1 +1 @@ -8244 +8219 diff --git a/test/other/codesize/test_codesize_cxx_wasmfs.gzsize b/test/other/codesize/test_codesize_cxx_wasmfs.gzsize index 6486a3aaf5ba3..ce6800c84df61 100644 --- a/test/other/codesize/test_codesize_cxx_wasmfs.gzsize +++ b/test/other/codesize/test_codesize_cxx_wasmfs.gzsize @@ -1 +1 @@ -3444 +3440 diff --git a/test/other/codesize/test_codesize_files_js_fs.gzsize b/test/other/codesize/test_codesize_files_js_fs.gzsize index f0b6611c0e0c3..ef8e0e613aa5d 100644 --- a/test/other/codesize/test_codesize_files_js_fs.gzsize +++ b/test/other/codesize/test_codesize_files_js_fs.gzsize @@ -1 +1 @@ -7544 +7528 diff --git a/test/other/codesize/test_codesize_files_wasmfs.gzsize b/test/other/codesize/test_codesize_files_wasmfs.gzsize index 47fe54a35ade7..1f62501d6c9d3 100644 --- a/test/other/codesize/test_codesize_files_wasmfs.gzsize +++ b/test/other/codesize/test_codesize_files_wasmfs.gzsize @@ -1 +1 @@ -2685 +2682 diff --git a/test/other/codesize/test_codesize_hello_O0.gzsize b/test/other/codesize/test_codesize_hello_O0.gzsize index ec712152324cd..b59bd0a89971a 100644 --- a/test/other/codesize/test_codesize_hello_O0.gzsize +++ b/test/other/codesize/test_codesize_hello_O0.gzsize @@ -1 +1 @@ -7958 +7940 diff --git a/test/other/codesize/test_codesize_hello_O1.gzsize b/test/other/codesize/test_codesize_hello_O1.gzsize index 5cf23a56c5b19..efbf27c074661 100644 --- a/test/other/codesize/test_codesize_hello_O1.gzsize +++ b/test/other/codesize/test_codesize_hello_O1.gzsize @@ -1 +1 @@ -2548 +2547 diff --git a/test/other/codesize/test_codesize_hello_dylink.gzsize b/test/other/codesize/test_codesize_hello_dylink.gzsize index 69b0804d31634..3fb524c7bdfc3 100644 --- a/test/other/codesize/test_codesize_hello_dylink.gzsize +++ b/test/other/codesize/test_codesize_hello_dylink.gzsize @@ -1 +1 @@ -5866 +5860 diff --git a/test/other/codesize/test_codesize_hello_single_file.gzsize b/test/other/codesize/test_codesize_hello_single_file.gzsize index 7f0e18ca00cc8..efeb812131571 100644 --- a/test/other/codesize/test_codesize_hello_single_file.gzsize +++ b/test/other/codesize/test_codesize_hello_single_file.gzsize @@ -1 +1 @@ -3693 +3690 diff --git a/test/other/codesize/test_codesize_minimal_O0.gzsize b/test/other/codesize/test_codesize_minimal_O0.gzsize index db19baab5693c..3352be8311244 100644 --- a/test/other/codesize/test_codesize_minimal_O0.gzsize +++ b/test/other/codesize/test_codesize_minimal_O0.gzsize @@ -1 +1 @@ -6296 +6284 diff --git a/test/other/codesize/test_codesize_minimal_pthreads.gzsize b/test/other/codesize/test_codesize_minimal_pthreads.gzsize index 97a67bc728a46..cc3387d70aed5 100644 --- a/test/other/codesize/test_codesize_minimal_pthreads.gzsize +++ b/test/other/codesize/test_codesize_minimal_pthreads.gzsize @@ -1 +1 @@ -4042 +4037 From eea195e12fbe70d7ff5c06af6574e695d5d8f0d3 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 27 Mar 2025 19:24:33 +0100 Subject: [PATCH 7/7] Merge tests --- test/test_other.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/test/test_other.py b/test/test_other.py index 99d27f412a16d..cedb8ba87d6cc 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -2177,28 +2177,6 @@ def test(link_flags, lib_suffix): @node_pthreads @also_with_modularize - def test_dylink_pthread(self): - create_file('library.c', r''' - int answer() { - return 42; - } - ''') - self.run_process([EMCC, 'library.c', '-pthread', '-Wno-experimental', '-sSIDE_MODULE', '-o', 'side.wasm']) - create_file('main.c', r''' - #include - #include - - extern int answer(); - - int main() { - assert(answer() == 42); - printf("done\n"); - return 0; - } - ''') - self.do_runf('main.c', 'done\n', emcc_args=['-sMAIN_MODULE=2', '-pthread', '-Wno-experimental', 'side.wasm']) - - @node_pthreads def test_dylink_pthread_static_data(self): # Test that a side module uses the same static data region for global objects across all threads