-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reboot EVAL_CTORS with the new wasm-ctor-eval (#16011)
This updates us to use Binaryen's new version of wasm-ctor-eval, which can now do a lot more things, like eval just part of a function, eval to globals, etc. That plus other changes on the emscripten side that move more things like sbrk into pure wasm means that we can eval a lot more code. Previously -Oz would enable EVAL_CTORS. That was pretty dangerous as often it does not help code size. You really just need to run with the option and then measure the code size change vs the startup speed improvement. So this PR makes us no longer do anything automatically - you must manually build with -s EVAL_CTORS. A new mode EVAL_CTORS=2 is also added. This enables wasm-ctor-eval's new --ignore-external-input flag, which ignores the environment, params to main, etc. This is unsafe, and probably we should have separate options for these things, but for now this seems useful for experimentation. Tested by running all of wasm2 with EVAL_CTORS=2 enabled, and then ignoring the failures that are expected (things reading from argv, for example). Also I ran around 200,000 fuzzer iterations on binaryen. Example results on ./emcc tests/hello_libcxx.cpp -O3: mode | wasm size (bytes) --------------+------------------ normal | 136625 EVAL_CTORS-1 | 136616 EVAL_CTORS-2 | 133059 The output on the last one is: trying to eval __wasm_call_ctors ...success on __wasm_call_ctors. trying to eval main ...partial evalling successful, but stopping since could not eval: call import: wasi_snapshot_preview1.fd_write ...stopping It completely evals the ctors, and in main it evals some stuff, until it reaches a call to print to stdout. Fixes #15402
- Loading branch information
Showing
27 changed files
with
327 additions
and
351 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
__errno_location | ||
__indirect_function_table | ||
__wasm_call_ctors | ||
dynCall_iiiiiijj | ||
dynCall_iiiiij | ||
dynCall_iiiiijj | ||
dynCall_jiji | ||
dynCall_viijii | ||
main | ||
memory | ||
stackAlloc | ||
stackRestore | ||
stackSave |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
env.abort | ||
env.emscripten_memcpy_big | ||
env.emscripten_resize_heap | ||
env.setTempRet0 | ||
env.strftime_l | ||
wasi_snapshot_preview1.environ_get | ||
wasi_snapshot_preview1.environ_sizes_get | ||
wasi_snapshot_preview1.fd_close | ||
wasi_snapshot_preview1.fd_read | ||
wasi_snapshot_preview1.fd_seek | ||
wasi_snapshot_preview1.fd_write |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
98089 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
abort | ||
emscripten_memcpy_big | ||
emscripten_resize_heap | ||
environ_get | ||
environ_sizes_get | ||
fd_close | ||
fd_read | ||
fd_seek | ||
fd_write | ||
setTempRet0 | ||
strftime_l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
124645 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
__errno_location | ||
__indirect_function_table | ||
dynCall_iiiiiijj | ||
dynCall_iiiiij | ||
dynCall_iiiiijj | ||
dynCall_jiji | ||
dynCall_viijii | ||
main | ||
memory | ||
stackAlloc | ||
stackRestore | ||
stackSave |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
env.abort | ||
env.emscripten_memcpy_big | ||
env.emscripten_resize_heap | ||
env.setTempRet0 | ||
env.strftime_l | ||
wasi_snapshot_preview1.fd_close | ||
wasi_snapshot_preview1.fd_read | ||
wasi_snapshot_preview1.fd_seek | ||
wasi_snapshot_preview1.fd_write |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
97987 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
abort | ||
emscripten_memcpy_big | ||
emscripten_resize_heap | ||
environ_get | ||
environ_sizes_get | ||
fd_close | ||
fd_read | ||
fd_seek | ||
fd_write | ||
setTempRet0 | ||
strftime_l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
122060 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
a | ||
b | ||
c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
$add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
11845 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
62 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.