Debian Codegraph @

tests/snapshots/testsuite/proposals/wasm-3.0/call_ref.wast/0.print

raw
1 (module
2 (type $ii (;0;) (func (param i32) (result i32)))
3 (type $ll (;1;) (func (param i64) (result i64)))
4 (type $lll (;2;) (func (param i64 i64) (result i64)))
5 (type (;3;) (func (param (ref $ii) i32) (result i32)))
6 (type (;4;) (func (result i32)))
7 (global $fac (;0;) (ref $ll) ref.func $fac)
8 (global $fac-acc (;1;) (ref $lll) ref.func $fac-acc)
9 (global $fib (;2;) (ref $ll) ref.func $fib)
10 (global $even (;3;) (ref $ll) ref.func $even)
11 (global $odd (;4;) (ref $ll) ref.func $odd)
12 (export "run" (func 3))
13 (export "null" (func 4))
14 (export "fac" (func $fac))
15 (export "fac-acc" (func $fac-acc))
16 (export "fib" (func $fib))
17 (export "even" (func $even))
18 (export "odd" (func $odd))
19 (elem (;0;) declare func $f $g)
20 (elem (;1;) declare func $fac)
21 (elem (;2;) declare func $fac-acc)
22 (elem (;3;) declare func $fib)
23 (elem (;4;) declare func $even $odd)
24 (func $apply (;0;) (type 3) (param $f (ref $ii)) (param $x i32) (result i32)
25 local.get $x
26 local.get $f
27 call_ref $ii
28 )
29 (func $f (;1;) (type $ii) (param i32) (result i32)
30 local.get 0
31 local.get 0
32 i32.mul
33 )
34 (func $g (;2;) (type $ii) (param i32) (result i32)
35 i32.const 0
36 local.get 0
37 i32.sub
38 )
39 (func (;3;) (type $ii) (param $x i32) (result i32)
40 (local $rf (ref null $ii)) (local $rg (ref null $ii))
41 ref.func $f
42 local.set $rf
43 ref.func $g
44 local.set $rg
45 local.get $x
46 local.get $rf
47 call_ref $ii
48 local.get $rg
49 call_ref $ii
50 )
51 (func (;4;) (type 4) (result i32)
52 i32.const 1
53 ref.null $ii
54 call_ref $ii
55 )
56 (func $fac (;5;) (type $ll) (param i64) (result i64)
57 local.get 0
58 i64.eqz
59 if (result i64) ;; label = @1
60 i64.const 1
61 else
62 local.get 0
63 local.get 0
64 i64.const 1
65 i64.sub
66 global.get $fac
67 call_ref $ll
68 i64.mul
69 end
70 )
71 (func $fac-acc (;6;) (type $lll) (param i64 i64) (result i64)
72 local.get 0
73 i64.eqz
74 if (result i64) ;; label = @1
75 local.get 1
76 else
77 local.get 0
78 i64.const 1
79 i64.sub
80 local.get 0
81 local.get 1
82 i64.mul
83 global.get $fac-acc
84 call_ref $lll
85 end
86 )
87 (func $fib (;7;) (type $ll) (param i64) (result i64)
88 local.get 0
89 i64.const 1
90 i64.le_u
91 if (result i64) ;; label = @1
92 i64.const 1
93 else
94 local.get 0
95 i64.const 2
96 i64.sub
97 global.get $fib
98 call_ref $ll
99 local.get 0
100 i64.const 1
101 i64.sub
102 global.get $fib
103 call_ref $ll
104 i64.add
105 end
106 )
107 (func $even (;8;) (type $ll) (param i64) (result i64)
108 local.get 0
109 i64.eqz
110 if (result i64) ;; label = @1
111 i64.const 44
112 else
113 local.get 0
114 i64.const 1
115 i64.sub
116 global.get $odd
117 call_ref $ll
118 end
119 )
120 (func $odd (;9;) (type $ll) (param i64) (result i64)
121 local.get 0
122 i64.eqz
123 if (result i64) ;; label = @1
124 i64.const 99
125 else
126 local.get 0
127 i64.const 1
128 i64.sub
129 global.get $even
130 call_ref $ll
131 end
132 )
133 )