Debian Codegraph @

tests/cli/stack-switching/cont_suspend.wast

raw
1 ;; RUN: wast --assert default --snapshot tests/snapshots % -f stack-switching
2
3 ;; Small continuation resume test
4 ;; expected output:
5 ;; 1 : i32
6 ;; 2 : i32
7 ;; 3 : i32
8 (module
9 (func $print (import "spectest" "print_i32") (param i32) (result))
10 (type $ft (func))
11 (type $ct (cont $ft))
12 (tag $h)
13 (func $f (export "f")
14 (suspend $h)
15 (call $print (i32.const 2)))
16 (func (export "run") (result i32)
17 (call $print (i32.const 1))
18 (block $on_h (result (ref $ct))
19 (resume $ct (on $h $on_h)
20 (cont.new $ct (ref.func $f)))
21 (unreachable))
22 (drop)
23 (call $print (i32.const 3))
24 (return (i32.const 42)))
25 )
26
27 (assert_return (invoke "run") (i32.const 42))