Commit 3e9589c
committed
trans: Reimplement unwinding on MSVC
This commit transitions the compiler to using the new exception handling
instructions in LLVM for implementing unwinding for MSVC. This affects both 32
and 64-bit MSVC as they're both now using SEH-based strategies. In terms of
standard library support, lots more details about how SEH unwinding is
implemented can be found in the commits.
In terms of trans, this change necessitated a few modifications:
* Branches were added to detect when the old landingpad instruction is used or
the new cleanuppad instruction is used to `trans::cleanup`.
* The return value from `cleanuppad` is not stored in an `alloca` (because it
cannot be).
* Each block in trans now has an `Option<LandingPad>` instead of `is_lpad: bool`
for indicating whether it's in a landing pad or not. The new exception
handling intrinsics require that on MSVC each `call` inside of a landing pad
is annotated with which landing pad that it's in. This change to the basic
block means that whenever a `call` or `invoke` instruction is generated we
know whether to annotate it as part of a cleanuppad or not.
* Lots of modifications were made to the instruction builders to construct the
new instructions as well as pass the tagging information for the call/invoke
instructions.
* The translation of the `try` intrinsics for MSVC has been overhauled to use
the new `catchpad` instruction. The filter function is now also a
rustc-generated function instead of a purely libstd-defined function. The
libstd definition still exists, it just has a stable ABI across architectures
and leaves some of the really weird implementation details to the compiler
(e.g. the `localescape` and `localrecover` intrinsics).1 parent d1cace1 commit 3e9589c
File tree
21 files changed
+1131
-425
lines changed- src
- libcore
- librustc_back/target
- librustc_llvm
- librustc_trans
- back
- trans
- mir
- librustc_typeck/check
- libstd/sys/common/unwind
- rustllvm
21 files changed
+1131
-425
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
555 | | - | |
556 | | - | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
557 | 565 | | |
558 | 566 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
544 | 544 | | |
545 | 545 | | |
546 | 546 | | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
547 | 550 | | |
548 | 551 | | |
549 | 552 | | |
| |||
1149 | 1152 | | |
1150 | 1153 | | |
1151 | 1154 | | |
1152 | | - | |
1153 | | - | |
1154 | | - | |
1155 | | - | |
1156 | | - | |
1157 | | - | |
1158 | | - | |
1159 | | - | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
1160 | 1164 | | |
1161 | 1165 | | |
1162 | 1166 | | |
| |||
1167 | 1171 | | |
1168 | 1172 | | |
1169 | 1173 | | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
1170 | 1199 | | |
1171 | 1200 | | |
1172 | 1201 | | |
| |||
1476 | 1505 | | |
1477 | 1506 | | |
1478 | 1507 | | |
1479 | | - | |
1480 | | - | |
1481 | | - | |
1482 | | - | |
1483 | | - | |
1484 | | - | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
1485 | 1515 | | |
1486 | 1516 | | |
1487 | 1517 | | |
| |||
2126 | 2156 | | |
2127 | 2157 | | |
2128 | 2158 | | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
2129 | 2165 | | |
2130 | 2166 | | |
2131 | 2167 | | |
| |||
2418 | 2454 | | |
2419 | 2455 | | |
2420 | 2456 | | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
2421 | 2485 | | |
2422 | 2486 | | |
2423 | 2487 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
| 337 | + | |
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
| |||
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
458 | | - | |
| 458 | + | |
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
487 | | - | |
| 487 | + | |
488 | 488 | | |
489 | 489 | | |
490 | 490 | | |
| |||
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
544 | | - | |
| 544 | + | |
545 | 545 | | |
546 | 546 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
958 | 958 | | |
959 | 959 | | |
960 | 960 | | |
961 | | - | |
| 961 | + | |
962 | 962 | | |
963 | 963 | | |
964 | 964 | | |
965 | | - | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
972 | | - | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
| 965 | + | |
978 | 966 | | |
979 | 967 | | |
980 | 968 | | |
| |||
1122 | 1110 | | |
1123 | 1111 | | |
1124 | 1112 | | |
1125 | | - | |
1126 | 1113 | | |
1127 | 1114 | | |
1128 | | - | |
| 1115 | + | |
1129 | 1116 | | |
1130 | 1117 | | |
1131 | 1118 | | |
| |||
1298 | 1285 | | |
1299 | 1286 | | |
1300 | 1287 | | |
1301 | | - | |
| 1288 | + | |
1302 | 1289 | | |
1303 | 1290 | | |
1304 | 1291 | | |
| |||
1372 | 1359 | | |
1373 | 1360 | | |
1374 | 1361 | | |
1375 | | - | |
| 1362 | + | |
1376 | 1363 | | |
1377 | 1364 | | |
1378 | 1365 | | |
| |||
1594 | 1581 | | |
1595 | 1582 | | |
1596 | 1583 | | |
1597 | | - | |
| 1584 | + | |
1598 | 1585 | | |
1599 | 1586 | | |
1600 | 1587 | | |
| |||
1873 | 1860 | | |
1874 | 1861 | | |
1875 | 1862 | | |
1876 | | - | |
| 1863 | + | |
1877 | 1864 | | |
1878 | 1865 | | |
1879 | 1866 | | |
| |||
2663 | 2650 | | |
2664 | 2651 | | |
2665 | 2652 | | |
2666 | | - | |
2667 | | - | |
2668 | | - | |
2669 | | - | |
2670 | | - | |
| 2653 | + | |
| 2654 | + | |
| 2655 | + | |
| 2656 | + | |
| 2657 | + | |
| 2658 | + | |
2671 | 2659 | | |
2672 | 2660 | | |
2673 | 2661 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
| |||
914 | 916 | | |
915 | 917 | | |
916 | 918 | | |
917 | | - | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
918 | 922 | | |
919 | 923 | | |
920 | 924 | | |
| |||
928 | 932 | | |
929 | 933 | | |
930 | 934 | | |
931 | | - | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
932 | 938 | | |
933 | 939 | | |
934 | 940 | | |
| |||
1050 | 1056 | | |
1051 | 1057 | | |
1052 | 1058 | | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
1053 | 1063 | | |
1054 | 1064 | | |
1055 | 1065 | | |
| |||
1068 | 1078 | | |
1069 | 1079 | | |
1070 | 1080 | | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
0 commit comments