Commit e6f3dec
authored
[Custom Descriptors] Fix accidental placeholder use in GTO (#7914)
GTO inserts placeholder describee types by overriding getSortedTypes
and returning a list of types with extra structs added where the
placeholders will go. Previously we used the empty struct to reserve
space in the list for the placeholders, but when the empty struct was a
public type (and therefore did not appear after the placeholders in the
sorted list of rebuilt types), this had the unfortunate effect of
replacing the empty struct with one of the placeholders throughout the
module. This did not happen when the emptry struct was a private type
because then it would appear later in the list of sorted types and its
type-to-index mapping in GlobalTypeRewriter::rebuildTypes would be
updated to map to the non-placeholder index. When the type is public,
this later entry does not exist and the type ends up being mapped to the
placeholder index.
To fix the problem, change how we save space for placeholder describees
in the list of sorted types to ensure the placeholder is represented by
a private type that will appear later in the list of types. This will
ensure that the final mapping of types to indices will always map types
to the index of their "real" appearance rather than the index of a
placeholder type, and will also ensure that public types are never
mapped to anything else. Specifically, we now save space for a described
type using the descriptor type that will eventually describe it.
While refactoring this, also simplify things by placing the placeholder
describee types directly before their descriptor types in the sorted
list. This saves us from having to map from descriptor types to the
index of their placeholders since we can determine the placeholder's
index from its descriptor's index.1 parent 50339e1 commit e6f3dec
3 files changed
Lines changed: 172 additions & 79 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| |||
141 | 140 | | |
142 | 141 | | |
143 | 142 | | |
144 | | - | |
| 143 | + | |
145 | 144 | | |
146 | 145 | | |
147 | 146 | | |
| |||
465 | 464 | | |
466 | 465 | | |
467 | 466 | | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
473 | 470 | | |
474 | 471 | | |
475 | 472 | | |
476 | | - | |
| 473 | + | |
477 | 474 | | |
478 | 475 | | |
479 | 476 | | |
| |||
497 | 494 | | |
498 | 495 | | |
499 | 496 | | |
500 | | - | |
501 | | - | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
502 | 501 | | |
503 | 502 | | |
504 | 503 | | |
505 | | - | |
506 | | - | |
| 504 | + | |
507 | 505 | | |
508 | 506 | | |
509 | 507 | | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
517 | 525 | | |
| 526 | + | |
518 | 527 | | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
| 528 | + | |
| 529 | + | |
525 | 530 | | |
526 | 531 | | |
527 | 532 | | |
| |||
584 | 589 | | |
585 | 590 | | |
586 | 591 | | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
596 | 595 | | |
597 | 596 | | |
598 | 597 | | |
599 | 598 | | |
600 | 599 | | |
601 | | - | |
602 | | - | |
603 | | - | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
604 | 616 | | |
| 617 | + | |
605 | 618 | | |
606 | 619 | | |
607 | 620 | | |
608 | 621 | | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | 622 | | |
615 | 623 | | |
616 | 624 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 106 | + | |
109 | 107 | | |
110 | 108 | | |
111 | 109 | | |
112 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
159 | | - | |
160 | | - | |
| 158 | + | |
161 | 159 | | |
162 | | - | |
163 | | - | |
164 | | - | |
| 160 | + | |
165 | 161 | | |
166 | 162 | | |
167 | 163 | | |
| |||
170 | 166 | | |
171 | 167 | | |
172 | 168 | | |
173 | | - | |
174 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
869 | 869 | | |
870 | 870 | | |
871 | 871 | | |
872 | | - | |
873 | | - | |
874 | | - | |
| 872 | + | |
875 | 873 | | |
876 | | - | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
877 | 877 | | |
878 | 878 | | |
879 | 879 | | |
| |||
950 | 950 | | |
951 | 951 | | |
952 | 952 | | |
953 | | - | |
954 | | - | |
955 | | - | |
956 | | - | |
957 | | - | |
| 953 | + | |
958 | 954 | | |
959 | | - | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
960 | 958 | | |
961 | 959 | | |
962 | 960 | | |
963 | 961 | | |
964 | | - | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
965 | 965 | | |
966 | 966 | | |
967 | 967 | | |
| |||
1079 | 1079 | | |
1080 | 1080 | | |
1081 | 1081 | | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
| 1082 | + | |
1085 | 1083 | | |
1086 | | - | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
1087 | 1087 | | |
1088 | 1088 | | |
1089 | 1089 | | |
| |||
1116 | 1116 | | |
1117 | 1117 | | |
1118 | 1118 | | |
1119 | | - | |
1120 | | - | |
1121 | | - | |
| 1119 | + | |
1122 | 1120 | | |
1123 | | - | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
1124 | 1124 | | |
1125 | 1125 | | |
1126 | 1126 | | |
| |||
1176 | 1176 | | |
1177 | 1177 | | |
1178 | 1178 | | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
1179 | 1257 | | |
1180 | 1258 | | |
1181 | 1259 | | |
1182 | | - | |
1183 | | - | |
| 1260 | + | |
| 1261 | + | |
1184 | 1262 | | |
1185 | 1263 | | |
1186 | 1264 | | |
1187 | 1265 | | |
1188 | | - | |
1189 | | - | |
1190 | | - | |
1191 | | - | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
1192 | 1275 | | |
1193 | 1276 | | |
| 1277 | + | |
1194 | 1278 | | |
1195 | 1279 | | |
| 1280 | + | |
1196 | 1281 | | |
1197 | 1282 | | |
1198 | 1283 | | |
| |||
0 commit comments