IRGen: Emit default witness tables in protocol metadata

IRGen now uses a ConstantBuilder to build protocol metadata, which may
now have additional fields at the end for default witnesses.

For now, the default implementations in the test have to external
because IRGen cannot emit a witness_method body where Self is
abstract. I will fix this by passing in the witness table as part
of the witness_method calling convention.

On the IRGen side, other than the calling convention change, the only
remaining piece here is emitting GenericWitnessTables and accessor
functions for conformances where the conformance is defined in
a different module than the protocol, and the protocol is resilient.

Sema still needs to infer default witnesses and store them in the
ProtocolDecl, so that SILGen can emit default witness thunks for
them.
This commit is contained in:
Slava Pestov
2016-02-05 18:27:53 -08:00
parent 6a254042ee
commit e0e2d9bf24
7 changed files with 153 additions and 49 deletions

View File

@@ -196,7 +196,9 @@ IRGenModule::IRGenModule(IRGenModuleDispatcher &dispatcher, SourceFile *SF,
Int8PtrTy, // optional objc class methods
Int8PtrTy, // objc properties
Int32Ty, // size
Int32Ty // flags
Int32Ty, // flags
Int16Ty, // minimum witness count
Int16Ty // default witness count
});
ProtocolDescriptorPtrTy = ProtocolDescriptorStructTy->getPointerTo();