diff options
Diffstat (limited to 'test/passes')
-rw-r--r-- | test/passes/bysyncify.txt | 89 | ||||
-rw-r--r-- | test/passes/bysyncify.wast | 5 | ||||
-rw-r--r-- | test/passes/bysyncify_optimize-level=1.txt | 10 | ||||
-rw-r--r-- | test/passes/bysyncify_pass-arg=bysyncify-imports@env.import,env.import2.txt (renamed from test/passes/bysyncify_pass-arg=bysyncify@env.import,env.import2.txt) | 58 | ||||
-rw-r--r-- | test/passes/bysyncify_pass-arg=bysyncify-imports@env.import,env.import2.wast (renamed from test/passes/bysyncify_pass-arg=bysyncify@env.import,env.import2.wast) | 0 |
5 files changed, 134 insertions, 28 deletions
diff --git a/test/passes/bysyncify.txt b/test/passes/bysyncify.txt index 1ec35057e..2ab682149 100644 --- a/test/passes/bysyncify.txt +++ b/test/passes/bysyncify.txt @@ -6,6 +6,7 @@ (global $__bysyncify_state (mut i32) (i32.const 0)) (global $__bysyncify_data (mut i32) (i32.const 0)) (export "bysyncify_start_unwind" (func $bysyncify_start_unwind)) + (export "bysyncify_stop_unwind" (func $bysyncify_stop_unwind)) (export "bysyncify_start_rewind" (func $bysyncify_start_rewind)) (export "bysyncify_stop_rewind" (func $bysyncify_stop_rewind)) (func $do_sleep (; 0 ;) (type $FUNCSIG$v) @@ -151,16 +152,40 @@ (i32.const 2) ) ) - (if - (i32.eq - (global.get $__bysyncify_state) - (i32.const 0) - ) - (block + (block + (if + (i32.eq + (global.get $__bysyncify_state) + (i32.const 0) + ) (global.set $sleeping (i32.const 0) ) - (call $bysyncify_stop_rewind) + ) + (if + (if (result i32) + (i32.eq + (global.get $__bysyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $3) + (i32.const 1) + ) + ) + (block + (call $bysyncify_stop_rewind) + (if + (i32.eq + (global.get $__bysyncify_state) + (i32.const 1) + ) + (br $__bysyncify_unwind + (i32.const 1) + ) + ) + ) ) ) ) @@ -458,6 +483,31 @@ ) ) (block + (call $bysyncify_stop_unwind) + (if + (i32.eq + (global.get $__bysyncify_state) + (i32.const 1) + ) + (br $__bysyncify_unwind + (i32.const 0) + ) + ) + ) + ) + (if + (if (result i32) + (i32.eq + (global.get $__bysyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $1) + (i32.const 1) + ) + ) + (block (call $bysyncify_start_rewind (i32.const 4) ) @@ -467,7 +517,7 @@ (i32.const 1) ) (br $__bysyncify_unwind - (i32.const 0) + (i32.const 1) ) ) ) @@ -481,7 +531,7 @@ (i32.const 1) (i32.eq (local.get $1) - (i32.const 1) + (i32.const 2) ) ) (block @@ -492,7 +542,7 @@ (i32.const 1) ) (br $__bysyncify_unwind - (i32.const 1) + (i32.const 2) ) ) ) @@ -546,7 +596,12 @@ (local.get $0) ) ) - (func $bysyncify_start_rewind (; 7 ;) (param $0 i32) + (func $bysyncify_stop_unwind (; 7 ;) + (global.set $__bysyncify_state + (i32.const 0) + ) + ) + (func $bysyncify_start_rewind (; 8 ;) (param $0 i32) (if (i32.gt_u (i32.load @@ -565,7 +620,7 @@ (local.get $0) ) ) - (func $bysyncify_stop_rewind (; 8 ;) + (func $bysyncify_stop_rewind (; 9 ;) (global.set $__bysyncify_state (i32.const 0) ) @@ -583,6 +638,7 @@ (global $__bysyncify_state (mut i32) (i32.const 0)) (global $__bysyncify_data (mut i32) (i32.const 0)) (export "bysyncify_start_unwind" (func $bysyncify_start_unwind)) + (export "bysyncify_stop_unwind" (func $bysyncify_stop_unwind)) (export "bysyncify_start_rewind" (func $bysyncify_start_rewind)) (export "bysyncify_stop_rewind" (func $bysyncify_stop_rewind)) (func $calls-import (; 3 ;) (type $FUNCSIG$v) @@ -2683,7 +2739,12 @@ (local.get $0) ) ) - (func $bysyncify_start_rewind (; 20 ;) (param $0 i32) + (func $bysyncify_stop_unwind (; 20 ;) + (global.set $__bysyncify_state + (i32.const 0) + ) + ) + (func $bysyncify_start_rewind (; 21 ;) (param $0 i32) (if (i32.gt_u (i32.load @@ -2702,7 +2763,7 @@ (local.get $0) ) ) - (func $bysyncify_stop_rewind (; 21 ;) + (func $bysyncify_stop_rewind (; 22 ;) (global.set $__bysyncify_state (i32.const 0) ) diff --git a/test/passes/bysyncify.wast b/test/passes/bysyncify.wast index 7c92bd86f..00ecc7fde 100644 --- a/test/passes/bysyncify.wast +++ b/test/passes/bysyncify.wast @@ -2,6 +2,7 @@ (module (memory 1 2) (import "bysyncify" "start_unwind" (func $bysyncify_start_unwind (param i32))) + (import "bysyncify" "stop_unwind" (func $bysyncify_stop_unwind)) (import "bysyncify" "start_rewind" (func $bysyncify_start_rewind (param i32))) (import "bysyncify" "stop_rewind" (func $bysyncify_stop_rewind)) (global $sleeping (mut i32) (i32.const 0)) @@ -34,8 +35,10 @@ ;; work will sleep, so we exit through here while it is paused ) ;; the second event called from the main event loop: to resume $work, - ;; initiate a rewind, and then do the call to start things back up + ;; stop the unwind, then prepare a rewind, and initiate it by doing + ;; the call to rewind the call stack back up to where it was (func $second_event + (call $bysyncify_stop_unwind) (call $bysyncify_start_rewind (i32.const 4)) (call $work) ) diff --git a/test/passes/bysyncify_optimize-level=1.txt b/test/passes/bysyncify_optimize-level=1.txt index 6eb7217e4..73456a7ae 100644 --- a/test/passes/bysyncify_optimize-level=1.txt +++ b/test/passes/bysyncify_optimize-level=1.txt @@ -10,6 +10,7 @@ (global $__bysyncify_state (mut i32) (i32.const 0)) (global $__bysyncify_data (mut i32) (i32.const 0)) (export "bysyncify_start_unwind" (func $bysyncify_start_unwind)) + (export "bysyncify_stop_unwind" (func $bysyncify_stop_unwind)) (export "bysyncify_start_rewind" (func $bysyncify_start_rewind)) (export "bysyncify_stop_rewind" (func $bysyncify_stop_rewind)) (func $calls-import (; 3 ;) (type $FUNCSIG$v) @@ -1514,7 +1515,12 @@ (local.get $0) ) ) - (func $bysyncify_start_rewind (; 20 ;) (param $0 i32) + (func $bysyncify_stop_unwind (; 20 ;) + (global.set $__bysyncify_state + (i32.const 0) + ) + ) + (func $bysyncify_start_rewind (; 21 ;) (param $0 i32) (if (i32.gt_u (i32.load @@ -1533,7 +1539,7 @@ (local.get $0) ) ) - (func $bysyncify_stop_rewind (; 21 ;) + (func $bysyncify_stop_rewind (; 22 ;) (global.set $__bysyncify_state (i32.const 0) ) diff --git a/test/passes/bysyncify_pass-arg=bysyncify@env.import,env.import2.txt b/test/passes/bysyncify_pass-arg=bysyncify-imports@env.import,env.import2.txt index e850da6cf..81a37a643 100644 --- a/test/passes/bysyncify_pass-arg=bysyncify@env.import,env.import2.txt +++ b/test/passes/bysyncify_pass-arg=bysyncify-imports@env.import,env.import2.txt @@ -6,6 +6,7 @@ (global $__bysyncify_state (mut i32) (i32.const 0)) (global $__bysyncify_data (mut i32) (i32.const 0)) (export "bysyncify_start_unwind" (func $bysyncify_start_unwind)) + (export "bysyncify_stop_unwind" (func $bysyncify_stop_unwind)) (export "bysyncify_start_rewind" (func $bysyncify_start_rewind)) (export "bysyncify_stop_rewind" (func $bysyncify_stop_rewind)) (func $do_sleep (; 0 ;) (type $FUNCSIG$v) @@ -151,16 +152,40 @@ (i32.const 2) ) ) - (if - (i32.eq - (global.get $__bysyncify_state) - (i32.const 0) - ) - (block + (block + (if + (i32.eq + (global.get $__bysyncify_state) + (i32.const 0) + ) (global.set $sleeping (i32.const 0) ) - (call $bysyncify_stop_rewind) + ) + (if + (if (result i32) + (i32.eq + (global.get $__bysyncify_state) + (i32.const 0) + ) + (i32.const 1) + (i32.eq + (local.get $3) + (i32.const 1) + ) + ) + (block + (call $bysyncify_stop_rewind) + (if + (i32.eq + (global.get $__bysyncify_state) + (i32.const 1) + ) + (br $__bysyncify_unwind + (i32.const 1) + ) + ) + ) ) ) ) @@ -546,7 +571,12 @@ (local.get $0) ) ) - (func $bysyncify_start_rewind (; 7 ;) (param $0 i32) + (func $bysyncify_stop_unwind (; 7 ;) + (global.set $__bysyncify_state + (i32.const 0) + ) + ) + (func $bysyncify_start_rewind (; 8 ;) (param $0 i32) (if (i32.gt_u (i32.load @@ -565,7 +595,7 @@ (local.get $0) ) ) - (func $bysyncify_stop_rewind (; 8 ;) + (func $bysyncify_stop_rewind (; 9 ;) (global.set $__bysyncify_state (i32.const 0) ) @@ -583,6 +613,7 @@ (global $__bysyncify_state (mut i32) (i32.const 0)) (global $__bysyncify_data (mut i32) (i32.const 0)) (export "bysyncify_start_unwind" (func $bysyncify_start_unwind)) + (export "bysyncify_stop_unwind" (func $bysyncify_stop_unwind)) (export "bysyncify_start_rewind" (func $bysyncify_start_rewind)) (export "bysyncify_stop_rewind" (func $bysyncify_stop_rewind)) (func $calls-import (; 3 ;) (type $FUNCSIG$v) @@ -1971,7 +2002,12 @@ (local.get $0) ) ) - (func $bysyncify_start_rewind (; 20 ;) (param $0 i32) + (func $bysyncify_stop_unwind (; 20 ;) + (global.set $__bysyncify_state + (i32.const 0) + ) + ) + (func $bysyncify_start_rewind (; 21 ;) (param $0 i32) (if (i32.gt_u (i32.load @@ -1990,7 +2026,7 @@ (local.get $0) ) ) - (func $bysyncify_stop_rewind (; 21 ;) + (func $bysyncify_stop_rewind (; 22 ;) (global.set $__bysyncify_state (i32.const 0) ) diff --git a/test/passes/bysyncify_pass-arg=bysyncify@env.import,env.import2.wast b/test/passes/bysyncify_pass-arg=bysyncify-imports@env.import,env.import2.wast index 7c92bd86f..7c92bd86f 100644 --- a/test/passes/bysyncify_pass-arg=bysyncify@env.import,env.import2.wast +++ b/test/passes/bysyncify_pass-arg=bysyncify-imports@env.import,env.import2.wast |