diff options
author | Alon Zakai <azakai@google.com> | 2020-06-12 17:15:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-12 17:15:22 -0700 |
commit | d26f90bba43c1672232f51bc90c8194a31aea065 (patch) | |
tree | 48b7504b2b5e46dec3a8a7fb290e82314ddf6344 /test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-onlylist@waka.txt | |
parent | 49f2443338c00931d2f30f9d8c1706398bd5cb34 (diff) | |
download | binaryen-d26f90bba43c1672232f51bc90c8194a31aea065.tar.gz binaryen-d26f90bba43c1672232f51bc90c8194a31aea065.tar.bz2 binaryen-d26f90bba43c1672232f51bc90c8194a31aea065.zip |
Asyncify: Add an "add list", rename old lists (#2910)
Asyncify does a whole-program analysis to figure out the list of functions
to instrument. In
emscripten-core/emscripten#10746 (comment)
we realized that we need another type of list there, an "add list" which is a
list of functions to add to the instrumented functions list, that is, that we
should definitely instrument.
The use case in that link is that we disable indirect calls, but there is
one special indirect call that we do need to instrument. Being able to add
just that one can be much more efficient than assuming all indirect calls in
a big codebase need instrumentation. Similar issues can come up if we
add a profile-guided option to asyncify, which we've discussed.
The existing lists were not good enough to allow that, so a new option
is needed. I took the opportunity to rename the old ones to something
better and more consistent, so after this PR we have 3 lists as follows:
* The old "remove list" (previously "blacklist") which removes functions
from the list of functions to be instrumented.
* The new "add list" which adds to that list (note how add/remove are
clearly parallel).
* The old "only list" (previously "whitelist") which simply replaces the
entire list, and so only those functions are instrumented and no other.
This PR temporarily still supports the old names in the commandline
arguments, to avoid immediate breakage for our CI.
Diffstat (limited to 'test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-onlylist@waka.txt')
-rw-r--r-- | test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-onlylist@waka.txt | 205 |
1 files changed, 205 insertions, 0 deletions
diff --git a/test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-onlylist@waka.txt b/test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-onlylist@waka.txt new file mode 100644 index 000000000..08eda7a63 --- /dev/null +++ b/test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-onlylist@waka.txt @@ -0,0 +1,205 @@ +(module + (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) + (type $none_=>_i32 (func (result i32))) + (import "env" "import" (func $import)) + (import "env" "import2" (func $import2 (result i32))) + (import "env" "import3" (func $import3 (param i32))) + (memory $0 1 2) + (table $0 2 2 funcref) + (elem (i32.const 0) $calls-import2-drop $calls-import2-drop) + (global $__asyncify_state (mut i32) (i32.const 0)) + (global $__asyncify_data (mut i32) (i32.const 0)) + (export "asyncify_start_unwind" (func $asyncify_start_unwind)) + (export "asyncify_stop_unwind" (func $asyncify_stop_unwind)) + (export "asyncify_start_rewind" (func $asyncify_start_rewind)) + (export "asyncify_stop_rewind" (func $asyncify_stop_rewind)) + (export "asyncify_get_state" (func $asyncify_get_state)) + (func $calls-import + (local $0 i32) + (local.set $0 + (global.get $__asyncify_state) + ) + (block + (call $import) + (if + (i32.ne + (global.get $__asyncify_state) + (local.get $0) + ) + (unreachable) + ) + ) + ) + (func $calls-import2-drop + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local.set $1 + (global.get $__asyncify_state) + ) + (block + (local.set $0 + (block (result i32) + (local.set $2 + (call $import2) + ) + (if + (i32.ne + (global.get $__asyncify_state) + (local.get $1) + ) + (unreachable) + ) + (local.get $2) + ) + ) + (drop + (local.get $0) + ) + ) + ) + (func $returns (result i32) + (local $x i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local.set $5 + (global.get $__asyncify_state) + ) + (block + (block + (local.set $1 + (block (result i32) + (local.set $6 + (call $import2) + ) + (if + (i32.ne + (global.get $__asyncify_state) + (local.get $5) + ) + (unreachable) + ) + (local.get $6) + ) + ) + (local.set $x + (local.get $1) + ) + (local.set $2 + (local.get $x) + ) + (local.set $3 + (local.get $2) + ) + ) + (local.set $4 + (local.get $3) + ) + (return + (local.get $4) + ) + ) + ) + (func $calls-indirect (param $x i32) + (local $1 i32) + (local $2 i32) + (local.set $2 + (global.get $__asyncify_state) + ) + (block + (local.set $1 + (local.get $x) + ) + (block + (call_indirect (type $none_=>_none) + (local.get $1) + ) + (if + (i32.ne + (global.get $__asyncify_state) + (local.get $2) + ) + (unreachable) + ) + ) + ) + ) + (func $asyncify_start_unwind (param $0 i32) + (global.set $__asyncify_state + (i32.const 1) + ) + (global.set $__asyncify_data + (local.get $0) + ) + (if + (i32.gt_u + (i32.load + (global.get $__asyncify_data) + ) + (i32.load offset=4 + (global.get $__asyncify_data) + ) + ) + (unreachable) + ) + ) + (func $asyncify_stop_unwind + (global.set $__asyncify_state + (i32.const 0) + ) + (if + (i32.gt_u + (i32.load + (global.get $__asyncify_data) + ) + (i32.load offset=4 + (global.get $__asyncify_data) + ) + ) + (unreachable) + ) + ) + (func $asyncify_start_rewind (param $0 i32) + (global.set $__asyncify_state + (i32.const 2) + ) + (global.set $__asyncify_data + (local.get $0) + ) + (if + (i32.gt_u + (i32.load + (global.get $__asyncify_data) + ) + (i32.load offset=4 + (global.get $__asyncify_data) + ) + ) + (unreachable) + ) + ) + (func $asyncify_stop_rewind + (global.set $__asyncify_state + (i32.const 0) + ) + (if + (i32.gt_u + (i32.load + (global.get $__asyncify_data) + ) + (i32.load offset=4 + (global.get $__asyncify_data) + ) + ) + (unreachable) + ) + ) + (func $asyncify_get_state (result i32) + (global.get $__asyncify_state) + ) +) |