-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Move sharedModules
object to runtime_pthread.js
#23998
Move sharedModules
object to runtime_pthread.js
#23998
Conversation
For some reason this fixes a regression after commit a14f471. After this commit, my pet project started failing with: TypeError: Cannot read properties of undefined (reading 'vips-jxl.wasm')
at e (file:///home/kleisauke/wasm-vips/lib/vips-node.mjs:44:61)
at f (file:///home/kleisauke/wasm-vips/lib/vips-node.mjs:44:402)
at zf (file:///home/kleisauke/wasm-vips/lib/vips-node.mjs:45:263)
at file:///home/kleisauke/wasm-vips/lib/vips-node.mjs:46:305 At this line: emscripten/src/lib/libdylink.js Line 1008 in a14f471
This could probably(?) also be resolved by moving this object to (added this as a second comment since the PR description is nowadays used in the landing commit) |
So it makes sense that #23704 could have caused this kind of issue, because it makes means that postable code run only after the createWasm is resolved. However, I'd love to know why none of our tests caught this. Maybe we don't have enough coverage of dynamic linking + modularize + pthreads? |
I think maybe a better place for this would be in |
sharedModules
object to libcore.js
sharedModules
object to runtime_pthread.js
I think so. It might also be a Closure-specific issue since I'm using that as well.
Done with ba18f68. I confirm that works too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM although I'd love to also get a test for this.
Maybe test_preload_module
could have also_with_modularize
added?
Actually maybe not that test.. but any test that just used load-time dynamic linking and pthreads. |
Added a test with commit 3854ac7. The /tmp/emtest_pg577vro/emscripten_test_other_kb_3mt0y/main.js:2546
var sharedMod = sharedModules[libName];
^
TypeError: Cannot read properties of undefined (reading 'side.wasm')
at loadLibData (/tmp/emtest_pg577vro/emscripten_test_other_kb_3mt0y/main.js:2546:38)
at getExports (/tmp/emtest_pg577vro/emscripten_test_other_kb_3mt0y/main.js:2583:18)
at loadDynamicLibrary (/tmp/emtest_pg577vro/emscripten_test_other_kb_3mt0y/main.js:2600:16)
at /tmp/emtest_pg577vro/emscripten_test_other_kb_3mt0y/main.js:2641:11
Thrown at:
at loadLibData (/tmp/emtest_pg577vro/emscripten_test_other_kb_3mt0y/main.js:2546:38)
at getExports (/tmp/emtest_pg577vro/emscripten_test_other_kb_3mt0y/main.js:2583:18)
at loadDynamicLibrary (/tmp/emtest_pg577vro/emscripten_test_other_kb_3mt0y/main.js:2600:16)
at /tmp/emtest_pg577vro/emscripten_test_other_kb_3mt0y/main.js:2641:11 |
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%) ```
This reverts commit 995c887.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for the fix!
LGTM % comment.
If you merge / rebase with main the test_emcc_4 failure is now fixed. |
No description provided.