Debian Codegraph @

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

raw
1 (module $queue
2 (type $func (;0;) (func))
3 (type $cont (;1;) (cont $func))
4 (type (;2;) (func (result i32)))
5 (type (;3;) (func (result (ref null $cont))))
6 (type (;4;) (func (param (ref $cont))))
7 (table $queue (;0;) 0 (ref null $cont))
8 (global $qdelta (;0;) i32 i32.const 10)
9 (global $qback (;1;) (mut i32) i32.const 0)
10 (global $qfront (;2;) (mut i32) i32.const 0)
11 (export "queue-empty" (func $queue-empty))
12 (export "dequeue" (func $dequeue))
13 (export "enqueue" (func $enqueue))
14 (func $queue-empty (;0;) (type 2) (result i32)
15 global.get $qfront
16 global.get $qback
17 i32.eq
18 )
19 (func $dequeue (;1;) (type 3) (result (ref null $cont))
20 (local $i i32)
21 call $queue-empty
22 if ;; label = @1
23 ref.null $cont
24 return
25 end
26 global.get $qfront
27 local.set $i
28 local.get $i
29 i32.const 1
30 i32.add
31 global.set $qfront
32 local.get $i
33 table.get $queue
34 )
35 (func $enqueue (;2;) (type 4) (param $k (ref $cont))
36 global.get $qback
37 table.size $queue
38 i32.eq
39 if ;; label = @1
40 global.get $qfront
41 global.get $qdelta
42 i32.lt_u
43 if ;; label = @2
44 ref.null $cont
45 global.get $qdelta
46 table.grow $queue
47 drop
48 else
49 global.get $qback
50 global.get $qfront
51 i32.sub
52 global.set $qback
53 i32.const 0
54 global.get $qfront
55 global.get $qback
56 table.copy
57 global.get $qback
58 ref.null $cont
59 global.get $qfront
60 table.fill $queue
61 i32.const 0
62 global.set $qfront
63 end
64 end
65 global.get $qback
66 local.get $k
67 table.set $queue
68 global.get $qback
69 i32.const 1
70 i32.add
71 global.set $qback
72 )
73 )