Debian Codegraph @

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