diff --git a/ChangeLog.md b/ChangeLog.md index 336852ddbc1da..98400f974877a 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -20,6 +20,8 @@ See docs/process.md for more on how version tagging works. Current Trunk ------------- +- Binaryen now always inlines single-use functions. This should reduce code size + and improve performance (#13744). 2.0.16: 03/25/2021 ------------------ diff --git a/tests/code_size/hello_webgl2_wasm.json b/tests/code_size/hello_webgl2_wasm.json index dcf4aed636341..f3a3468069a2b 100644 --- a/tests/code_size/hello_webgl2_wasm.json +++ b/tests/code_size/hello_webgl2_wasm.json @@ -3,8 +3,8 @@ "a.html.gz": 377, "a.js": 4882, "a.js.gz": 2330, - "a.wasm": 10448, - "a.wasm.gz": 6720, - "total": 15893, - "total_gz": 9427 + "a.wasm": 10356, + "a.wasm.gz": 6676, + "total": 15801, + "total_gz": 9383 } diff --git a/tests/code_size/hello_webgl2_wasm2js.json b/tests/code_size/hello_webgl2_wasm2js.json index fad5fe584c437..ecf064c0bd12c 100644 --- a/tests/code_size/hello_webgl2_wasm2js.json +++ b/tests/code_size/hello_webgl2_wasm2js.json @@ -1,10 +1,10 @@ { "a.html": 588, "a.html.gz": 386, - "a.js": 20432, - "a.js.gz": 8018, + "a.js": 19867, + "a.js.gz": 8077, "a.mem": 3171, "a.mem.gz": 2715, - "total": 24191, - "total_gz": 11119 + "total": 23626, + "total_gz": 11178 } diff --git a/tests/code_size/hello_webgl_wasm.json b/tests/code_size/hello_webgl_wasm.json index da5a2bde68a0c..7f8020059e391 100644 --- a/tests/code_size/hello_webgl_wasm.json +++ b/tests/code_size/hello_webgl_wasm.json @@ -3,8 +3,8 @@ "a.html.gz": 377, "a.js": 4386, "a.js.gz": 2156, - "a.wasm": 10448, - "a.wasm.gz": 6720, - "total": 15397, - "total_gz": 9253 + "a.wasm": 10356, + "a.wasm.gz": 6676, + "total": 15305, + "total_gz": 9209 } diff --git a/tests/code_size/hello_webgl_wasm2js.json b/tests/code_size/hello_webgl_wasm2js.json index 340cf9bb3a11b..d72a3e9a1d72b 100644 --- a/tests/code_size/hello_webgl_wasm2js.json +++ b/tests/code_size/hello_webgl_wasm2js.json @@ -1,10 +1,10 @@ { "a.html": 588, "a.html.gz": 386, - "a.js": 19917, - "a.js.gz": 7870, + "a.js": 19352, + "a.js.gz": 7918, "a.mem": 3171, "a.mem.gz": 2715, - "total": 23676, - "total_gz": 10971 + "total": 23111, + "total_gz": 11019 } diff --git a/tests/code_size/random_printf_wasm.json b/tests/code_size/random_printf_wasm.json index 6974fa6f65bdf..dfd4f27f07bd7 100644 --- a/tests/code_size/random_printf_wasm.json +++ b/tests/code_size/random_printf_wasm.json @@ -1,6 +1,6 @@ { - "a.html": 12617, - "a.html.gz": 6787, - "total": 12617, - "total_gz": 6787 + "a.html": 12509, + "a.html.gz": 6735, + "total": 12509, + "total_gz": 6735 } diff --git a/tests/code_size/random_printf_wasm2js.json b/tests/code_size/random_printf_wasm2js.json index 33a7bade92284..f7b617f6b3fac 100644 --- a/tests/code_size/random_printf_wasm2js.json +++ b/tests/code_size/random_printf_wasm2js.json @@ -1,6 +1,6 @@ { - "a.html": 17510, - "a.html.gz": 7437, - "total": 17510, - "total_gz": 7437 + "a.html": 17254, + "a.html.gz": 7401, + "total": 17254, + "total_gz": 7401 } diff --git a/tests/other/metadce/hello_world_O2.funcs b/tests/other/metadce/hello_world_O2.funcs index 01043eb8306b7..e422e214a61be 100644 --- a/tests/other/metadce/hello_world_O2.funcs +++ b/tests/other/metadce/hello_world_O2.funcs @@ -2,17 +2,12 @@ $__emscripten_stdout_close $__emscripten_stdout_seek $__errno_location $__fwritex -$__overflow $__stdio_write $__towrite $__wasi_syscall_ret $__wasm_call_ctors -$fwrite $legalstub$dynCall_jiji $main -$memcpy -$puts $stackAlloc $stackRestore $stackSave -$strlen diff --git a/tests/other/metadce/hello_world_O3.funcs b/tests/other/metadce/hello_world_O3.funcs index 5817f30a9676e..341b1f7f10988 100644 --- a/tests/other/metadce/hello_world_O3.funcs +++ b/tests/other/metadce/hello_world_O3.funcs @@ -1,12 +1,7 @@ $__emscripten_stdout_close $__emscripten_stdout_seek $__fwritex -$__overflow $__stdio_write $__towrite $__wasm_call_ctors -$fwrite $main -$memcpy -$puts -$strlen diff --git a/tests/other/metadce/hello_world_O3_MAIN_MODULE_2.funcs b/tests/other/metadce/hello_world_O3_MAIN_MODULE_2.funcs index 15f749d40d1fe..0f819ed417daf 100644 --- a/tests/other/metadce/hello_world_O3_MAIN_MODULE_2.funcs +++ b/tests/other/metadce/hello_world_O3_MAIN_MODULE_2.funcs @@ -1,20 +1,14 @@ $__emscripten_stdout_close $__emscripten_stdout_seek $__fwritex -$__overflow $__stdio_write $__towrite -$__wasm_apply_data_relocs $__wasm_apply_global_relocs $__wasm_call_ctors $dlmalloc -$fwrite $legalstub$dynCall_jiji $main -$memcpy -$puts $sbrk $stackAlloc $stackRestore $stackSave -$strlen diff --git a/tests/other/metadce/hello_world_Os.funcs b/tests/other/metadce/hello_world_Os.funcs index be0a7847c413d..6840fa3f66bd8 100644 --- a/tests/other/metadce/hello_world_Os.funcs +++ b/tests/other/metadce/hello_world_Os.funcs @@ -1,13 +1,8 @@ $__emscripten_stdout_close $__emscripten_stdout_seek $__fwritex -$__overflow $__stdio_write $__towrite $__wasi_syscall_ret $__wasm_call_ctors -$fwrite $main -$memcpy -$puts -$strlen diff --git a/tests/other/metadce/hello_world_Oz.funcs b/tests/other/metadce/hello_world_Oz.funcs index be0a7847c413d..6840fa3f66bd8 100644 --- a/tests/other/metadce/hello_world_Oz.funcs +++ b/tests/other/metadce/hello_world_Oz.funcs @@ -1,13 +1,8 @@ $__emscripten_stdout_close $__emscripten_stdout_seek $__fwritex -$__overflow $__stdio_write $__towrite $__wasi_syscall_ret $__wasm_call_ctors -$fwrite $main -$memcpy -$puts -$strlen diff --git a/tests/other/metadce/mem_O3.funcs b/tests/other/metadce/mem_O3.funcs index c707f3f2fe654..aa0174861bf05 100644 --- a/tests/other/metadce/mem_O3.funcs +++ b/tests/other/metadce/mem_O3.funcs @@ -1,5 +1,4 @@ $__wasm_call_ctors -$dlmalloc $main $sbrk $stackAlloc diff --git a/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH.funcs b/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH.funcs index c707f3f2fe654..aa0174861bf05 100644 --- a/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH.funcs +++ b/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH.funcs @@ -1,5 +1,4 @@ $__wasm_call_ctors -$dlmalloc $main $sbrk $stackAlloc diff --git a/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH_STANDALONE_WASM.funcs b/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH_STANDALONE_WASM.funcs index 5c0a7037f4512..8a606d12795d2 100644 --- a/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH_STANDALONE_WASM.funcs +++ b/tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH_STANDALONE_WASM.funcs @@ -1,6 +1,3 @@ -$__main_void $__wasm_call_ctors $_start -$dlmalloc -$emscripten_resize_heap $sbrk diff --git a/tests/other/metadce/mem_O3_STANDALONE_WASM.funcs b/tests/other/metadce/mem_O3_STANDALONE_WASM.funcs index 3b0c9127112e5..8a606d12795d2 100644 --- a/tests/other/metadce/mem_O3_STANDALONE_WASM.funcs +++ b/tests/other/metadce/mem_O3_STANDALONE_WASM.funcs @@ -1,5 +1,3 @@ -$__main_void $__wasm_call_ctors $_start -$dlmalloc $sbrk diff --git a/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM.funcs b/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM.funcs index 3df33b3441ed5..8a606d12795d2 100644 --- a/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM.funcs +++ b/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM.funcs @@ -1,4 +1,3 @@ $__wasm_call_ctors $_start -$dlmalloc $sbrk diff --git a/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM_flto.funcs b/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM_flto.funcs index b264d43811522..86fd2dc1446bb 100644 --- a/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM_flto.funcs +++ b/tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM_flto.funcs @@ -1,3 +1,2 @@ $__wasm_call_ctors $_start -$dlmalloc diff --git a/tests/other/metadce/mem_no_main_O3_STANDALONE_WASM_noentry.funcs b/tests/other/metadce/mem_no_main_O3_STANDALONE_WASM_noentry.funcs index c0964edec3d7f..109453df798f0 100644 --- a/tests/other/metadce/mem_no_main_O3_STANDALONE_WASM_noentry.funcs +++ b/tests/other/metadce/mem_no_main_O3_STANDALONE_WASM_noentry.funcs @@ -1,4 +1,3 @@ $__wasm_call_ctors -$dlmalloc $foo $sbrk diff --git a/tests/other/metadce/minimal_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.funcs b/tests/other/metadce/minimal_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.funcs index 44b395af24bcf..17dedb5a5c6cd 100644 --- a/tests/other/metadce/minimal_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.funcs +++ b/tests/other/metadce/minimal_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.funcs @@ -1,17 +1,12 @@ -$GetOrAllocateQueue $GetQueue $__emscripten_pthread_data_constructor $__errno_location $__pthread_mutex_lock -$__pthread_mutex_timedlock $__pthread_mutex_trylock -$__pthread_mutex_trylock_owner $__pthread_mutex_unlock $__pthread_self_internal $__pthread_setcancelstate $__pthread_tsd_run_dtors -$__timedwait -$__timedwait_cp $__wasm_call_ctors $__wasm_init_memory $_do_call @@ -37,11 +32,8 @@ $emscripten_stack_set_limits $emscripten_sync_run_in_main_thread $emscripten_sync_run_in_main_thread $emscripten_tls_init -$emscripten_wait_for_call_v $free_tls $init_mparams -$internal_memalign -$pthread_mutex_init $sbrk $stackAlloc $stackRestore diff --git a/tests/test_other.py b/tests/test_other.py index 6c98c4470af9d..b90ca5eccfb2f 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -6813,8 +6813,6 @@ def assertFileContents(self, filename, contents): def run_metadce_test(self, filename, args, expected_exists, expected_not_exists, expected_size, check_sent=True, check_imports=True, check_exports=True, check_funcs=True): - return self.skipTest('let https://github.com/WebAssembly/binaryen/pull/3730 roll in') - size_slack = 0.05 # in -Os, -Oz, we remove imports wasm doesn't need @@ -8438,7 +8436,6 @@ def test(args, closure, opt): 'hello_webgl2_wasm': ('hello_webgl2', False), 'hello_webgl2_wasm2js': ('hello_webgl2', True), }) - @unittest.skip('let https://github.com/WebAssembly/binaryen/pull/3730 roll in') def test_minimal_runtime_code_size(self, test_name, js, compare_js_output=False): smallest_code_size_args = ['-s', 'MINIMAL_RUNTIME=2', '-s', 'ENVIRONMENT=web',