mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[deserialization] Add ClassDecl -> VTable map to SILModule.
Swift SVN r15545
This commit is contained in:
@@ -125,6 +125,9 @@ private:
|
||||
llvm::DenseMap<const NormalProtocolConformance *, SILWitnessTable *>
|
||||
WitnessTableLookupCache;
|
||||
|
||||
/// Lookup table for SIL vtables from class decls.
|
||||
llvm::DenseMap<const ClassDecl *, SILVTable *> VTableLookupTable;
|
||||
|
||||
/// This is a cache of intrinsic Function declarations to numeric ID mappings.
|
||||
llvm::DenseMap<Identifier, IntrinsicInfo> IntrinsicIDCache;
|
||||
|
||||
@@ -314,6 +317,9 @@ public:
|
||||
std::pair<SILWitnessTable *, ArrayRef<Substitution>>
|
||||
lookUpWitnessTable(const ProtocolConformance *C);
|
||||
|
||||
/// Look up the VTable mapped to the given ClassDecl. Returns null on failure.
|
||||
SILVTable *lookUpVTable(const ClassDecl *C);
|
||||
|
||||
// Given a protocol conformance, attempt to create a witness table declaration
|
||||
// for it.
|
||||
SILWitnessTable *
|
||||
|
||||
@@ -479,3 +479,11 @@ void SILModule::linkAllWitnessTables() {
|
||||
void SILModule::linkAllVTables() {
|
||||
SILLoader->getAllVTables();
|
||||
}
|
||||
|
||||
SILVTable *SILModule::lookUpVTable(const ClassDecl *C) {
|
||||
auto R = VTableLookupTable.find(C);
|
||||
if (R == VTableLookupTable.end())
|
||||
return nullptr;
|
||||
|
||||
return R->second;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ SILVTable *SILVTable::create(SILModule &M, ClassDecl *Class,
|
||||
alignof(SILVTable));
|
||||
SILVTable *vt = ::new (buf) SILVTable(Class, Entries);
|
||||
M.vtables.push_back(vt);
|
||||
M.VTableLookupTable[Class] = vt;
|
||||
return vt;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user