Debian Codegraph @

crates/wit-component/tests/components/adapt-inject-stack-with-realloc-no-state/component.wat

raw
1 (component
2 (type (;0;)
3 (instance
4 (type (;0;) (tuple u32 u32))
5 (type (;1;) (func (result 0)))
6 (export (;0;) "get-two" (func (type 1)))
7 )
8 )
9 (import "new" (instance (;0;) (type 0)))
10 (core module (;0;)
11 (type (;0;) (func (result i32)))
12 (type (;1;) (func (param i32 i32 i32 i32) (result i32)))
13 (import "old" "get_sum" (func (;0;) (type 0)))
14 (memory (;0;) 1)
15 (export "memory" (memory 0))
16 (export "cabi_realloc" (func $cabi_realloc))
17 (func $cabi_realloc (;1;) (type 1) (param i32 i32 i32 i32) (result i32)
18 (local i32)
19 i32.const 0
20 local.get 0
21 i32.ne
22 if ;; label = @1
23 unreachable
24 end
25 i32.const 0
26 local.get 1
27 i32.ne
28 if ;; label = @1
29 unreachable
30 end
31 i32.const 65536
32 local.get 3
33 i32.ne
34 if ;; label = @1
35 unreachable
36 end
37 i32.const 1
38 memory.grow
39 local.tee 4
40 i32.const -1
41 i32.eq
42 if ;; label = @1
43 unreachable
44 end
45 local.get 4
46 i32.const 16
47 i32.shl
48 )
49 (@producers
50 (processed-by "wit-component" "$CARGO_PKG_VERSION")
51 (processed-by "my-fake-bindgen" "123.45")
52 )
53 )
54 (core module (;1;)
55 (type (;0;) (func (param i32)))
56 (type (;1;) (func (param i32 i32 i32 i32) (result i32)))
57 (type (;2;) (func (result i32)))
58 (type (;3;) (func (param i32 i32 i32 i32) (result i32)))
59 (type (;4;) (func))
60 (import "env" "memory" (memory (;0;) 0))
61 (import "new" "get-two" (func $get_two (;0;) (type 0)))
62 (import "__main_module__" "cabi_realloc" (func $cabi_realloc (;1;) (type 1)))
63 (global $__stack_pointer (;0;) (mut i32) i32.const 0)
64 (global $some_other_mutable_global (;1;) (mut i32) i32.const 0)
65 (export "get_sum" (func 2))
66 (start $allocate_stack)
67 (func (;2;) (type 2) (result i32)
68 (local i32 i32)
69 i32.const 0
70 i32.const 0
71 i32.const 8
72 i32.const 65536
73 call $cabi_realloc
74 local.set 0
75 local.get 0
76 i32.const 42
77 i32.store
78 local.get 0
79 i32.const 42
80 i32.store offset=65532
81 global.get $__stack_pointer
82 local.tee 0
83 i32.const 8
84 i32.sub
85 local.tee 1
86 global.set $__stack_pointer
87 local.get 1
88 call $get_two
89 local.get 1
90 i32.load
91 local.get 1
92 i32.load offset=4
93 i32.add
94 global.get $some_other_mutable_global
95 global.set $some_other_mutable_global
96 local.get 0
97 global.set $__stack_pointer
98 )
99 (func $realloc_via_memory_grow (;3;) (type 3) (param i32 i32 i32 i32) (result i32)
100 (local i32)
101 i32.const 0
102 local.get 0
103 i32.ne
104 if ;; label = @1
105 unreachable
106 end
107 i32.const 0
108 local.get 1
109 i32.ne
110 if ;; label = @1
111 unreachable
112 end
113 i32.const 65536
114 local.get 3
115 i32.ne
116 if ;; label = @1
117 unreachable
118 end
119 i32.const 1
120 memory.grow
121 local.tee 4
122 i32.const -1
123 i32.eq
124 if ;; label = @1
125 unreachable
126 end
127 local.get 4
128 i32.const 16
129 i32.shl
130 )
131 (func $allocate_stack (;4;) (type 4)
132 i32.const 0
133 i32.const 0
134 i32.const 8
135 i32.const 65536
136 call $realloc_via_memory_grow
137 i32.const 65536
138 i32.add
139 global.set $__stack_pointer
140 )
141 )
142 (core module (;2;)
143 (type (;0;) (func (result i32)))
144 (type (;1;) (func (param i32)))
145 (table (;0;) 2 2 funcref)
146 (export "0" (func $adapt-old-get_sum))
147 (export "1" (func $indirect-new-get-two))
148 (export "$imports" (table 0))
149 (func $adapt-old-get_sum (;0;) (type 0) (result i32)
150 i32.const 0
151 call_indirect (type 0)
152 )
153 (func $indirect-new-get-two (;1;) (type 1) (param i32)
154 local.get 0
155 i32.const 1
156 call_indirect (type 1)
157 )
158 (@producers
159 (processed-by "wit-component" "$CARGO_PKG_VERSION")
160 )
161 )
162 (core module (;3;)
163 (type (;0;) (func (result i32)))
164 (type (;1;) (func (param i32)))
165 (import "" "0" (func (;0;) (type 0)))
166 (import "" "1" (func (;1;) (type 1)))
167 (import "" "$imports" (table (;0;) 2 2 funcref))
168 (elem (;0;) (i32.const 0) func 0 1)
169 (@producers
170 (processed-by "wit-component" "$CARGO_PKG_VERSION")
171 )
172 )
173 (core instance (;0;) (instantiate 2))
174 (alias core export 0 "0" (core func (;0;)))
175 (core instance (;1;)
176 (export "get_sum" (func 0))
177 )
178 (core instance (;2;) (instantiate 0
179 (with "old" (instance 1))
180 )
181 )
182 (alias core export 2 "memory" (core memory (;0;)))
183 (core instance (;3;)
184 (export "memory" (memory 0))
185 )
186 (alias core export 0 "1" (core func (;1;)))
187 (core instance (;4;)
188 (export "get-two" (func 1))
189 )
190 (alias core export 2 "cabi_realloc" (core func (;2;)))
191 (core instance (;5;)
192 (export "cabi_realloc" (func 2))
193 )
194 (core instance (;6;) (instantiate 1
195 (with "env" (instance 3))
196 (with "new" (instance 4))
197 (with "__main_module__" (instance 5))
198 )
199 )
200 (alias core export 0 "$imports" (core table (;0;)))
201 (alias core export 6 "get_sum" (core func (;3;)))
202 (alias export 0 "get-two" (func (;0;)))
203 (core func (;4;) (canon lower (func 0) (memory 0)))
204 (core instance (;7;)
205 (export "$imports" (table 0))
206 (export "0" (func 3))
207 (export "1" (func 4))
208 )
209 (core instance (;8;) (instantiate 3
210 (with "" (instance 7))
211 )
212 )
213 (@producers
214 (processed-by "wit-component" "$CARGO_PKG_VERSION")
215 )
216 )