Skip to content
Merged
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
5 changes: 2 additions & 3 deletions src/postamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,13 @@ if ({{{ ENVIRONMENT_IS_MAIN_THREAD() }}}) {
#if !MODULARIZE && WASM_ASYNC_COMPILATION
// With async instantation wasmExports is assigned asynchronously when the
// instance is received.
createWasm();
createWasm().then(() => run());
#else
// 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 = {{{ awaitIf(MODULARIZE && WASM_ASYNC_COMPILATION) }}}createWasm();
#endif

{{{ awaitIf(MODULARIZE) }}}run();
#endif

#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 @@ -794,15 +794,9 @@ function getWasmImports() {
#if PTHREADS || WASM_WORKERS
// We now have the Wasm module loaded up, keep a reference to the compiled module so we can post it to the workers.
wasmModule = module;
#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/codesize/test_codesize_cxx_ctors1.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19322,
"a.out.js.gz": 8008,
"a.out.js": 19192,
"a.out.js.gz": 7944,
"a.out.nodebug.wasm": 132666,
"a.out.nodebug.wasm.gz": 49962,
"total": 151988,
"total_gz": 57970,
"total": 151858,
"total_gz": 57906,
"sent": [
"__cxa_throw",
"_abort_js",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_cxx_ctors2.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19299,
"a.out.js.gz": 7995,
"a.out.js": 19169,
"a.out.js.gz": 7931,
"a.out.nodebug.wasm": 132092,
"a.out.nodebug.wasm.gz": 49625,
"total": 151391,
"total_gz": 57620,
"total": 151261,
"total_gz": 57556,
"sent": [
"__cxa_throw",
"_abort_js",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_cxx_except.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 23298,
"a.out.js.gz": 8987,
"a.out.js": 23166,
"a.out.js.gz": 8928,
"a.out.nodebug.wasm": 172586,
"a.out.nodebug.wasm.gz": 57501,
"total": 195884,
"total_gz": 66488,
"total": 195752,
"total_gz": 66429,
"sent": [
"__cxa_begin_catch",
"__cxa_end_catch",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_cxx_except_wasm.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19125,
"a.out.js.gz": 7925,
"a.out.js": 18995,
"a.out.js.gz": 7862,
"a.out.nodebug.wasm": 147991,
"a.out.nodebug.wasm.gz": 55370,
"total": 167116,
"total_gz": 63295,
"total": 166986,
"total_gz": 63232,
"sent": [
"_abort_js",
"_tzset_js",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_cxx_except_wasm_legacy.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19199,
"a.out.js.gz": 7955,
"a.out.js": 19069,
"a.out.js.gz": 7884,
"a.out.nodebug.wasm": 145797,
"a.out.nodebug.wasm.gz": 54992,
"total": 164996,
"total_gz": 62947,
"total": 164866,
"total_gz": 62876,
"sent": [
"_abort_js",
"_tzset_js",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_cxx_lto.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 18662,
"a.out.js.gz": 7691,
"a.out.js": 18532,
"a.out.js.gz": 7634,
"a.out.nodebug.wasm": 102168,
"a.out.nodebug.wasm.gz": 39572,
"total": 120830,
"total_gz": 47263,
"total": 120700,
"total_gz": 47206,
"sent": [
"a (emscripten_resize_heap)",
"b (_setitimer_js)",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_cxx_mangle.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 23348,
"a.out.js.gz": 9009,
"a.out.js": 23216,
"a.out.js.gz": 8947,
"a.out.nodebug.wasm": 239015,
"a.out.nodebug.wasm.gz": 79854,
"total": 262363,
"total_gz": 88863,
"total": 262231,
"total_gz": 88801,
"sent": [
"__cxa_begin_catch",
"__cxa_end_catch",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_cxx_noexcept.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 19322,
"a.out.js.gz": 8008,
"a.out.js": 19192,
"a.out.js.gz": 7944,
"a.out.nodebug.wasm": 134666,
"a.out.nodebug.wasm.gz": 50806,
"total": 153988,
"total_gz": 58814,
"total": 153858,
"total_gz": 58750,
"sent": [
"__cxa_throw",
"_abort_js",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_cxx_wasmfs.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 7056,
"a.out.js.gz": 3322,
"a.out.js": 6930,
"a.out.js.gz": 3252,
"a.out.nodebug.wasm": 172677,
"a.out.nodebug.wasm.gz": 63357,
"total": 179733,
"total_gz": 66679,
"total": 179607,
"total_gz": 66609,
"sent": [
"__cxa_throw",
"_abort_js",
Expand Down
6 changes: 1 addition & 5 deletions test/codesize/test_codesize_file_preload.expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,8 @@ async function createWasm() {
wasmExports = instance.exports;
assignWasmExports(wasmExports);
updateMemoryViews();
removeRunDependency("wasm-instantiate");
return wasmExports;
}
addRunDependency("wasm-instantiate");
// Prefer streaming instantiation if available.
function receiveInstantiationResult(result) {
// 'result' is a ResultObject object which has both the module and instance.
Expand Down Expand Up @@ -3210,6 +3208,4 @@ var wasmExports;

// With async instantation wasmExports is assigned asynchronously when the
// instance is received.
createWasm();

run();
createWasm().then(() => run());
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_file_preload.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 22126,
"a.out.js.gz": 9184,
"a.out.js": 22109,
"a.out.js.gz": 9180,
"a.out.nodebug.wasm": 1666,
"a.out.nodebug.wasm.gz": 945,
"total": 23792,
"total_gz": 10129,
"total": 23775,
"total_gz": 10125,
"sent": [
"a (fd_write)"
],
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_files_js_fs.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 17970,
"a.out.js.gz": 7349,
"a.out.js": 17840,
"a.out.js.gz": 7285,
"a.out.nodebug.wasm": 381,
"a.out.nodebug.wasm.gz": 260,
"total": 18351,
"total_gz": 7609,
"total": 18221,
"total_gz": 7545,
"sent": [
"a (fd_write)",
"b (fd_read)",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_files_wasmfs.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 5487,
"a.out.js.gz": 2586,
"a.out.js": 5364,
"a.out.js.gz": 2525,
"a.out.nodebug.wasm": 58324,
"a.out.nodebug.wasm.gz": 18215,
"total": 63811,
"total_gz": 20801,
"total": 63688,
"total_gz": 20740,
"sent": [
"a (emscripten_date_now)",
"b (emscripten_err)",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_O0.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 24254,
"a.out.js.gz": 8724,
"a.out.js": 23358,
"a.out.js.gz": 8434,
"a.out.nodebug.wasm": 15115,
"a.out.nodebug.wasm.gz": 7464,
"total": 39369,
"total_gz": 16188,
"total": 38473,
"total_gz": 15898,
"sent": [
"fd_write"
],
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_O1.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 6378,
"a.out.js.gz": 2461,
"a.out.js": 6164,
"a.out.js.gz": 2386,
"a.out.nodebug.wasm": 2544,
"a.out.nodebug.wasm.gz": 1436,
"total": 8922,
"total_gz": 3897,
"total": 8708,
"total_gz": 3822,
"sent": [
"fd_write"
],
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_O2.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 4344,
"a.out.js.gz": 2134,
"a.out.js": 4220,
"a.out.js.gz": 2070,
"a.out.nodebug.wasm": 1912,
"a.out.nodebug.wasm.gz": 1129,
"total": 6256,
"total_gz": 3263,
"total": 6132,
"total_gz": 3199,
"sent": [
"fd_write"
],
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_O3.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 4286,
"a.out.js.gz": 2092,
"a.out.js": 4161,
"a.out.js.gz": 2030,
"a.out.nodebug.wasm": 1666,
"a.out.nodebug.wasm.gz": 945,
"total": 5952,
"total_gz": 3037,
"total": 5827,
"total_gz": 2975,
"sent": [
"a (fd_write)"
],
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_Os.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 4286,
"a.out.js.gz": 2092,
"a.out.js": 4161,
"a.out.js.gz": 2030,
"a.out.nodebug.wasm": 1654,
"a.out.nodebug.wasm.gz": 953,
"total": 5940,
"total_gz": 3045,
"total": 5815,
"total_gz": 2983,
"sent": [
"a (fd_write)"
],
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_Oz.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 3921,
"a.out.js.gz": 1901,
"a.out.js": 3800,
"a.out.js.gz": 1836,
"a.out.nodebug.wasm": 1188,
"a.out.nodebug.wasm.gz": 731,
"total": 5109,
"total_gz": 2632,
"total": 4988,
"total_gz": 2567,
"sent": [
"a (fd_write)"
],
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_dylink.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 26433,
"a.out.js.gz": 11266,
"a.out.js": 26398,
"a.out.js.gz": 11245,
"a.out.nodebug.wasm": 17861,
"a.out.nodebug.wasm.gz": 9019,
"total": 44294,
"total_gz": 20285,
"total": 44259,
"total_gz": 20264,
"sent": [
"__syscall_stat64",
"emscripten_resize_heap",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_export_nothing.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 3198,
"a.out.js.gz": 1491,
"a.out.js": 3076,
"a.out.js.gz": 1423,
"a.out.nodebug.wasm": 43,
"a.out.nodebug.wasm.gz": 59,
"total": 3241,
"total_gz": 1550,
"total": 3119,
"total_gz": 1482,
"sent": [],
"imports": [],
"exports": [
Expand Down
4 changes: 2 additions & 2 deletions test/codesize/test_codesize_hello_single_file.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"a.out.js": 5262,
"a.out.js.gz": 2895,
"a.out.js": 5139,
"a.out.js.gz": 2826,
"sent": [
"a (fd_write)"
]
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_hello_wasmfs.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 4286,
"a.out.js.gz": 2092,
"a.out.js": 4161,
"a.out.js.gz": 2030,
"a.out.nodebug.wasm": 1666,
"a.out.nodebug.wasm.gz": 945,
"total": 5952,
"total_gz": 3037,
"total": 5827,
"total_gz": 2975,
"sent": [
"a (fd_write)"
],
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_libcxxabi_message_O3.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 3548,
"a.out.js.gz": 1670,
"a.out.js": 3427,
"a.out.js.gz": 1605,
"a.out.nodebug.wasm": 89,
"a.out.nodebug.wasm.gz": 98,
"total": 3637,
"total_gz": 1768,
"total": 3516,
"total_gz": 1703,
"sent": [],
"imports": [],
"exports": [
Expand Down
Loading
Loading