Debian Codegraph @

tests/snapshots/cli/stack-switching/control-lwt.wast/6.print

raw
1 (module $scheduler
2 (type $func (;0;) (func))
3 (type $cont (;1;) (cont $func))
4 (type $cont-func (;2;) (func (param (ref $cont))))
5 (type $cont-cont (;3;) (cont $cont-func))
6 (type $func-cont-func-func (;4;) (func (param (ref $func) (ref $cont-func))))
7 (type $func-cont-func-cont (;5;) (cont $func-cont-func-func))
8 (type $func-cont-cont (;6;) (func (param (ref $cont) (ref $cont))))
9 (type $cont-cont-func (;7;) (cont $func-cont-cont))
10 (type (;8;) (func (param i32)))
11 (type (;9;) (func (result i32)))
12 (type (;10;) (func (result (ref null $cont))))
13 (type (;11;) (func (param (ref $cont-cont))))
14 (type (;12;) (func (param (ref null $cont))))
15 (type (;13;) (func (param (ref $func-cont-func-cont))))
16 (import "spectest" "print_i32" (func $log (;0;) (type 8)))
17 (import "queue" "queue-empty" (func $queue-empty (;1;) (type 9)))
18 (import "queue" "dequeue" (func $dequeue (;2;) (type 10)))
19 (import "queue" "enqueue" (func $enqueue (;3;) (type $cont-func)))
20 (import "control" "control" (tag $control (;0;) (type 11) (param (ref $cont-cont))))
21 (import "control" "prompt" (func $prompt (;4;) (type 12)))
22 (export "sync" (func $sync))
23 (export "kt" (func $kt))
24 (export "tk" (func $tk))
25 (export "ykt" (func $ykt))
26 (export "ytk" (func $ytk))
27 (elem (;0;) declare func $handle-yield-sync $handle-yield $handle-fork-sync $handle-fork-kt $handle-fork-tk $handle-fork-ykt $handle-fork-ytk $yield $fork-sync $fork-kt $fork-tk $fork-ykt $fork-ytk)
28 (func $scheduler (;5;) (type 12) (param $nextk (ref null $cont))
29 loop $loop
30 local.get $nextk
31 ref.is_null
32 if ;; label = @2
33 return
34 end
35 local.get $nextk
36 call $prompt
37 call $dequeue
38 local.set $nextk
39 br $loop
40 end
41 )
42 (func $handle-yield-sync (;6;) (type $cont-func) (param $k (ref $cont))
43 local.get $k
44 call $scheduler
45 )
46 (func $yield-sync (;7;) (type $func)
47 ref.func $handle-yield
48 cont.new $cont-cont
49 suspend $control
50 )
51 (func $handle-fork-sync (;8;) (type $func-cont-cont) (param $t (ref $cont)) (param $k (ref $cont))
52 local.get $t
53 call $enqueue
54 local.get $k
55 call $scheduler
56 )
57 (func $fork-sync (;9;) (type $cont-func) (param $t (ref $cont))
58 local.get $t
59 ref.func $handle-fork-sync
60 cont.new $cont-cont-func
61 cont.bind $cont-cont-func $cont-cont
62 suspend $control
63 )
64 (func $sync (;10;) (type 13) (param $k (ref $func-cont-func-cont))
65 ref.func $yield
66 ref.func $fork-sync
67 local.get $k
68 cont.bind $func-cont-func-cont $cont
69 call $scheduler
70 )
71 (func $handle-yield (;11;) (type $cont-func) (param $k (ref $cont))
72 local.get $k
73 call $enqueue
74 call $dequeue
75 call $scheduler
76 )
77 (func $yield (;12;) (type $func)
78 ref.func $handle-yield
79 cont.new $cont-cont
80 suspend $control
81 )
82 (func $handle-fork-kt (;13;) (type $func-cont-cont) (param $t (ref $cont)) (param $k (ref $cont))
83 local.get $t
84 call $enqueue
85 local.get $k
86 call $scheduler
87 )
88 (func $fork-kt (;14;) (type $cont-func) (param $t (ref $cont))
89 local.get $t
90 ref.func $handle-fork-kt
91 cont.new $cont-cont-func
92 cont.bind $cont-cont-func $cont-cont
93 suspend $control
94 )
95 (func $kt (;15;) (type 13) (param $k (ref $func-cont-func-cont))
96 ref.func $yield
97 ref.func $fork-kt
98 local.get $k
99 cont.bind $func-cont-func-cont $cont
100 call $scheduler
101 )
102 (func $handle-fork-tk (;16;) (type $func-cont-cont) (param $t (ref $cont)) (param $k (ref $cont))
103 local.get $k
104 call $enqueue
105 local.get $t
106 call $scheduler
107 )
108 (func $fork-tk (;17;) (type $cont-func) (param $t (ref $cont))
109 local.get $t
110 ref.func $handle-fork-tk
111 cont.new $cont-cont-func
112 cont.bind $cont-cont-func $cont-cont
113 suspend $control
114 )
115 (func $tk (;18;) (type 13) (param $k (ref $func-cont-func-cont))
116 ref.func $yield
117 ref.func $fork-tk
118 local.get $k
119 cont.bind $func-cont-func-cont $cont
120 call $scheduler
121 )
122 (func $handle-fork-ykt (;19;) (type $func-cont-cont) (param $t (ref $cont)) (param $k (ref $cont))
123 local.get $k
124 call $enqueue
125 local.get $t
126 call $enqueue
127 call $dequeue
128 call $scheduler
129 )
130 (func $fork-ykt (;20;) (type $cont-func) (param $t (ref $cont))
131 local.get $t
132 ref.func $handle-fork-ykt
133 cont.new $cont-cont-func
134 cont.bind $cont-cont-func $cont-cont
135 suspend $control
136 )
137 (func $ykt (;21;) (type 13) (param $k (ref $func-cont-func-cont))
138 ref.func $yield
139 ref.func $fork-ykt
140 local.get $k
141 cont.bind $func-cont-func-cont $cont
142 call $scheduler
143 )
144 (func $handle-fork-ytk (;22;) (type $func-cont-cont) (param $t (ref $cont)) (param $k (ref $cont))
145 local.get $t
146 call $enqueue
147 local.get $k
148 call $enqueue
149 call $dequeue
150 call $scheduler
151 )
152 (func $fork-ytk (;23;) (type $cont-func) (param $t (ref $cont))
153 local.get $t
154 ref.func $handle-fork-ytk
155 cont.new $cont-cont-func
156 cont.bind $cont-cont-func $cont-cont
157 suspend $control
158 )
159 (func $ytk (;24;) (type 13) (param $k (ref $func-cont-func-cont))
160 ref.func $yield
161 ref.func $fork-ytk
162 local.get $k
163 cont.bind $func-cont-func-cont $cont
164 call $scheduler
165 )
166 )