Debian Codegraph @

crates/wit-component/tests/components/adapt-inject-stack-with-adapt-realloc/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 (export "cabi_realloc_adapter" (func $cabi_realloc_adapter))
18 (func $cabi_realloc (;1;) (type 1) (param i32 i32 i32 i32) (result i32)
19 i32.const 123456789
20 )
21 (func $cabi_realloc_adapter (;2;) (type 1) (param i32 i32 i32 i32) (result i32)
22 i32.const 987654321
23 )
24 (@producers
25 (processed-by "wit-component" "$CARGO_PKG_VERSION")
26 (processed-by "my-fake-bindgen" "123.45")
27 )
28 )
29 (core module (;1;)
30 (type (;0;) (func (param i32)))
31 (type (;1;) (func (param i32 i32 i32 i32) (result i32)))
32 (type (;2;) (func (result i32)))
33 (type (;3;) (func))
34 (import "env" "memory" (memory (;0;) 0))
35 (import "new" "get-two" (func $get_two (;0;) (type 0)))
36 (import "__main_module__" "cabi_realloc_adapter" (func $cabi_realloc (;1;) (type 1)))
37 (global $__stack_pointer (;0;) (mut i32) i32.const 0)
38 (global $some_other_mutable_global (;1;) (mut i32) i32.const 0)
39 (global $allocation_state (;2;) (mut i32) i32.const 0)
40 (export "get_sum" (func 2))
41 (func (;2;) (type 2) (result i32)
42 (local i32 i32)
43 call $allocate_stack
44 global.get $allocation_state
45 i32.const 2
46 i32.ne
47 if ;; label = @1
48 unreachable
49 end
50 i32.const 0
51 i32.const 0
52 i32.const 8
53 i32.const 65536
54 call $cabi_realloc
55 local.set 0
56 local.get 0
57 i32.const 42
58 i32.store
59 local.get 0
60 i32.const 42
61 i32.store offset=65532
62 global.get $__stack_pointer
63 local.tee 0
64 i32.const 8
65 i32.sub
66 local.tee 1
67 global.set $__stack_pointer
68 local.get 1
69 call $get_two
70 local.get 1
71 i32.load
72 local.get 1
73 i32.load offset=4
74 i32.add
75 global.get $some_other_mutable_global
76 global.set $some_other_mutable_global
77 local.get 0
78 global.set $__stack_pointer
79 )
80 (func $allocate_stack (;3;) (type 3)
81 global.get $allocation_state
82 i32.const 0
83 i32.eq
84 if ;; label = @1
85 i32.const 1
86 global.set $allocation_state
87 i32.const 0
88 i32.const 0
89 i32.const 8
90 i32.const 65536
91 call $cabi_realloc
92 i32.const 65536
93 i32.add
94 global.set $__stack_pointer
95 i32.const 2
96 global.set $allocation_state
97 end
98 )
99 )
100 (core module (;2;)
101 (type (;0;) (func (result i32)))
102 (type (;1;) (func (param i32)))
103 (table (;0;) 2 2 funcref)
104 (export "0" (func $adapt-old-get_sum))
105 (export "1" (func $indirect-new-get-two))
106 (export "$imports" (table 0))
107 (func $adapt-old-get_sum (;0;) (type 0) (result i32)
108 i32.const 0
109 call_indirect (type 0)
110 )
111 (func $indirect-new-get-two (;1;) (type 1) (param i32)
112 local.get 0
113 i32.const 1
114 call_indirect (type 1)
115 )
116 (@producers
117 (processed-by "wit-component" "$CARGO_PKG_VERSION")
118 )
119 )
120 (core module (;3;)
121 (type (;0;) (func (result i32)))
122 (type (;1;) (func (param i32)))
123 (import "" "0" (func (;0;) (type 0)))
124 (import "" "1" (func (;1;) (type 1)))
125 (import "" "$imports" (table (;0;) 2 2 funcref))
126 (elem (;0;) (i32.const 0) func 0 1)
127 (@producers
128 (processed-by "wit-component" "$CARGO_PKG_VERSION")
129 )
130 )
131 (core instance (;0;) (instantiate 2))
132 (alias core export 0 "0" (core func (;0;)))
133 (core instance (;1;)
134 (export "get_sum" (func 0))
135 )
136 (core instance (;2;) (instantiate 0
137 (with "old" (instance 1))
138 )
139 )
140 (alias core export 2 "memory" (core memory (;0;)))
141 (core instance (;3;)
142 (export "memory" (memory 0))
143 )
144 (alias core export 0 "1" (core func (;1;)))
145 (core instance (;4;)
146 (export "get-two" (func 1))
147 )
148 (alias core export 2 "cabi_realloc_adapter" (core func (;2;)))
149 (core instance (;5;)
150 (export "cabi_realloc_adapter" (func 2))
151 )
152 (core instance (;6;) (instantiate 1
153 (with "env" (instance 3))
154 (with "new" (instance 4))
155 (with "__main_module__" (instance 5))
156 )
157 )
158 (alias core export 0 "$imports" (core table (;0;)))
159 (alias core export 6 "get_sum" (core func (;3;)))
160 (alias export 0 "get-two" (func (;0;)))
161 (core func (;4;) (canon lower (func 0) (memory 0)))
162 (core instance (;7;)
163 (export "$imports" (table 0))
164 (export "0" (func 3))
165 (export "1" (func 4))
166 )
167 (core instance (;8;) (instantiate 3
168 (with "" (instance 7))
169 )
170 )
171 (@producers
172 (processed-by "wit-component" "$CARGO_PKG_VERSION")
173 )
174 )