|
1269 | 1269 | ) |
1270 | 1270 | ) |
1271 | 1271 | ) |
| 1272 | + |
| 1273 | +(module |
| 1274 | + ;; If a signature is used in a continuation, we cannot refine its parameters, |
| 1275 | + ;; as we do not yet support updating continuation instructions with new types. |
| 1276 | + (rec |
| 1277 | + ;; CHECK: (rec |
| 1278 | + ;; CHECK-NEXT: (type $cont (cont $sig)) |
| 1279 | + |
| 1280 | + ;; CHECK: (type $1 (func)) |
| 1281 | + |
| 1282 | + ;; CHECK: (type $other (func)) |
| 1283 | + |
| 1284 | + ;; CHECK: (type $sig (func (param anyref))) |
| 1285 | + (type $sig (func (param anyref))) |
| 1286 | + (type $other (func (param anyref))) |
| 1287 | + (type $cont (cont $sig)) |
| 1288 | + ) |
| 1289 | + ;; CHECK: (elem declare func $cont $not-cont $other) |
| 1290 | + |
| 1291 | + ;; CHECK: (func $cont (type $sig) (param $0 anyref) |
| 1292 | + ;; CHECK-NEXT: (nop) |
| 1293 | + ;; CHECK-NEXT: ) |
| 1294 | + (func $cont (type $sig) (param anyref) |
| 1295 | + ;; The param is unused here, and in all functions below, so we want to |
| 1296 | + ;; remove it where possible. |
| 1297 | + (nop) |
| 1298 | + ) |
| 1299 | + |
| 1300 | + ;; CHECK: (func $not-cont (type $sig) (param $0 anyref) |
| 1301 | + ;; CHECK-NEXT: (nop) |
| 1302 | + ;; CHECK-NEXT: ) |
| 1303 | + (func $not-cont (type $sig) (param anyref) |
| 1304 | + ;; This function cannot be optimized even though it is not used in a |
| 1305 | + ;; continuation. It is enough that it shares a type with a continuation |
| 1306 | + ;; function. |
| 1307 | + (nop) |
| 1308 | + ) |
| 1309 | + |
| 1310 | + ;; CHECK: (func $other (type $other) |
| 1311 | + ;; CHECK-NEXT: (local $0 anyref) |
| 1312 | + ;; CHECK-NEXT: (local.set $0 |
| 1313 | + ;; CHECK-NEXT: (ref.null none) |
| 1314 | + ;; CHECK-NEXT: ) |
| 1315 | + ;; CHECK-NEXT: (nop) |
| 1316 | + ;; CHECK-NEXT: ) |
| 1317 | + (func $other (type $other) (param anyref) |
| 1318 | + ;; This function uses a different type, so it can be optimized. |
| 1319 | + (nop) |
| 1320 | + ) |
| 1321 | + |
| 1322 | + |
| 1323 | + ;; CHECK: (func $test (type $1) |
| 1324 | + ;; CHECK-NEXT: (drop |
| 1325 | + ;; CHECK-NEXT: (cont.new $cont |
| 1326 | + ;; CHECK-NEXT: (ref.func $cont) |
| 1327 | + ;; CHECK-NEXT: ) |
| 1328 | + ;; CHECK-NEXT: ) |
| 1329 | + ;; CHECK-NEXT: (call_ref $sig |
| 1330 | + ;; CHECK-NEXT: (ref.null none) |
| 1331 | + ;; CHECK-NEXT: (ref.func $not-cont) |
| 1332 | + ;; CHECK-NEXT: ) |
| 1333 | + ;; CHECK-NEXT: (call_ref $other |
| 1334 | + ;; CHECK-NEXT: (ref.func $other) |
| 1335 | + ;; CHECK-NEXT: ) |
| 1336 | + ;; CHECK-NEXT: ) |
| 1337 | + (func $test |
| 1338 | + (drop |
| 1339 | + (cont.new $cont |
| 1340 | + (ref.func $cont) |
| 1341 | + ) |
| 1342 | + ) |
| 1343 | + (call_ref $sig |
| 1344 | + (ref.null none) |
| 1345 | + (ref.func $not-cont) |
| 1346 | + ) |
| 1347 | + (call_ref $other |
| 1348 | + (ref.null none) |
| 1349 | + (ref.func $other) |
| 1350 | + ) |
| 1351 | + ) |
| 1352 | +) |
0 commit comments