|
11 | 11 |
|
12 | 12 | ;; Test that we can roundtrip struct and array types |
13 | 13 | (module |
14 | | - ;; Arrays |
| 14 | + ;; Recursive structs |
15 | 15 | ;; CHECK-TEXT: (type $struct-rec-one (sub (struct (field (ref $struct-rec-one))))) |
16 | | - |
17 | | - ;; CHECK-TEXT: (type $struct-rec-two (sub $struct-rec-one (struct (field (ref $struct-rec-two)) (field (ref $struct-rec-two))))) |
18 | | - |
19 | | - ;; CHECK-TEXT: (type $vector-i32 (array i32)) |
20 | 16 | ;; CHECK-BIN: (type $struct-rec-one (sub (struct (field (ref $struct-rec-one))))) |
21 | | - |
| 17 | + (type $struct-rec-one (sub (struct |
| 18 | + (field (ref $struct-rec-one)) |
| 19 | + ))) |
| 20 | + ;; CHECK-TEXT: (type $struct-rec-two (sub $struct-rec-one (struct (field (ref $struct-rec-two)) (field (ref $struct-rec-two))))) |
22 | 21 | ;; CHECK-BIN: (type $struct-rec-two (sub $struct-rec-one (struct (field (ref $struct-rec-two)) (field (ref $struct-rec-two))))) |
| 22 | + (type $struct-rec-two (sub $struct-rec-one (struct |
| 23 | + (field (ref $struct-rec-two)) |
| 24 | + (field (ref $struct-rec-two)) |
| 25 | + ))) |
23 | 26 |
|
24 | | - ;; CHECK-BIN: (type $vector-i32 (array i32)) |
25 | | - (type $vector-i32 (array i32)) |
26 | | - |
| 27 | + ;; Non-recursive structs |
27 | 28 | ;; CHECK-TEXT: (type $struct-any (sub (struct (field (ref any))))) |
28 | | - |
29 | | - ;; CHECK-TEXT: (type $struct-i31 (sub $struct-any (struct (field (ref i31))))) |
30 | | - |
31 | | - ;; CHECK-TEXT: (type $vector-any (sub (array (ref any)))) |
32 | 29 | ;; CHECK-BIN: (type $struct-any (sub (struct (field (ref any))))) |
33 | | - |
| 30 | + (type $struct-any (sub (struct |
| 31 | + (field (ref any)) |
| 32 | + ))) |
| 33 | + ;; CHECK-TEXT: (type $struct-i31 (sub $struct-any (struct (field (ref i31))))) |
34 | 34 | ;; CHECK-BIN: (type $struct-i31 (sub $struct-any (struct (field (ref i31))))) |
| 35 | + (type $struct-i31 (sub $struct-any (struct |
| 36 | + (field (ref i31)) |
| 37 | + ))) |
35 | 38 |
|
| 39 | + ;; Arrays |
| 40 | + ;; CHECK-TEXT: (type $vector-any (sub (array (ref any)))) |
36 | 41 | ;; CHECK-BIN: (type $vector-any (sub (array (ref any)))) |
37 | 42 | (type $vector-any (sub (array (ref any)))) |
| 43 | + |
| 44 | + ;; CHECK-TEXT: (type $vector-i32 (array i32)) |
| 45 | + ;; CHECK-BIN: (type $vector-i32 (array i32)) |
| 46 | + (type $vector-i32 (array i32)) |
| 47 | + |
38 | 48 | ;; CHECK-TEXT: (type $vector-i31 (sub $vector-any (array (ref i31)))) |
39 | 49 | ;; CHECK-BIN: (type $vector-i31 (sub $vector-any (array (ref i31)))) |
40 | 50 | (type $vector-i31 (sub $vector-any (array (ref i31)))) |
41 | 51 |
|
42 | | - ;; Structs |
43 | | - (type $struct-any (sub (struct |
44 | | - (field (ref any)) |
45 | | - ))) |
46 | | - (type $struct-i31 (sub $struct-any (struct |
47 | | - (field (ref i31)) |
48 | | - ))) |
49 | 52 | ;; CHECK-TEXT: (type $struct-i31_any (sub $struct-i31 (struct (field (ref i31)) (field (ref any))))) |
50 | 53 | ;; CHECK-BIN: (type $struct-i31_any (sub $struct-i31 (struct (field (ref i31)) (field (ref any))))) |
51 | 54 | (type $struct-i31_any (sub $struct-i31(struct |
52 | 55 | (field (ref i31)) |
53 | 56 | (field (ref any)) |
54 | 57 | ))) |
55 | 58 |
|
56 | | - ;; Recursive structs |
57 | | - (type $struct-rec-one (sub (struct |
58 | | - (field (ref $struct-rec-one)) |
59 | | - ))) |
60 | | - (type $struct-rec-two (sub $struct-rec-one (struct |
61 | | - (field (ref $struct-rec-two)) |
62 | | - (field (ref $struct-rec-two)) |
63 | | - ))) |
64 | | - |
65 | 59 | ;; CHECK-TEXT: (type $8 (func (param (ref $vector-i32) (ref null $vector-i32)))) |
66 | 60 |
|
67 | 61 | ;; CHECK-TEXT: (type $9 (func (param (ref $vector-i31) (ref $vector-any)))) |
|
166 | 160 |
|
167 | 161 | ;; CHECK-BIN-NODEBUG: (type $1 (sub $0 (struct (field (ref $1)) (field (ref $1))))) |
168 | 162 |
|
169 | | -;; CHECK-BIN-NODEBUG: (type $2 (array i32)) |
| 163 | +;; CHECK-BIN-NODEBUG: (type $2 (sub (struct (field (ref any))))) |
170 | 164 |
|
171 | | -;; CHECK-BIN-NODEBUG: (type $3 (sub (struct (field (ref any))))) |
| 165 | +;; CHECK-BIN-NODEBUG: (type $3 (sub $2 (struct (field (ref i31))))) |
172 | 166 |
|
173 | | -;; CHECK-BIN-NODEBUG: (type $4 (sub $3 (struct (field (ref i31))))) |
| 167 | +;; CHECK-BIN-NODEBUG: (type $4 (sub (array (ref any)))) |
174 | 168 |
|
175 | | -;; CHECK-BIN-NODEBUG: (type $5 (sub (array (ref any)))) |
| 169 | +;; CHECK-BIN-NODEBUG: (type $5 (array i32)) |
176 | 170 |
|
177 | | -;; CHECK-BIN-NODEBUG: (type $6 (sub $5 (array (ref i31)))) |
| 171 | +;; CHECK-BIN-NODEBUG: (type $6 (sub $4 (array (ref i31)))) |
178 | 172 |
|
179 | | -;; CHECK-BIN-NODEBUG: (type $7 (sub $4 (struct (field (ref i31)) (field (ref any))))) |
| 173 | +;; CHECK-BIN-NODEBUG: (type $7 (sub $3 (struct (field (ref i31)) (field (ref any))))) |
180 | 174 |
|
181 | | -;; CHECK-BIN-NODEBUG: (type $8 (func (param (ref $2) (ref null $2)))) |
| 175 | +;; CHECK-BIN-NODEBUG: (type $8 (func (param (ref $5) (ref null $5)))) |
182 | 176 |
|
183 | | -;; CHECK-BIN-NODEBUG: (type $9 (func (param (ref $6) (ref $5)))) |
| 177 | +;; CHECK-BIN-NODEBUG: (type $9 (func (param (ref $6) (ref $4)))) |
184 | 178 |
|
185 | | -;; CHECK-BIN-NODEBUG: (type $10 (func (param (ref $4) (ref $3)))) |
| 179 | +;; CHECK-BIN-NODEBUG: (type $10 (func (param (ref $3) (ref $2)))) |
186 | 180 |
|
187 | | -;; CHECK-BIN-NODEBUG: (type $11 (func (param (ref $4) (ref $7)))) |
| 181 | +;; CHECK-BIN-NODEBUG: (type $11 (func (param (ref $3) (ref $7)))) |
188 | 182 |
|
189 | 183 | ;; CHECK-BIN-NODEBUG: (type $12 (func (param (ref $0) (ref $1)))) |
190 | 184 |
|
191 | | -;; CHECK-BIN-NODEBUG: (func $0 (type $8) (param $0 (ref $2)) (param $1 (ref null $2)) |
| 185 | +;; CHECK-BIN-NODEBUG: (func $0 (type $8) (param $0 (ref $5)) (param $1 (ref null $5)) |
192 | 186 | ;; CHECK-BIN-NODEBUG-NEXT: (local.set $1 |
193 | 187 | ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) |
194 | 188 | ;; CHECK-BIN-NODEBUG-NEXT: ) |
195 | 189 | ;; CHECK-BIN-NODEBUG-NEXT: ) |
196 | 190 |
|
197 | | -;; CHECK-BIN-NODEBUG: (func $1 (type $9) (param $0 (ref $6)) (param $1 (ref $5)) |
| 191 | +;; CHECK-BIN-NODEBUG: (func $1 (type $9) (param $0 (ref $6)) (param $1 (ref $4)) |
198 | 192 | ;; CHECK-BIN-NODEBUG-NEXT: (local.set $1 |
199 | 193 | ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) |
200 | 194 | ;; CHECK-BIN-NODEBUG-NEXT: ) |
201 | 195 | ;; CHECK-BIN-NODEBUG-NEXT: ) |
202 | 196 |
|
203 | | -;; CHECK-BIN-NODEBUG: (func $2 (type $10) (param $0 (ref $4)) (param $1 (ref $3)) |
| 197 | +;; CHECK-BIN-NODEBUG: (func $2 (type $10) (param $0 (ref $3)) (param $1 (ref $2)) |
204 | 198 | ;; CHECK-BIN-NODEBUG-NEXT: (local.set $1 |
205 | 199 | ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) |
206 | 200 | ;; CHECK-BIN-NODEBUG-NEXT: ) |
207 | 201 | ;; CHECK-BIN-NODEBUG-NEXT: ) |
208 | 202 |
|
209 | | -;; CHECK-BIN-NODEBUG: (func $3 (type $11) (param $0 (ref $4)) (param $1 (ref $7)) |
| 203 | +;; CHECK-BIN-NODEBUG: (func $3 (type $11) (param $0 (ref $3)) (param $1 (ref $7)) |
210 | 204 | ;; CHECK-BIN-NODEBUG-NEXT: (local.set $0 |
211 | 205 | ;; CHECK-BIN-NODEBUG-NEXT: (local.get $1) |
212 | 206 | ;; CHECK-BIN-NODEBUG-NEXT: ) |
|
0 commit comments