[deserialization] Change SILLinking to use SILModule for linking instead of performing the linking itself.

This approach will allow us to go back to doing lazy linking if we want
to in the future.

Swift SVN r15498
This commit is contained in:
Michael Gottesman
2014-03-26 08:47:01 +00:00
parent 3d0cf8bbd9
commit 406bc0c19a
4 changed files with 29 additions and 118 deletions

View File

@@ -340,12 +340,14 @@ public:
if (Mode == LinkingMode::LinkNone)
return false;
auto NewFn = Loader->lookupSILFunction(F);
// If F is a declaration, first deserialize it.
auto NewFn = F->isExternalDeclaration() ? Loader->lookupSILFunction(F) : F;
if (!NewFn || NewFn->empty())
return false;
++NumFuncLinked;
// Transitively deserialize everything referenced by NewFn.
Worklist.push_back(NewFn);
while (!Worklist.empty()) {
auto Fn = Worklist.pop_back_val();
@@ -448,3 +450,11 @@ private:
bool SILModule::linkFunction(SILFunction *Fun, SILModule::LinkingMode Mode) {
return SILLinkerVisitor(SILLoader, Mode, ExternalSource).process(Fun);
}
void SILModule::linkAllWitnessTables() {
SILLoader->getAllWitnessTables();
}
void SILModule::linkAllVTables() {
SILLoader->getAllVTables();
}