From 57a81a04f7a49593438dcae4ca8cbad8e465dc2e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 4 Mar 2020 13:21:39 -0800 Subject: Expose asyncify state via a getter (#2679) Normally, a wrapper has to track state separately to know when to unwind/rewind and when to actually call import functions. Exposing Asyncify state can help avoid this duplication and avoid subtle bugs when internal and wrapper state get out of sync. Since this is a tiny function and it's useful for any Asyncify embedder, I've decided to expose it by default rather than hide behind an option. --- ...ify_pass-arg=asyncify-asserts_pass-arg=asyncify-whitelist@waka.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-whitelist@waka.txt') diff --git a/test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-whitelist@waka.txt b/test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-whitelist@waka.txt index 2df8ccae6..fe67c47a7 100644 --- a/test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-whitelist@waka.txt +++ b/test/passes/asyncify_pass-arg=asyncify-asserts_pass-arg=asyncify-whitelist@waka.txt @@ -14,6 +14,7 @@ (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 (; 3 ;) (local $0 i32) (local.set $0 @@ -198,4 +199,7 @@ (unreachable) ) ) + (func $asyncify_get_state (; 11 ;) (result i32) + (global.get $__asyncify_state) + ) ) -- cgit v1.2.3