SIL Linker: Don't link vtables in LinkNormal mode

Mandatory inlining performs devirtualization, which is able
to deserialize vtables on its own. And since class methods
cannot be @_transparent, we don't have to deserialize any
vtable entries unless we're in LinkAll mode, which indicates
we're running the performance pipeline.
This commit is contained in:
Slava Pestov
2018-04-11 19:10:28 -07:00
parent 755e98dbe5
commit f73699b7a9
3 changed files with 48 additions and 43 deletions

View File

@@ -344,6 +344,9 @@ bool SILLinkerVisitor::visitInitExistentialRefInst(
}
bool SILLinkerVisitor::visitAllocRefInst(AllocRefInst *ARI) {
if (!isLinkAll())
return false;
// Grab the class decl from the alloc ref inst.
ClassDecl *D = ARI->getType().getClassOrBoundGenericClass();
if (!D)
@@ -353,6 +356,9 @@ bool SILLinkerVisitor::visitAllocRefInst(AllocRefInst *ARI) {
}
bool SILLinkerVisitor::visitMetatypeInst(MetatypeInst *MI) {
if (!isLinkAll())
return false;
CanType instTy = MI->getType().castTo<MetatypeType>().getInstanceType();
ClassDecl *C = instTy.getClassOrBoundGenericClass();
if (!C)