Debian Codegraph @

tests/snapshots/cli/stack-switching/cont.wast/59.print

raw
1 (module $client
2 (type $task-0 (;0;) (func (param i32) (result i32)))
3 (type $ct-0 (;1;) (cont $task-0))
4 (type $task (;2;) (func (result i32)))
5 (type $ct (;3;) (cont $task))
6 (type (;4;) (func (param (ref $ct) (ref $ct)) (result i32)))
7 (type (;5;) (func (param i32)))
8 (type (;6;) (func))
9 (import "co2" "seesaw" (func $seesaw (;0;) (type 4)))
10 (import "spectest" "print_i32" (func $print-i32 (;1;) (type 5)))
11 (import "co2" "pause" (tag $pause (;0;) (type 6)))
12 (export "main" (func 4))
13 (elem (;0;) declare func $even $odd)
14 (func $even (;2;) (type $task-0) (param $niter i32) (result i32)
15 (local $next i32) (local $i i32)
16 loop $print-next
17 local.get $next
18 call $print-i32
19 suspend $pause
20 local.get $next
21 i32.const 2
22 i32.add
23 local.set $next
24 local.get $i
25 i32.const 1
26 i32.add
27 local.set $i
28 local.get $i
29 local.get $niter
30 i32.lt_u
31 br_if $print-next
32 end
33 local.get $next
34 )
35 (func $odd (;3;) (type $task-0) (param $niter i32) (result i32)
36 (local $next i32) (local $i i32)
37 i32.const 1
38 local.set $next
39 loop $print-next
40 local.get $next
41 call $print-i32
42 suspend $pause
43 local.get $next
44 i32.const 2
45 i32.add
46 local.set $next
47 local.get $i
48 i32.const 1
49 i32.add
50 local.set $i
51 local.get $i
52 local.get $niter
53 i32.lt_u
54 br_if $print-next
55 end
56 local.get $next
57 )
58 (func (;4;) (type $task) (result i32)
59 i32.const 5
60 ref.func $even
61 cont.new $ct-0
62 cont.bind $ct-0 $ct
63 i32.const 5
64 ref.func $odd
65 cont.new $ct-0
66 cont.bind $ct-0 $ct
67 call $seesaw
68 )
69 )