Commit 48aa75d
committed
[Isolated conformances] Cache resolved global actor for conformances
In the prior implementation of runtime resolution of isolated conformances,
the runtime had to look in both the protocol conformance descriptor and
in all conditional conformance requirements (recursively) to find any
isolated conformances. If it found one, it had to demangle the global
actor type to metadata. Since swift_conformsToProtocol is a hot path through
the runtime, we can't afford this non-constant-time work in the common
case.
Instead, cache the resolved global actor and witness table as part of the
conformance cache, so that we have access to this information every time
we look up a witness table for a conformance. Propagate this up through
various callers (e.g., generic requirement checking) to the point where
we either stash it in the cache or check it at runtime. This gets us down
to a very quick check (basically, NULL-or-not) for nonisolated conformances,
and just one check for isolated conformances.1 parent 6dd141a commit 48aa75d
File tree
8 files changed
+346
-272
lines changed- include/swift
- ABI
- Runtime
- stdlib/public
- CompatibilityOverride
- runtime
8 files changed
+346
-272
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2884 | 2884 | | |
2885 | 2885 | | |
2886 | 2886 | | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
2887 | 2893 | | |
2888 | | - | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
2889 | 2897 | | |
2890 | 2898 | | |
2891 | 2899 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
263 | 275 | | |
264 | 276 | | |
265 | 277 | | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
196 | 206 | | |
197 | 207 | | |
198 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
536 | 539 | | |
537 | 540 | | |
538 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
539 | 544 | | |
540 | 545 | | |
541 | 546 | | |
| |||
624 | 629 | | |
625 | 630 | | |
626 | 631 | | |
627 | | - | |
| 632 | + | |
| 633 | + | |
628 | 634 | | |
629 | 635 | | |
630 | 636 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1384 | 1384 | | |
1385 | 1385 | | |
1386 | 1386 | | |
1387 | | - | |
| 1387 | + | |
| 1388 | + | |
1388 | 1389 | | |
1389 | 1390 | | |
1390 | 1391 | | |
| |||
1879 | 1880 | | |
1880 | 1881 | | |
1881 | 1882 | | |
1882 | | - | |
| 1883 | + | |
| 1884 | + | |
1883 | 1885 | | |
1884 | 1886 | | |
1885 | 1887 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1602 | 1602 | | |
1603 | 1603 | | |
1604 | 1604 | | |
1605 | | - | |
| 1605 | + | |
| 1606 | + | |
1606 | 1607 | | |
1607 | 1608 | | |
1608 | 1609 | | |
| |||
2043 | 2044 | | |
2044 | 2045 | | |
2045 | 2046 | | |
2046 | | - | |
| 2047 | + | |
| 2048 | + | |
2047 | 2049 | | |
2048 | 2050 | | |
2049 | 2051 | | |
| |||
3056 | 3058 | | |
3057 | 3059 | | |
3058 | 3060 | | |
3059 | | - | |
| 3061 | + | |
| 3062 | + | |
3060 | 3063 | | |
3061 | 3064 | | |
3062 | 3065 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
570 | 574 | | |
571 | 575 | | |
572 | 576 | | |
573 | 577 | | |
574 | 578 | | |
575 | 579 | | |
576 | 580 | | |
577 | | - | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
578 | 584 | | |
579 | 585 | | |
580 | 586 | | |
| |||
686 | 692 | | |
687 | 693 | | |
688 | 694 | | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
693 | 708 | | |
694 | 709 | | |
695 | 710 | | |
| |||
0 commit comments