diff options
author | Alon Zakai <azakai@google.com> | 2020-03-31 15:20:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-31 15:20:50 -0700 |
commit | a32102c7dd7b321330c6cce4d0e3b16e7187a007 (patch) | |
tree | a704cc3a77fca9fbde7a2e05de4f2b0d2980a39f /scripts | |
parent | d8179402b3bb991f336b19bcca8ccbc60c842166 (diff) | |
download | binaryen-a32102c7dd7b321330c6cce4d0e3b16e7187a007.tar.gz binaryen-a32102c7dd7b321330c6cce4d0e3b16e7187a007.tar.bz2 binaryen-a32102c7dd7b321330c6cce4d0e3b16e7187a007.zip |
Avoid unnecessary fp$ in side modules (#2717)
Now that we update the dylink section properly, we can
do the same optimization in side modules as in main ones:
if the module provides a function, don't call an $fp method
during startup, instead add it to the table ourselves and use
the relative offset to the table base.
Fix an issue when the table has no segments initially: the
code just added an offset of 0, but that's not right. Instead,
an a __table_base import and use that as the offset. As
this is ABI-specific I did it on wasm-emscripten-finalize,
leaving TableUtils to just assert on having a singleton
segment.
Add a test of a wasm file with a dylink section to the lld tests.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/test/lld.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/scripts/test/lld.py b/scripts/test/lld.py index 6256ea003..cdbb2878d 100755 --- a/scripts/test/lld.py +++ b/scripts/test/lld.py @@ -32,10 +32,10 @@ def args_for_finalize(filename): def test_wasm_emscripten_finalize(): print('\n[ checking wasm-emscripten-finalize testcases... ]\n') - for wat_path in shared.get_tests(shared.get_test_dir('lld'), ['.wat']): - print('..', wat_path) - is_passive = '.passive.' in wat_path - mem_file = wat_path + '.mem' + for input_path in shared.get_tests(shared.get_test_dir('lld'), ['.wat', '.wasm']): + print('..', input_path) + is_passive = '.passive.' in input_path + mem_file = input_path + '.mem' extension_arg_map = { '.out': [], } @@ -44,13 +44,13 @@ def test_wasm_emscripten_finalize(): '.mem.out': ['--separate-data-segments', mem_file], }) for ext, ext_args in extension_arg_map.items(): - expected_file = wat_path + ext + expected_file = input_path + ext if ext != '.out' and not os.path.exists(expected_file): continue - cmd = shared.WASM_EMSCRIPTEN_FINALIZE + [wat_path, '-S'] + \ + cmd = shared.WASM_EMSCRIPTEN_FINALIZE + [input_path, '-S'] + \ ext_args - cmd += args_for_finalize(os.path.basename(wat_path)) + cmd += args_for_finalize(os.path.basename(input_path)) actual = support.run_command(cmd) if not os.path.exists(expected_file): @@ -61,7 +61,7 @@ def test_wasm_emscripten_finalize(): if ext == '.mem.out': with open(mem_file) as mf: mem = mf.read() - shared.fail_if_not_identical_to_file(mem, wat_path + + shared.fail_if_not_identical_to_file(mem, input_path + '.mem.mem') os.remove(mem_file) @@ -69,10 +69,10 @@ def test_wasm_emscripten_finalize(): def update_lld_tests(): print('\n[ updating wasm-emscripten-finalize testcases... ]\n') - for wat_path in shared.get_tests(shared.get_test_dir('lld'), ['.wat']): - print('..', wat_path) - is_passive = '.passive.' in wat_path - mem_file = wat_path + '.mem' + for input_path in shared.get_tests(shared.get_test_dir('lld'), ['.wat', '.wasm']): + print('..', input_path) + is_passive = '.passive.' in input_path + mem_file = input_path + '.mem' extension_arg_map = { '.out': [], } @@ -81,12 +81,12 @@ def update_lld_tests(): '.mem.out': ['--separate-data-segments', mem_file + '.mem'], }) for ext, ext_args in extension_arg_map.items(): - out_path = wat_path + ext + out_path = input_path + ext if ext != '.out' and not os.path.exists(out_path): continue - cmd = shared.WASM_EMSCRIPTEN_FINALIZE + [wat_path, '-S'] + \ + cmd = shared.WASM_EMSCRIPTEN_FINALIZE + [input_path, '-S'] + \ ext_args - cmd += args_for_finalize(os.path.basename(wat_path)) + cmd += args_for_finalize(os.path.basename(input_path)) actual = support.run_command(cmd) with open(out_path, 'w') as o: o.write(actual) |