Skip to content

Commit 70714d9

Browse files
authored
Merge pull request #58856 from mikeash/skip-impossible-shared-cache-protocol-conformances-5.7
[5.7][Runtime] Skip shared cache protocol conformance queries we know won't succeed.
2 parents e364e9c + 63564de commit 70714d9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

stdlib/public/runtime/ProtocolConformance.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,19 @@ static _dyld_protocol_conformance_result getDyldSharedCacheConformance(
802802
ConformanceState &C, const ProtocolDescriptor *protocol,
803803
const ClassMetadata *objcClassMetadata,
804804
const ContextDescriptor *description, llvm::StringRef foreignTypeIdentity) {
805+
// Protocols, classes, and descriptions that aren't in the shared cache will
806+
// never be found in the shared cache conformances. Foreign types are
807+
// non-unique so those can still be found in the shared cache regardless of
808+
// where the we got the identity.
809+
if (!C.inSharedCache(protocol) ||
810+
(objcClassMetadata && !C.inSharedCache(objcClassMetadata)) ||
811+
(description && !C.inSharedCache(description))) {
812+
DYLD_CONFORMANCES_LOG("Skipping shared cache lookup, protocol %p, class "
813+
"%p, or description %p is not in shared cache.",
814+
protocol, objcClassMetadata, description);
815+
return {_dyld_protocol_conformance_result_kind_not_found, nullptr};
816+
}
817+
805818
if (!foreignTypeIdentity.empty()) {
806819
DYLD_CONFORMANCES_LOG(
807820
"_dyld_find_foreign_type_protocol_conformance(%p, %.*s, %zu)", protocol,

0 commit comments

Comments
 (0)