Skip to content

Commit 54e608a

Browse files
committed
SIL Linker: Remove processClassDecl()
This was completely dead code. Note that it was adding vtable entries to the wrong worklist -- any functions on 'Worklist' are not deserialized, only the functions *they reference* are deserialized. So adding an external declaration to 'Worklist' accomplishes nothing.
1 parent f73699b commit 54e608a

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

lib/SIL/Linker.cpp

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,34 +58,7 @@ bool SILLinkerVisitor::processFunction(SILFunction *F) {
5858
return true;
5959
}
6060

61-
/// Deserialize the VTable mapped to C if it exists and all SIL the VTable
62-
/// transitively references.
63-
///
64-
/// This method assumes that the caller made sure that no vtable existed in
65-
/// Mod.
66-
SILVTable *SILLinkerVisitor::processClassDecl(const ClassDecl *C) {
67-
// If we are not linking anything, bail.
68-
if (Mode == LinkingMode::LinkNone)
69-
return nullptr;
70-
71-
// Attempt to load the VTable from the SerializedSILLoader. If we
72-
// fail... bail...
73-
SILVTable *Vtbl = Loader->lookupVTable(C);
74-
if (!Vtbl)
75-
return nullptr;
76-
77-
// Otherwise, add all the vtable functions in Vtbl to the function
78-
// processing list...
79-
for (auto &E : Vtbl->getEntries())
80-
Worklist.push_back(E.Implementation);
81-
82-
// And then transitively deserialize all SIL referenced by those functions.
83-
process();
84-
85-
// Return the deserialized Vtbl.
86-
return Vtbl;
87-
}
88-
61+
/// Deserialize the given VTable all SIL the VTable transitively references.
8962
bool SILLinkerVisitor::linkInVTable(ClassDecl *D) {
9063
// Attempt to lookup the Vtbl from the SILModule.
9164
SILVTable *Vtbl = Mod.lookUpVTable(D);

lib/SIL/SILModule.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,7 @@ SILVTable *SILModule::lookUpVTable(const ClassDecl *C) {
614614
return R->second;
615615

616616
// If that fails, try to deserialize it. If that fails, return nullptr.
617-
SILVTable *Vtbl =
618-
SILLinkerVisitor(*this, getSILLoader(), SILModule::LinkingMode::LinkAll)
619-
.processClassDecl(C);
617+
SILVTable *Vtbl = getSILLoader()->lookupVTable(C);
620618
if (!Vtbl)
621619
return nullptr;
622620

0 commit comments

Comments
 (0)