|
58 | 58 |
|
59 | 59 | ;; CHECK: (type $2 (func (param (ref null (exact $A.desc))))) |
60 | 60 |
|
61 | | - ;; CHECK: (func $nullable-descs (type $2) (param $A.desc (ref null (exact $A.desc))) |
| 61 | + ;; CHECK: (func $nullable-desc (type $2) (param $A.desc (ref null (exact $A.desc))) |
62 | 62 | ;; CHECK-NEXT: (local $1 (ref (exact $A.desc))) |
63 | 63 | ;; CHECK-NEXT: (drop |
64 | 64 | ;; CHECK-NEXT: (block (result (ref (exact $A))) |
|
71 | 71 | ;; CHECK-NEXT: ) |
72 | 72 | ;; CHECK-NEXT: ) |
73 | 73 | ;; CHECK-NEXT: ) |
74 | | - (func $nullable-descs (param $A.desc (ref null (exact $A.desc))) |
| 74 | + (func $nullable-desc (param $A.desc (ref null (exact $A.desc))) |
75 | 75 | (drop |
76 | 76 | (struct.new $A |
77 | 77 | (local.get $A.desc) |
|
89 | 89 | ;; CHECK: (type $A.desc (sub (struct))) |
90 | 90 | (type $A.desc (sub (describes $A (struct)))) |
91 | 91 | ) |
92 | | - |
93 | 92 | ;; CHECK: (type $2 (func (param (ref (exact $A.desc))))) |
94 | 93 |
|
95 | | - ;; CHECK: (func $nullable-descs (type $2) (param $A.desc (ref (exact $A.desc))) |
| 94 | + ;; CHECK: (func $nonnullable-desc (type $2) (param $A.desc (ref (exact $A.desc))) |
96 | 95 | ;; CHECK-NEXT: (drop |
97 | 96 | ;; CHECK-NEXT: (block (result (ref (exact $A))) |
98 | 97 | ;; CHECK-NEXT: (struct.new_default $A) |
99 | 98 | ;; CHECK-NEXT: ) |
100 | 99 | ;; CHECK-NEXT: ) |
101 | 100 | ;; CHECK-NEXT: ) |
102 | | - (func $nullable-descs (param $A.desc (ref (exact $A.desc))) |
| 101 | + (func $nonnullable-desc (param $A.desc (ref (exact $A.desc))) |
103 | 102 | (drop |
104 | 103 | ;; Now the descriptor is non-null. |
105 | 104 | (struct.new $A |
|
346 | 345 |
|
347 | 346 | ;; Now we still require B.desc <: A.desc, but now it is B.desc we require to |
348 | 347 | ;; remain a descriptor. This still requires A <: B and for A.desc to remain a |
349 | | -;; descriptor as well, so we cannot optimize |
| 348 | +;; descriptor as well, so we cannot optimize. |
350 | 349 | (module |
351 | 350 | (rec |
352 | 351 | ;; CHECK: (rec |
|
1166 | 1165 | ) |
1167 | 1166 | ) |
1168 | 1167 |
|
| 1168 | +;; When the possibly-trapping global allocations are nested inside other |
| 1169 | +;; allocations that will be removed, they need to be moved to new globals. |
| 1170 | +(module |
| 1171 | + (rec |
| 1172 | + ;; CHECK: (rec |
| 1173 | + ;; CHECK-NEXT: (type $struct (sub (struct))) |
| 1174 | + (type $struct (sub (descriptor $desc (struct)))) |
| 1175 | + ;; CHECK: (type $desc (sub (descriptor $meta (struct)))) |
| 1176 | + (type $desc (sub (describes $struct (descriptor $meta (struct))))) |
| 1177 | + ;; CHECK: (type $meta (sub (describes $desc (struct)))) |
| 1178 | + (type $meta (sub (describes $desc (struct)))) |
| 1179 | + ) |
| 1180 | + |
| 1181 | + ;; CHECK: (global $g (ref $struct) (struct.new_default $struct)) |
| 1182 | + (global $g (ref $struct) (struct.new $struct (struct.new $desc (ref.null none)))) |
| 1183 | +) |
| 1184 | + |
| 1185 | +;; CHECK: (global $unsubtyping-removed-0 (ref (exact $desc)) (struct.new_default $desc |
| 1186 | +;; CHECK-NEXT: (ref.null none) |
| 1187 | +;; CHECK-NEXT: )) |
| 1188 | +(module |
| 1189 | + ;; Same, but now the nesting is under a non-descriptor field. |
| 1190 | + (rec |
| 1191 | + ;; CHECK: (rec |
| 1192 | + ;; CHECK-NEXT: (type $A (sub (struct (field (ref $struct))))) |
| 1193 | + (type $A (sub (struct (field (ref $struct))))) |
| 1194 | + ;; CHECK: (type $struct (sub (struct))) |
| 1195 | + (type $struct (sub (descriptor $desc (struct)))) |
| 1196 | + ;; CHECK: (type $desc (sub (descriptor $meta (struct)))) |
| 1197 | + (type $desc (sub (describes $struct (descriptor $meta (struct))))) |
| 1198 | + ;; CHECK: (type $meta (sub (describes $desc (struct)))) |
| 1199 | + (type $meta (sub (describes $desc (struct)))) |
| 1200 | + ) |
| 1201 | + |
| 1202 | + ;; CHECK: (global $g (ref $A) (struct.new $A |
| 1203 | + ;; CHECK-NEXT: (struct.new_default $struct) |
| 1204 | + ;; CHECK-NEXT: )) |
| 1205 | + (global $g (ref $A) (struct.new $A (struct.new $struct (struct.new $desc (ref.null none))))) |
| 1206 | +) |
| 1207 | + |
| 1208 | +;; CHECK: (global $unsubtyping-removed-0 (ref (exact $desc)) (struct.new_default $desc |
| 1209 | +;; CHECK-NEXT: (ref.null none) |
| 1210 | +;; CHECK-NEXT: )) |
| 1211 | +(module |
1169 | 1212 | ;; This will be invalid soon, but in the meantime we should not be confused when |
1170 | 1213 | ;; the types described by two related descriptors are unrelated. |
1171 | | -(module |
1172 | 1214 | (rec |
1173 | 1215 | ;; CHECK: (rec |
1174 | 1216 | ;; CHECK-NEXT: (type $A (descriptor $super (struct))) |
|
0 commit comments