mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] (De-)serialize witnesses completely.
The witnesses in a NormalProtocolConformance have never been completely serialized, because their substitutions involved a weird mix of archetypes that blew up the deserialization code. So, only the witness declarations themselves got serialized. Many clients (the type checker, SourceKit, etc.) didn't need the extra information, but some clients (e.g., the SIL optimizers) would end up recomputing this information. Ick. Now, serialize the complete Witness structure along with the AST, including information about the synthetic environment, complete substitutions, etc. This should obsolete some redundant code paths in the SIL optimization infrastructure. This (de-)serialization code takes a new-ish approach to serializing the synthetic environment in that it avoids serializing any archetypes. Rather, it maps everything back to interface types during serialization, and deserialization forms a new generic environment (with new archetypes!) on-the-fly, mapping deserialized types back into that environment (and to those archetypes). This way, we don't have to maintain identity of archetypes in the deserialization code, and might get some better re-use of the archetypes. More of rdar://problem/24079818.
This commit is contained in:
@@ -710,10 +710,14 @@ public:
|
||||
/// Reads a substitution record from \c DeclTypeCursor.
|
||||
///
|
||||
/// If the record at the cursor is not a substitution, returns None.
|
||||
Optional<Substitution> maybeReadSubstitution(llvm::BitstreamCursor &Cursor);
|
||||
Optional<Substitution> maybeReadSubstitution(llvm::BitstreamCursor &Cursor,
|
||||
GenericEnvironment *genericEnv =
|
||||
nullptr);
|
||||
|
||||
/// Recursively reads a protocol conformance from the given cursor.
|
||||
ProtocolConformanceRef readConformance(llvm::BitstreamCursor &Cursor);
|
||||
ProtocolConformanceRef readConformance(llvm::BitstreamCursor &Cursor,
|
||||
GenericEnvironment *genericEnv =
|
||||
nullptr);
|
||||
|
||||
/// Read the given normal conformance from the current module file.
|
||||
NormalProtocolConformance *
|
||||
|
||||
Reference in New Issue
Block a user