Serialization: Preserve identity of opened generic environments

We used to create a new environment for each opened archetype, which is
incorrect when deserializing a nested type of another opened archetype.
This commit is contained in:
Slava Pestov
2022-08-11 23:44:18 -04:00
parent 7a970367fd
commit b36f37cc72
14 changed files with 165 additions and 51 deletions

View File

@@ -219,6 +219,10 @@ class Serializer : public SerializerBase {
index_block::GENERIC_SIGNATURE_OFFSETS>
GenericSignaturesToSerialize;
ASTBlockRecordKeeper<const GenericEnvironment *, GenericEnvironmentID,
index_block::GENERIC_ENVIRONMENT_OFFSETS>
GenericEnvironmentsToSerialize;
ASTBlockRecordKeeper<SubstitutionMap, SubstitutionMapID,
index_block::SUBSTITUTION_MAP_OFFSETS>
SubstitutionMapsToSerialize;
@@ -353,6 +357,9 @@ private:
/// Writes a generic signature.
void writeASTBlockEntity(GenericSignature sig);
/// Writes a generic environment.
void writeASTBlockEntity(const GenericEnvironment *env);
/// Writes a substitution map.
void writeASTBlockEntity(const SubstitutionMap substitutions);
@@ -483,6 +490,9 @@ public:
/// The GenericSignature will be scheduled for serialization if necessary.
GenericSignatureID addGenericSignatureRef(GenericSignature sig);
/// Records the use of the given opened generic environment.
GenericEnvironmentID addGenericEnvironmentRef(GenericEnvironment *env);
/// Records the use of the given substitution map.
///
/// The SubstitutionMap will be scheduled for serialization if necessary.