Reimplement (de-)serialization of protocol conformances.

Primarily, unique normal protocol conformances and reference them via
a conformance ID. This eliminates the use of trailing records for
normal protocol conformances and (more importantly) the cases were we
would write incomplete conformances. The latter could cause problems
if we ever ended up deserializing an incomplete conformance without
also deserializing a complete record for that same conformance.

Secondarily, simplify the way we write conformances. They are now
always trailing records, and we separate out the derived conformance
kinds (specialized/inherited) from either a reference to a normal
conformance in the current module file (via a normal conformance ID)
or via a cross-reference to a conformance in another module file
(currently always a normal conformance, but this need not always be
the case). As part of this, make each conformance record
self-sustaining, so we don't have to push information down to the
reading routines (e.g., the conforming type) to actually produce a
proper conformance. This simplifies deserialization logic further.

Swift SVN r26482
This commit is contained in:
Doug Gregor
2015-03-24 06:48:23 +00:00
parent 683317e607
commit 8b97f911c6
10 changed files with 356 additions and 517 deletions

View File

@@ -520,6 +520,11 @@ bool ModuleFile::readIndexBlock(llvm::BitstreamCursor &cursor) {
assert(blobData.empty());
LocalDeclContexts.assign(scratch.begin(), scratch.end());
break;
case index_block::NORMAL_CONFORMANCE_OFFSETS:
assert(blobData.empty());
NormalConformances.assign(scratch.begin(), scratch.end());
break;
default:
// Unknown index kind, which this version of the compiler won't use.
break;