Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/lib/libbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ var LibraryBrowser = {
},

// TODO: currently not callable from a pthread, but immediately calls onerror() if not on main thread.
emscripten_async_load_script__deps: ['$UTF8ToString'],
emscripten_async_load_script__deps: ['$UTF8ToString', '$runDependencies'],
emscripten_async_load_script: async (url, onload, onerror) => {
url = UTF8ToString(url);
#if PTHREADS
Expand Down
5 changes: 3 additions & 2 deletions src/postamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,18 @@ if ({{{ ENVIRONMENT_IS_MAIN_THREAD() }}}) {
// In modularize mode the generated code is within a factory function so we
// can use await here (since it's not top-level-await).
wasmExports = await createWasm();
run();
#else
// With async instantation wasmExports is assigned asynchronously when the
// instance is received.
createWasm();
createWasm().then(() => run());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC this will delay preRun (including preloading data files) until the wasm is ready, but I think before we could do them in parallel?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, but we already that just above where we await createWasm. I will check..

#endif

#else
wasmExports = createWasm();
run();
#endif

run();

#if WASM_WORKERS || PTHREADS
}
Expand Down
6 changes: 0 additions & 6 deletions src/preamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,15 +753,9 @@ function getWasmImports() {
#endif
#if DECLARE_ASM_MODULE_EXPORTS
assignWasmExports(wasmExports);
#endif
#if WASM_ASYNC_COMPILATION && !MODULARIZE
removeRunDependency('wasm-instantiate');
#endif
return wasmExports;
}
#if WASM_ASYNC_COMPILATION && !MODULARIZE
addRunDependency('wasm-instantiate');
#endif

// Prefer streaming instantiation if available.
#if WASM_ASYNC_COMPILATION
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_cxx_ctors1.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19754,
"a.out.js.gz": 8162,
"a.out.js": 19624,
"a.out.js.gz": 8094,
"a.out.nodebug.wasm": 129508,
"a.out.nodebug.wasm.gz": 49240,
"total": 149262,
"total_gz": 57402,
"total": 149132,
"total_gz": 57334,
"sent": [
"__cxa_throw",
"_abort_js",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_cxx_ctors2.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19732,
"a.out.js.gz": 8148,
"a.out.js": 19602,
"a.out.js.gz": 8081,
"a.out.nodebug.wasm": 128935,
"a.out.nodebug.wasm.gz": 48881,
"total": 148667,
"total_gz": 57029,
"total": 148537,
"total_gz": 56962,
"sent": [
"__cxa_throw",
"_abort_js",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_cxx_except.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 23415,
"a.out.js.gz": 9145,
"a.out.js": 23283,
"a.out.js.gz": 9075,
"a.out.nodebug.wasm": 171270,
"a.out.nodebug.wasm.gz": 57331,
"total": 194685,
"total_gz": 66476,
"total": 194553,
"total_gz": 66406,
"sent": [
"__cxa_begin_catch",
"__cxa_end_catch",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_cxx_except_wasm.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19643,
"a.out.js.gz": 8112,
"a.out.js": 19513,
"a.out.js.gz": 8046,
"a.out.nodebug.wasm": 144629,
"a.out.nodebug.wasm.gz": 54892,
"total": 164272,
"total_gz": 63004,
"total": 164142,
"total_gz": 62938,
"sent": [
"_abort_js",
"_tzset_js",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_cxx_except_wasm_legacy.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19643,
"a.out.js.gz": 8112,
"a.out.js": 19513,
"a.out.js.gz": 8046,
"a.out.nodebug.wasm": 142218,
"a.out.nodebug.wasm.gz": 54353,
"total": 161861,
"total_gz": 62465,
"total": 161731,
"total_gz": 62399,
"sent": [
"_abort_js",
"_tzset_js",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_cxx_lto.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19082,
"a.out.js.gz": 7841,
"a.out.js": 18952,
"a.out.js.gz": 7772,
"a.out.nodebug.wasm": 106464,
"a.out.nodebug.wasm.gz": 42600,
"total": 125546,
"total_gz": 50441,
"total": 125416,
"total_gz": 50372,
"sent": [
"a (emscripten_resize_heap)",
"b (_setitimer_js)",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_cxx_mangle.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 23465,
"a.out.js.gz": 9164,
"a.out.js": 23333,
"a.out.js.gz": 9095,
"a.out.nodebug.wasm": 235311,
"a.out.nodebug.wasm.gz": 78929,
"total": 258776,
"total_gz": 88093,
"total": 258644,
"total_gz": 88024,
"sent": [
"__cxa_begin_catch",
"__cxa_end_catch",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_cxx_noexcept.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19754,
"a.out.js.gz": 8162,
"a.out.js": 19624,
"a.out.js.gz": 8094,
"a.out.nodebug.wasm": 131925,
"a.out.nodebug.wasm.gz": 50235,
"total": 151679,
"total_gz": 58397,
"total": 151549,
"total_gz": 58329,
"sent": [
"__cxa_throw",
"_abort_js",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_cxx_wasmfs.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 7143,
"a.out.js.gz": 3338,
"a.out.js": 7015,
"a.out.js.gz": 3268,
"a.out.nodebug.wasm": 169796,
"a.out.nodebug.wasm.gz": 63083,
"total": 176939,
"total_gz": 66421,
"total": 176811,
"total_gz": 66351,
"sent": [
"__cxa_throw",
"_abort_js",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_file_preload.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 22684,
"a.out.js.gz": 9375,
"a.out.js": 22667,
"a.out.js.gz": 9362,
"a.out.nodebug.wasm": 1681,
"a.out.nodebug.wasm.gz": 960,
"total": 24365,
"total_gz": 10335,
"total": 24348,
"total_gz": 10322,
"sent": [
"a (fd_write)"
],
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_files_js_fs.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 18357,
"a.out.js.gz": 7470,
"a.out.js": 18226,
"a.out.js.gz": 7406,
"a.out.nodebug.wasm": 381,
"a.out.nodebug.wasm.gz": 260,
"total": 18738,
"total_gz": 7730,
"total": 18607,
"total_gz": 7666,
"sent": [
"a (fd_write)",
"b (fd_read)",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_files_wasmfs.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 5549,
"a.out.js.gz": 2591,
"a.out.js": 5426,
"a.out.js.gz": 2527,
"a.out.nodebug.wasm": 50232,
"a.out.nodebug.wasm.gz": 18078,
"total": 55781,
"total_gz": 20669,
"total": 55658,
"total_gz": 20605,
"sent": [
"a (emscripten_date_now)",
"b (emscripten_err)",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_hello_O0.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 22496,
"a.out.js.gz": 8322,
"a.out.js": 21479,
"a.out.js.gz": 7989,
"a.out.nodebug.wasm": 15127,
"a.out.nodebug.wasm.gz": 7448,
"total": 37623,
"total_gz": 15770,
"total": 36606,
"total_gz": 15437,
"sent": [
"fd_write"
],
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_hello_O1.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 6411,
"a.out.js.gz": 2472,
"a.out.js": 6197,
"a.out.js.gz": 2392,
"a.out.nodebug.wasm": 2675,
"a.out.nodebug.wasm.gz": 1491,
"total": 9086,
"total_gz": 3963,
"total": 8872,
"total_gz": 3883,
"sent": [
"fd_write"
],
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_hello_O2.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 4369,
"a.out.js.gz": 2140,
"a.out.js": 4245,
"a.out.js.gz": 2071,
"a.out.nodebug.wasm": 1927,
"a.out.nodebug.wasm.gz": 1138,
"total": 6296,
"total_gz": 3278,
"total": 6172,
"total_gz": 3209,
"sent": [
"fd_write"
],
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_hello_O3.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 4311,
"a.out.js.gz": 2097,
"a.out.js": 4186,
"a.out.js.gz": 2029,
"a.out.nodebug.wasm": 1681,
"a.out.nodebug.wasm.gz": 960,
"total": 5992,
"total_gz": 3057,
"total": 5867,
"total_gz": 2989,
"sent": [
"a (fd_write)"
],
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_hello_Os.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 4311,
"a.out.js.gz": 2097,
"a.out.js": 4186,
"a.out.js.gz": 2029,
"a.out.nodebug.wasm": 1671,
"a.out.nodebug.wasm.gz": 964,
"total": 5982,
"total_gz": 3061,
"total": 5857,
"total_gz": 2993,
"sent": [
"a (fd_write)"
],
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_hello_Oz.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 3931,
"a.out.js.gz": 1902,
"a.out.js": 3810,
"a.out.js.gz": 1835,
"a.out.nodebug.wasm": 1205,
"a.out.nodebug.wasm.gz": 740,
"total": 5136,
"total_gz": 2642,
"total": 5015,
"total_gz": 2575,
"sent": [
"a (fd_write)"
],
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_hello_dylink.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 26976,
"a.out.js.gz": 11458,
"a.out.js": 26943,
"a.out.js.gz": 11435,
"a.out.nodebug.wasm": 18561,
"a.out.nodebug.wasm.gz": 9167,
"total": 45537,
"total_gz": 20625,
"total": 45504,
"total_gz": 20602,
"sent": [
"__heap_base",
"__indirect_function_table",
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_hello_export_nothing.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 3209,
"a.out.js.gz": 1486,
"a.out.js": 3088,
"a.out.js.gz": 1419,
"a.out.nodebug.wasm": 43,
"a.out.nodebug.wasm.gz": 59,
"total": 3252,
"total_gz": 1545,
"total": 3131,
"total_gz": 1478,
"sent": [],
"imports": [],
"exports": [
Expand Down
4 changes: 2 additions & 2 deletions test/code_size/test_codesize_hello_single_file.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"a.out.js": 6547,
"a.out.js.gz": 3586,
"a.out.js": 6421,
"a.out.js.gz": 3518,
"sent": [
"a (fd_write)"
]
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_hello_wasmfs.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 4311,
"a.out.js.gz": 2097,
"a.out.js": 4186,
"a.out.js.gz": 2029,
"a.out.nodebug.wasm": 1681,
"a.out.nodebug.wasm.gz": 960,
"total": 5992,
"total_gz": 3057,
"total": 5867,
"total_gz": 2989,
"sent": [
"a (fd_write)"
],
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/test_codesize_libcxxabi_message_O3.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 3558,
"a.out.js.gz": 1673,
"a.out.js": 3437,
"a.out.js.gz": 1604,
"a.out.nodebug.wasm": 89,
"a.out.nodebug.wasm.gz": 98,
"total": 3647,
"total_gz": 1771,
"total": 3526,
"total_gz": 1702,
"sent": [],
"imports": [],
"exports": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 3605,
"a.out.js.gz": 1708,
"a.out.js": 3484,
"a.out.js.gz": 1638,
"a.out.nodebug.wasm": 132,
"a.out.nodebug.wasm.gz": 140,
"total": 3737,
"total_gz": 1848,
"total": 3616,
"total_gz": 1778,
"sent": [
"proc_exit"
],
Expand Down
Loading