[Serialize] Serialize uniqued generic signatures.

Rather than inlining generic signatures in a half dozen places throughout
the serialization format, serialize (uniqued) generic signatures with their
own GenericSignatureID. Update various layouts (generic function types,
SIL function types, generic environments, extension cross-references) to
use GenericSignatureID.

Shaves ~187k off the size of Swift.swiftmodule.
This commit is contained in:
Doug Gregor
2017-11-07 12:48:31 -08:00
parent 21982306b8
commit 82e1c98e46
7 changed files with 272 additions and 235 deletions

View File

@@ -16,6 +16,7 @@
#include "swift/Subsystems.h"
#include "swift/AST/ASTContext.h"
#include "swift/AST/ASTMangler.h"
#include "swift/AST/GenericSignature.h"
#include "swift/AST/ModuleLoader.h"
#include "swift/AST/NameLookup.h"
#include "swift/AST/USRGeneration.h"
@@ -842,6 +843,10 @@ bool ModuleFile::readIndexBlock(llvm::BitstreamCursor &cursor) {
assert(blobData.empty());
LocalDeclContexts.assign(scratch.begin(), scratch.end());
break;
case index_block::GENERIC_SIGNATURE_OFFSETS:
assert(blobData.empty());
GenericSignatures.assign(scratch.begin(), scratch.end());
break;
case index_block::GENERIC_ENVIRONMENT_OFFSETS:
assert(blobData.empty());
GenericEnvironments.assign(scratch.begin(), scratch.end());