Skip to content

Update after Binaryen change to inline all single-use functions #13744

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

Merged
merged 9 commits into from
Mar 30, 2021
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
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------------
Expand Down
8 changes: 4 additions & 4 deletions tests/code_size/hello_webgl2_wasm.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 4 additions & 4 deletions tests/code_size/hello_webgl2_wasm2js.json
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 4 additions & 4 deletions tests/code_size/hello_webgl_wasm.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 4 additions & 4 deletions tests/code_size/hello_webgl_wasm2js.json
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 4 additions & 4 deletions tests/code_size/random_printf_wasm.json
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 4 additions & 4 deletions tests/code_size/random_printf_wasm2js.json
Original file line number Diff line number Diff line change
@@ -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
}
5 changes: 0 additions & 5 deletions tests/other/metadce/hello_world_O2.funcs
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 0 additions & 5 deletions tests/other/metadce/hello_world_O3.funcs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
$__emscripten_stdout_close
$__emscripten_stdout_seek
$__fwritex
$__overflow
$__stdio_write
$__towrite
$__wasm_call_ctors
$fwrite
$main
$memcpy
$puts
$strlen
6 changes: 0 additions & 6 deletions tests/other/metadce/hello_world_O3_MAIN_MODULE_2.funcs
Original file line number Diff line number Diff line change
@@ -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
5 changes: 0 additions & 5 deletions tests/other/metadce/hello_world_Os.funcs
Original file line number Diff line number Diff line change
@@ -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
5 changes: 0 additions & 5 deletions tests/other/metadce/hello_world_Oz.funcs
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion tests/other/metadce/mem_O3.funcs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
$__wasm_call_ctors
$dlmalloc
$main
$sbrk
$stackAlloc
1 change: 0 additions & 1 deletion tests/other/metadce/mem_O3_ALLOW_MEMORY_GROWTH.funcs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
$__wasm_call_ctors
$dlmalloc
$main
$sbrk
$stackAlloc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
$__main_void
$__wasm_call_ctors
$_start
$dlmalloc
$emscripten_resize_heap
$sbrk
2 changes: 0 additions & 2 deletions tests/other/metadce/mem_O3_STANDALONE_WASM.funcs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
$__main_void
$__wasm_call_ctors
$_start
$dlmalloc
$sbrk
1 change: 0 additions & 1 deletion tests/other/metadce/mem_no_argv_O3_STANDALONE_WASM.funcs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
$__wasm_call_ctors
$_start
$dlmalloc
$sbrk
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
$__wasm_call_ctors
$_start
$dlmalloc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
$__wasm_call_ctors
$dlmalloc
$foo
$sbrk
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions tests/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down