diff --git a/test/testsuite/wasi_threads_exit_main_block.wat b/test/testsuite/wasi_threads_exit_main_block.wat index b75773c..12ac34f 100644 --- a/test/testsuite/wasi_threads_exit_main_block.wat +++ b/test/testsuite/wasi_threads_exit_main_block.wat @@ -1,5 +1,8 @@ ;; When the main thread calls proc_exit, it should terminate ;; a thread blocking in `memory.atomic.wait32` opecode. +;; +;; linear memory usage: +;; 0: notify/wait (module (memory (export "memory") (import "foo" "bar") 1 1 shared) diff --git a/test/testsuite/wasi_threads_exit_main_busy.wat b/test/testsuite/wasi_threads_exit_main_busy.wat index 650e8a0..7eb41cf 100644 --- a/test/testsuite/wasi_threads_exit_main_busy.wat +++ b/test/testsuite/wasi_threads_exit_main_busy.wat @@ -1,5 +1,8 @@ ;; When the main thread calls proc_exit, it should terminate ;; a busy-looping thread. +;; +;; linear memory usage: +;; 0: wait (module (memory (export "memory") (import "foo" "bar") 1 1 shared) diff --git a/test/testsuite/wasi_threads_exit_main_wasi.wat b/test/testsuite/wasi_threads_exit_main_wasi.wat index e9df52d..8a6f52b 100644 --- a/test/testsuite/wasi_threads_exit_main_wasi.wat +++ b/test/testsuite/wasi_threads_exit_main_wasi.wat @@ -1,5 +1,11 @@ ;; When the main thread calls proc_exit, it should terminate ;; a thread blocking in a WASI call. (poll_oneoff) +;; +;; linear memory usage: +;; 0: wait +;; 100: poll_oneoff subscription +;; 200: poll_oneoff event +;; 300: poll_oneoff return value (module (memory (export "memory") (import "foo" "bar") 1 1 shared) diff --git a/test/testsuite/wasi_threads_exit_nonmain_block.wat b/test/testsuite/wasi_threads_exit_nonmain_block.wat index fda71fa..41b7945 100644 --- a/test/testsuite/wasi_threads_exit_nonmain_block.wat +++ b/test/testsuite/wasi_threads_exit_nonmain_block.wat @@ -1,5 +1,8 @@ ;; When a non-main thread calls proc_exit, it should terminate ;; the main thread blocking in `memory.atomic.wait32` opecode. +;; +;; linear memory usage: +;; 0: wait (module (memory (export "memory") (import "foo" "bar") 1 1 shared) diff --git a/test/testsuite/wasi_threads_exit_nonmain_busy.wat b/test/testsuite/wasi_threads_exit_nonmain_busy.wat index 972cec7..e4e681c 100644 --- a/test/testsuite/wasi_threads_exit_nonmain_busy.wat +++ b/test/testsuite/wasi_threads_exit_nonmain_busy.wat @@ -1,5 +1,8 @@ ;; When a non-main thread calls proc_exit, it should terminate ;; the main thread which is busy-looping. +;; +;; linear memory usage: +;; 0: wait (module (memory (export "memory") (import "foo" "bar") 1 1 shared) diff --git a/test/testsuite/wasi_threads_exit_nonmain_wasi.wat b/test/testsuite/wasi_threads_exit_nonmain_wasi.wat index c14b121..fd729e3 100644 --- a/test/testsuite/wasi_threads_exit_nonmain_wasi.wat +++ b/test/testsuite/wasi_threads_exit_nonmain_wasi.wat @@ -1,5 +1,11 @@ ;; When a non-main thread calls proc_exit, it should terminate ;; the main thread which is blocking in a WASI call. (poll_oneoff) +;; +;; linear memory usage: +;; 0: wait +;; 100: poll_oneoff subscription +;; 200: poll_oneoff event +;; 300: poll_oneoff return value (module (memory (export "memory") (import "foo" "bar") 1 1 shared) diff --git a/test/testsuite/wasi_threads_spawn.wat b/test/testsuite/wasi_threads_spawn.wat index f99a10b..078969b 100644 --- a/test/testsuite/wasi_threads_spawn.wat +++ b/test/testsuite/wasi_threads_spawn.wat @@ -1,17 +1,22 @@ ;; Create a thread with thread-spawn and perform a few sanity checks. +;; linear memory usage: +;; 0: notify/wait +;; 4: tid +;; 8: user_arg + (module (memory (export "memory") (import "foo" "bar") 1 1 shared) (func $thread_spawn (import "wasi" "thread_spawn") (param i32) (result i32)) (func $proc_exit (import "wasi_snapshot_preview1" "proc_exit") (param i32)) - (func (export "wasi_thread_start") (param i32 i32) + (func (export "wasi_thread_start") (param $tid i32) (param $user_arg i32) ;; store tid i32.const 4 - local.get 0 + local.get $tid i32.store ;; store user pointer i32.const 8 - local.get 1 + local.get $user_arg i32.store ;; notify the main i32.const 0 @@ -23,12 +28,12 @@ drop ;; returning from wasi_thread_start terminates only this thread ) - (func (export "_start") (local i32) + (func (export "_start") (local $tid i32) ;; spawn a thread i32.const 12345 ;; user pointer call $thread_spawn ;; check error - local.tee 0 ;; save the tid to check later + local.tee $tid ;; save the tid to check later i32.const 0 i32.le_s if @@ -46,7 +51,7 @@ unreachable end ;; check the tid - local.get 0 + local.get $tid i32.const 4 i32.load i32.ne