Debian Codegraph @

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

raw
1 (module
2 (type $proc (;0;) (func))
3 (type $pproc (;1;) (func (param i32)))
4 (type $cont (;2;) (cont $proc))
5 (type $pcont (;3;) (cont $pproc))
6 (type (;4;) (func (param (ref $cont))))
7 (type (;5;) (func (param i32 i32)))
8 (import "scheduler" "yield" (tag $yield (;0;) (type $proc)))
9 (import "scheduler" "spawn" (tag $spawn (;1;) (type 4) (param (ref $cont))))
10 (import "scheduler" "scheduler" (func $scheduler (;0;) (type 4)))
11 (import "spectest" "print_i32" (func $log (;1;) (type $pproc)))
12 (global $width (;0;) (mut i32) i32.const 0)
13 (global $depth (;1;) (mut i32) i32.const 0)
14 (export "run" (func 6))
15 (elem (;0;) declare func $main $thread1 $thread2 $thread3)
16 (func $main (;2;) (type $proc)
17 i32.const 0
18 call $log
19 ref.func $thread1
20 cont.new $cont
21 suspend $spawn
22 i32.const 1
23 call $log
24 global.get $depth
25 ref.func $thread2
26 cont.new $pcont
27 cont.bind $pcont $cont
28 suspend $spawn
29 i32.const 2
30 call $log
31 ref.func $thread3
32 cont.new $cont
33 suspend $spawn
34 i32.const 3
35 call $log
36 )
37 (func $thread1 (;3;) (type $proc)
38 i32.const 10
39 call $log
40 suspend $yield
41 i32.const 11
42 call $log
43 suspend $yield
44 i32.const 12
45 call $log
46 suspend $yield
47 i32.const 13
48 call $log
49 )
50 (func $thread2 (;4;) (type $pproc) (param $d i32)
51 (local $w i32)
52 global.get $width
53 local.set $w
54 i32.const 20
55 call $log
56 local.get $d
57 i32.eqz
58 br_if 0
59 i32.const 21
60 call $log
61 loop $l
62 local.get $w
63 if ;; label = @2
64 i32.const 22
65 call $log
66 suspend $yield
67 i32.const 23
68 call $log
69 local.get $d
70 i32.const 1
71 i32.sub
72 ref.func $thread2
73 cont.new $pcont
74 cont.bind $pcont $cont
75 suspend $spawn
76 i32.const 24
77 call $log
78 local.get $w
79 i32.const 1
80 i32.sub
81 local.set $w
82 br $l
83 end
84 end
85 i32.const 25
86 call $log
87 )
88 (func $thread3 (;5;) (type $proc)
89 i32.const 30
90 call $log
91 suspend $yield
92 i32.const 31
93 call $log
94 suspend $yield
95 i32.const 32
96 call $log
97 )
98 (func (;6;) (type 5) (param $width i32) (param $depth i32)
99 local.get $depth
100 global.set $depth
101 local.get $width
102 global.set $width
103 i32.const -1
104 call $log
105 ref.func $main
106 cont.new $cont
107 call $scheduler
108 i32.const -2
109 call $log
110 )
111 )