mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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.
60 KiB
60 KiB