diff --git a/test/codesize/test_codesize_cxx_ctors1.json b/test/codesize/test_codesize_cxx_ctors1.json index bc707e4eab79f..2a9b17c923f07 100644 --- a/test/codesize/test_codesize_cxx_ctors1.json +++ b/test/codesize/test_codesize_cxx_ctors1.json @@ -1,10 +1,10 @@ { "a.out.js": 19756, - "a.out.js.gz": 8158, + "a.out.js.gz": 8160, "a.out.nodebug.wasm": 129509, "a.out.nodebug.wasm.gz": 49243, "total": 149265, - "total_gz": 57401, + "total_gz": 57403, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_ctors2.json b/test/codesize/test_codesize_cxx_ctors2.json index fb08bdd55bd45..d0a0e214f7d2d 100644 --- a/test/codesize/test_codesize_cxx_ctors2.json +++ b/test/codesize/test_codesize_cxx_ctors2.json @@ -1,10 +1,10 @@ { "a.out.js": 19733, - "a.out.js.gz": 8146, + "a.out.js.gz": 8148, "a.out.nodebug.wasm": 128936, "a.out.nodebug.wasm.gz": 48884, "total": 148669, - "total_gz": 57030, + "total_gz": 57032, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_except.json b/test/codesize/test_codesize_cxx_except.json index 40fa447536380..4140dc35597d3 100644 --- a/test/codesize/test_codesize_cxx_except.json +++ b/test/codesize/test_codesize_cxx_except.json @@ -1,10 +1,10 @@ { "a.out.js": 23412, - "a.out.js.gz": 9143, + "a.out.js.gz": 9144, "a.out.nodebug.wasm": 171271, "a.out.nodebug.wasm.gz": 57338, "total": 194683, - "total_gz": 66481, + "total_gz": 66482, "sent": [ "__cxa_begin_catch", "__cxa_end_catch", diff --git a/test/codesize/test_codesize_cxx_except_wasm.json b/test/codesize/test_codesize_cxx_except_wasm.json index b935955d8625f..df7212897a7af 100644 --- a/test/codesize/test_codesize_cxx_except_wasm.json +++ b/test/codesize/test_codesize_cxx_except_wasm.json @@ -1,10 +1,10 @@ { "a.out.js": 19641, - "a.out.js.gz": 8109, + "a.out.js.gz": 8111, "a.out.nodebug.wasm": 144630, "a.out.nodebug.wasm.gz": 54894, "total": 164271, - "total_gz": 63003, + "total_gz": 63005, "sent": [ "_abort_js", "_tzset_js", diff --git a/test/codesize/test_codesize_cxx_except_wasm_legacy.json b/test/codesize/test_codesize_cxx_except_wasm_legacy.json index b74341ad33ba5..660c03cb42588 100644 --- a/test/codesize/test_codesize_cxx_except_wasm_legacy.json +++ b/test/codesize/test_codesize_cxx_except_wasm_legacy.json @@ -1,10 +1,10 @@ { "a.out.js": 19641, - "a.out.js.gz": 8109, + "a.out.js.gz": 8111, "a.out.nodebug.wasm": 142219, "a.out.nodebug.wasm.gz": 54358, "total": 161860, - "total_gz": 62467, + "total_gz": 62469, "sent": [ "_abort_js", "_tzset_js", diff --git a/test/codesize/test_codesize_cxx_lto.json b/test/codesize/test_codesize_cxx_lto.json index 67cb55fa4fa55..1411bd043c3a3 100644 --- a/test/codesize/test_codesize_cxx_lto.json +++ b/test/codesize/test_codesize_cxx_lto.json @@ -1,10 +1,10 @@ { "a.out.js": 19080, - "a.out.js.gz": 7839, + "a.out.js.gz": 7840, "a.out.nodebug.wasm": 106463, "a.out.nodebug.wasm.gz": 42596, "total": 125543, - "total_gz": 50435, + "total_gz": 50436, "sent": [ "a (emscripten_resize_heap)", "b (_setitimer_js)", diff --git a/test/codesize/test_codesize_cxx_mangle.json b/test/codesize/test_codesize_cxx_mangle.json index 6591457024199..ee92c5469b2f4 100644 --- a/test/codesize/test_codesize_cxx_mangle.json +++ b/test/codesize/test_codesize_cxx_mangle.json @@ -1,10 +1,10 @@ { "a.out.js": 23462, - "a.out.js.gz": 9163, + "a.out.js.gz": 9165, "a.out.nodebug.wasm": 235312, "a.out.nodebug.wasm.gz": 78933, "total": 258774, - "total_gz": 88096, + "total_gz": 88098, "sent": [ "__cxa_begin_catch", "__cxa_end_catch", diff --git a/test/codesize/test_codesize_cxx_noexcept.json b/test/codesize/test_codesize_cxx_noexcept.json index 961be6aa37e65..7d31c0a735d41 100644 --- a/test/codesize/test_codesize_cxx_noexcept.json +++ b/test/codesize/test_codesize_cxx_noexcept.json @@ -1,10 +1,10 @@ { "a.out.js": 19756, - "a.out.js.gz": 8158, + "a.out.js.gz": 8160, "a.out.nodebug.wasm": 131926, "a.out.nodebug.wasm.gz": 50238, "total": 151682, - "total_gz": 58396, + "total_gz": 58398, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_wasmfs.json b/test/codesize/test_codesize_cxx_wasmfs.json index 3d2a0be9d292e..a8fe2b5de7d87 100644 --- a/test/codesize/test_codesize_cxx_wasmfs.json +++ b/test/codesize/test_codesize_cxx_wasmfs.json @@ -1,10 +1,10 @@ { "a.out.js": 7145, - "a.out.js.gz": 3338, + "a.out.js.gz": 3339, "a.out.nodebug.wasm": 169797, "a.out.nodebug.wasm.gz": 63087, "total": 176942, - "total_gz": 66425, + "total_gz": 66426, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_file_preload.expected.js b/test/codesize/test_codesize_file_preload.expected.js index 25e05276c2752..4447c4b940aad 100644 --- a/test/codesize/test_codesize_file_preload.expected.js +++ b/test/codesize/test_codesize_file_preload.expected.js @@ -3155,7 +3155,7 @@ Module["FS_createLazyFile"] = FS_createLazyFile; var _main, wasmMemory, wasmTable; function assignWasmExports(wasmExports) { - Module["_main"] = _main = wasmExports["d"]; + _main = Module["_main"] = wasmExports["d"]; wasmMemory = wasmExports["b"]; wasmTable = wasmExports["__indirect_function_table"]; } diff --git a/test/codesize/test_codesize_files_js_fs.json b/test/codesize/test_codesize_files_js_fs.json index 5be59149263c2..0647c4988dc7f 100644 --- a/test/codesize/test_codesize_files_js_fs.json +++ b/test/codesize/test_codesize_files_js_fs.json @@ -1,10 +1,10 @@ { "a.out.js": 18359, - "a.out.js.gz": 7474, + "a.out.js.gz": 7475, "a.out.nodebug.wasm": 381, "a.out.nodebug.wasm.gz": 260, "total": 18740, - "total_gz": 7734, + "total_gz": 7735, "sent": [ "a (fd_write)", "b (fd_read)", diff --git a/test/codesize/test_codesize_hello_O1.json b/test/codesize/test_codesize_hello_O1.json index 08b9743f9ed9a..9edcbdb374b2e 100644 --- a/test/codesize/test_codesize_hello_O1.json +++ b/test/codesize/test_codesize_hello_O1.json @@ -1,10 +1,10 @@ { "a.out.js": 6415, - "a.out.js.gz": 2470, + "a.out.js.gz": 2471, "a.out.nodebug.wasm": 2675, "a.out.nodebug.wasm.gz": 1491, "total": 9090, - "total_gz": 3961, + "total_gz": 3962, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_O2.json b/test/codesize/test_codesize_hello_O2.json index 20ad97141368b..cc38db8f4fc22 100644 --- a/test/codesize/test_codesize_hello_O2.json +++ b/test/codesize/test_codesize_hello_O2.json @@ -1,10 +1,10 @@ { "a.out.js": 4371, - "a.out.js.gz": 2138, + "a.out.js.gz": 2139, "a.out.nodebug.wasm": 1927, "a.out.nodebug.wasm.gz": 1138, "total": 6298, - "total_gz": 3276, + "total_gz": 3277, "sent": [ "fd_write" ], diff --git a/test/codesize/test_codesize_hello_single_file.json b/test/codesize/test_codesize_hello_single_file.json index 733d4845c828e..9b4f55f639b6e 100644 --- a/test/codesize/test_codesize_hello_single_file.json +++ b/test/codesize/test_codesize_hello_single_file.json @@ -1,6 +1,6 @@ { "a.out.js": 6549, - "a.out.js.gz": 3586, + "a.out.js.gz": 3587, "sent": [ "a (fd_write)" ] diff --git a/test/codesize/test_codesize_libcxxabi_message_O3.json b/test/codesize/test_codesize_libcxxabi_message_O3.json index 6a6d821938e88..4e846662cb5eb 100644 --- a/test/codesize/test_codesize_libcxxabi_message_O3.json +++ b/test/codesize/test_codesize_libcxxabi_message_O3.json @@ -1,10 +1,10 @@ { "a.out.js": 3560, - "a.out.js.gz": 1673, + "a.out.js.gz": 1674, "a.out.nodebug.wasm": 89, "a.out.nodebug.wasm.gz": 98, "total": 3649, - "total_gz": 1771, + "total_gz": 1772, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_mem_O3_standalone_lib.json b/test/codesize/test_codesize_mem_O3_standalone_lib.json index 930f3efdeb53a..5096f8211f49c 100644 --- a/test/codesize/test_codesize_mem_O3_standalone_lib.json +++ b/test/codesize/test_codesize_mem_O3_standalone_lib.json @@ -1,10 +1,10 @@ { "a.out.js": 3600, - "a.out.js.gz": 1693, + "a.out.js.gz": 1694, "a.out.nodebug.wasm": 5239, "a.out.nodebug.wasm.gz": 2360, "total": 8839, - "total_gz": 4053, + "total_gz": 4054, "sent": [], "imports": [], "exports": [ diff --git a/test/codesize/test_codesize_minimal_O0.expected.js b/test/codesize/test_codesize_minimal_O0.expected.js index 9a42aead42826..ce94c75349503 100644 --- a/test/codesize/test_codesize_minimal_O0.expected.js +++ b/test/codesize/test_codesize_minimal_O0.expected.js @@ -1291,7 +1291,7 @@ var wasmMemory = makeInvalidEarlyAccess('wasmMemory'); var wasmTable = makeInvalidEarlyAccess('wasmTable'); function assignWasmExports(wasmExports) { - Module['_add'] = _add = createExportWrapper('add', 2); + _add = Module['_add'] = createExportWrapper('add', 2); _fflush = createExportWrapper('fflush', 1); _emscripten_stack_init = wasmExports['emscripten_stack_init']; _emscripten_stack_get_free = wasmExports['emscripten_stack_get_free']; diff --git a/test/codesize/test_codesize_minimal_pthreads.json b/test/codesize/test_codesize_minimal_pthreads.json index e85e6639f0295..65edc7b6cc7f6 100644 --- a/test/codesize/test_codesize_minimal_pthreads.json +++ b/test/codesize/test_codesize_minimal_pthreads.json @@ -1,10 +1,10 @@ { "a.out.js": 7679, - "a.out.js.gz": 3782, + "a.out.js.gz": 3783, "a.out.nodebug.wasm": 19599, "a.out.nodebug.wasm.gz": 9063, "total": 27278, - "total_gz": 12845, + "total_gz": 12846, "sent": [ "a (memory)", "b (emscripten_get_now)", diff --git a/test/codesize/test_codesize_minimal_pthreads_memgrowth.json b/test/codesize/test_codesize_minimal_pthreads_memgrowth.json index 2c769f5826b9b..410fd66769b33 100644 --- a/test/codesize/test_codesize_minimal_pthreads_memgrowth.json +++ b/test/codesize/test_codesize_minimal_pthreads_memgrowth.json @@ -1,10 +1,10 @@ { "a.out.js": 8106, - "a.out.js.gz": 3979, + "a.out.js.gz": 3981, "a.out.nodebug.wasm": 19600, "a.out.nodebug.wasm.gz": 9064, "total": 27706, - "total_gz": 13043, + "total_gz": 13045, "sent": [ "a (memory)", "b (emscripten_get_now)", diff --git a/test/codesize/test_unoptimized_code_size.json b/test/codesize/test_unoptimized_code_size.json index a39e090a02044..a692ba4e5a6d0 100644 --- a/test/codesize/test_unoptimized_code_size.json +++ b/test/codesize/test_unoptimized_code_size.json @@ -1,14 +1,14 @@ { "hello_world.js": 54152, - "hello_world.js.gz": 17088, + "hello_world.js.gz": 17087, "hello_world.wasm": 15127, "hello_world.wasm.gz": 7450, "no_asserts.js": 26557, - "no_asserts.js.gz": 8867, + "no_asserts.js.gz": 8869, "no_asserts.wasm": 12227, "no_asserts.wasm.gz": 6010, "strict.js": 52190, - "strict.js.gz": 16422, + "strict.js.gz": 16421, "strict.wasm": 15127, "strict.wasm.gz": 7447, "total": 175380, diff --git a/tools/emscripten.py b/tools/emscripten.py index 656b593d1b612..793b40620ee61 100644 --- a/tools/emscripten.py +++ b/tools/emscripten.py @@ -954,10 +954,10 @@ def create_receiving(function_exports, other_exports, library_symbols): # wasm module is available. for sym in exports: mangled = asmjs_mangle(sym) - export_assignment = '' + assignment = mangled if (settings.MODULARIZE or not settings.MINIMAL_RUNTIME) and should_export(mangled) and settings.MODULARIZE != 'instance': - export_assignment = f" = Module['{mangled}']" - receiving.append(f"var {mangled}{export_assignment} = makeInvalidEarlyAccess('{mangled}');") + assignment += f" = Module['{mangled}']" + receiving.append(f"var {assignment} = makeInvalidEarlyAccess('{mangled}');") else: # Declare all exports in a single var statement sep = ',\n ' @@ -975,19 +975,17 @@ def create_receiving(function_exports, other_exports, library_symbols): for sym, sig in exports.items(): is_function = sig is not None mangled = asmjs_mangle(sym) + assignment = mangled if generate_dyncall_assignment and is_function and sym.startswith('dynCall_'): sig_str = sym.replace('dynCall_', '') - dynCallAssignment = f"dynCalls['{sig_str}'] = " - else: - dynCallAssignment = '' - export_assignment = '' + assignment += f" = dynCalls['{sig_str}']" if (settings.MODULARIZE or not settings.MINIMAL_RUNTIME) and should_export(mangled) and settings.MODULARIZE != 'instance': - export_assignment = f"Module['{mangled}'] = " + assignment += f" = Module['{mangled}']" if is_function and install_debug_wrapper(sym): nargs = len(sig.params) - receiving.append(f" {export_assignment}{dynCallAssignment}{mangled} = createExportWrapper('{sym}', {nargs});") + receiving.append(f" {assignment} = createExportWrapper('{sym}', {nargs});") else: - receiving.append(f" {export_assignment}{dynCallAssignment}{mangled} = wasmExports['{sym}'];") + receiving.append(f" {assignment} = wasmExports['{sym}'];") receiving.append('}') return '\n'.join(receiving)