summaryrefslogtreecommitdiff
path: root/test/unit/input/asyncify-pure.wat
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-12-08 20:50:25 -0600
committerGitHub <noreply@github.com>2019-12-08 20:50:25 -0600
commit42b61e3c2e7851ed001bf26a7e1afab21d0cb38d (patch)
treeb86a0a10ec9ea1d4351e4500ff84f987894aaf8e /test/unit/input/asyncify-pure.wat
parentb232033385b025ba276423613fb67f644c0596ce (diff)
downloadbinaryen-42b61e3c2e7851ed001bf26a7e1afab21d0cb38d.tar.gz
binaryen-42b61e3c2e7851ed001bf26a7e1afab21d0cb38d.tar.bz2
binaryen-42b61e3c2e7851ed001bf26a7e1afab21d0cb38d.zip
Use wat over wast for text format filenames (#2518)
Diffstat (limited to 'test/unit/input/asyncify-pure.wat')
-rw-r--r--test/unit/input/asyncify-pure.wat62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/unit/input/asyncify-pure.wat b/test/unit/input/asyncify-pure.wat
new file mode 100644
index 000000000..961ab9442
--- /dev/null
+++ b/test/unit/input/asyncify-pure.wat
@@ -0,0 +1,62 @@
+(module
+ (memory 1 1)
+ (import "spectest" "print" (func $print (param i32)))
+ (import "asyncify" "start_unwind" (func $asyncify_start_unwind (param i32)))
+ (import "asyncify" "stop_unwind" (func $asyncify_stop_unwind))
+ (import "asyncify" "start_rewind" (func $asyncify_start_rewind (param i32)))
+ (import "asyncify" "stop_rewind" (func $asyncify_stop_rewind))
+ (global $sleeping (mut i32) (i32.const 0))
+ (start $runtime)
+ (func $main
+ (call $print (i32.const 10))
+ (call $before)
+ (call $print (i32.const 20))
+ (call $sleep)
+ (call $print (i32.const 30))
+ (call $after)
+ (call $print (i32.const 40))
+ )
+ (func $before
+ (call $print (i32.const 1))
+ )
+ (func $sleep
+ (call $print (i32.const 1000))
+ (if
+ (i32.eqz (global.get $sleeping))
+ (block
+ (call $print (i32.const 2000))
+ (global.set $sleeping (i32.const 1))
+ (i32.store (i32.const 16) (i32.const 24))
+ (i32.store (i32.const 20) (i32.const 1024))
+ (call $asyncify_start_unwind (i32.const 16))
+ )
+ (block
+ (call $print (i32.const 3000))
+ (call $asyncify_stop_rewind)
+ (global.set $sleeping (i32.const 0))
+ )
+ )
+ (call $print (i32.const 4000))
+ )
+ (func $after
+ (call $print (i32.const 2))
+ )
+ (func $runtime
+ (call $print (i32.const 100))
+ ;; call main the first time, let the stack unwind
+ (call $main)
+ (call $print (i32.const 200))
+ (call $asyncify_stop_unwind)
+ (call $print (i32.const 300))
+ ;; ...can do some async stuff around here...
+ ;; set the rewind in motion
+ (call $asyncify_start_rewind (i32.const 16))
+ (call $print (i32.const 400))
+ (call $main)
+ (call $print (i32.const 500))
+ )
+ ;; interesting escaped name
+ (func $DOS_ReadFile\28unsigned\20short\2c\20unsigned\20char*\2c\20unsigned\20short*\2c\20bool\29 (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32)
+ )
+)
+