Debian Codegraph @

crates/wit-component/tests/components/adapt-inject-stack-with-reallocing-adapter/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 (result i32)))
57 (type (;2;) (func (param i32 i32 i32 i32) (result i32)))
58 (type (;3;) (func))
59 (import "env" "memory" (memory (;0;) 0))
60 (import "new" "get-two" (func $get_two (;0;) (type 0)))
61 (import "__main_module__" "cabi_realloc" (func $cabi_realloc (;1;) (type 2)))
62 (global $__stack_pointer (;0;) (mut i32) i32.const 0)
63 (global $some_other_mutable_global (;1;) (mut i32) i32.const 0)
64 (global $allocation_state (;2;) (mut i32) i32.const 0)
65 (export "get_sum" (func 2))
66 (func (;2;) (type 1) (result i32)
67 (local i32 i32)
68 call $allocate_stack
69 global.get $allocation_state
70 i32.const 2
71 i32.ne
72 if ;; label = @1
73 unreachable
74 end
75 global.get $__stack_pointer
76 local.tee 0
77 i32.const 8
78 i32.sub
79 local.tee 1
80 global.set $__stack_pointer
81 local.get 1
82 call $get_two
83 local.get 1
84 i32.load
85 local.get 1
86 i32.load offset=4
87 i32.add
88 global.get $some_other_mutable_global
89 global.set $some_other_mutable_global
90 local.get 0
91 global.set $__stack_pointer
92 )
93 (func $allocate_stack (;3;) (type 3)
94 global.get $allocation_state
95 i32.const 0
96 i32.eq
97 if ;; label = @1
98 i32.const 1
99 global.set $allocation_state
100 i32.const 0
101 i32.const 0
102 i32.const 8
103 i32.const 65536
104 call $cabi_realloc
105 i32.const 65536
106 i32.add
107 global.set $__stack_pointer
108 i32.const 2
109 global.set $allocation_state
110 end
111 )
112 )
113 (core module (;2;)
114 (type (;0;) (func (result i32)))
115 (type (;1;) (func (param i32)))
116 (table (;0;) 2 2 funcref)
117 (export "0" (func $adapt-old-get_sum))
118 (export "1" (func $indirect-new-get-two))
119 (export "$imports" (table 0))
120 (func $adapt-old-get_sum (;0;) (type 0) (result i32)
121 i32.const 0
122 call_indirect (type 0)
123 )
124 (func $indirect-new-get-two (;1;) (type 1) (param i32)
125 local.get 0
126 i32.const 1
127 call_indirect (type 1)
128 )
129 (@producers
130 (processed-by "wit-component" "$CARGO_PKG_VERSION")
131 )
132 )
133 (core module (;3;)
134 (type (;0;) (func (result i32)))
135 (type (;1;) (func (param i32)))
136 (import "" "0" (func (;0;) (type 0)))
137 (import "" "1" (func (;1;) (type 1)))
138 (import "" "$imports" (table (;0;) 2 2 funcref))
139 (elem (;0;) (i32.const 0) func 0 1)
140 (@producers
141 (processed-by "wit-component" "$CARGO_PKG_VERSION")
142 )
143 )
144 (core instance (;0;) (instantiate 2))
145 (alias core export 0 "0" (core func (;0;)))
146 (core instance (;1;)
147 (export "get_sum" (func 0))
148 )
149 (core instance (;2;) (instantiate 0
150 (with "old" (instance 1))
151 )
152 )
153 (alias core export 2 "memory" (core memory (;0;)))
154 (core instance (;3;)
155 (export "memory" (memory 0))
156 )
157 (alias core export 0 "1" (core func (;1;)))
158 (core instance (;4;)
159 (export "get-two" (func 1))
160 )
161 (alias core export 2 "cabi_realloc" (core func (;2;)))
162 (core instance (;5;)
163 (export "cabi_realloc" (func 2))
164 )
165 (core instance (;6;) (instantiate 1
166 (with "env" (instance 3))
167 (with "new" (instance 4))
168 (with "__main_module__" (instance 5))
169 )
170 )
171 (alias core export 0 "$imports" (core table (;0;)))
172 (alias core export 6 "get_sum" (core func (;3;)))
173 (alias export 0 "get-two" (func (;0;)))
174 (core func (;4;) (canon lower (func 0) (memory 0)))
175 (core instance (;7;)
176 (export "$imports" (table 0))
177 (export "0" (func 3))
178 (export "1" (func 4))
179 )
180 (core instance (;8;) (instantiate 3
181 (with "" (instance 7))
182 )
183 )
184 (@producers
185 (processed-by "wit-component" "$CARGO_PKG_VERSION")
186 )
187 )