SILGen: Emit default witness tables for all non-@objc protocols

SILGen will now be able to look up the default implementation
corresponding to a requirement while emitting conformances, and
reference the default witness thunk instead of emitting duplicate
thunks for each conforming type.

IRGen continues to only emit resilient defaults if the protocol itself
is resilient; otherwise, it just ignores the default witness table.
This commit is contained in:
Slava Pestov
2016-03-17 02:04:40 -07:00
parent b13457daaa
commit f440decd23
4 changed files with 24 additions and 11 deletions

View File

@@ -189,12 +189,14 @@ SILModule::lookUpDefaultWitnessTable(const ProtocolDecl *Protocol) {
// protocol descriptor metadata for the protocol.
auto found = DefaultWitnessTableMap.find(Protocol);
if (found == DefaultWitnessTableMap.end()) {
return nullptr;
}
assert(found != DefaultWitnessTableMap.end() &&
"Missing default witness table for protocol");
SILDefaultWitnessTable *wtable = found->second;
return found->second;
// Just return the declaration.
return wtable;
}
SILDefaultWitnessTable *