mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
DebugInfo: Use DWP cu_index to speed up symbolizing (as intended)
I was a bit lazy when I first implemented this & skipped the index lookup - obviously for large files this becomes pretty crucial, so here we go, do the index lookup. Speeds up large DWP symbolizing by... lots. (20m -> 20s, actually, maybe more in a release build (that was a release build without index lookup, compared to a debug/non-release build with the index usage)) llvm-svn: 309507
This commit is contained in:
parent
e25091904d
commit
6daf05c4c7
@ -83,9 +83,12 @@ public:
|
||||
DWARFUnitIndex(DWARFSectionKind InfoColumnKind)
|
||||
: InfoColumnKind(InfoColumnKind) {}
|
||||
|
||||
explicit operator bool() const { return Header.NumBuckets; }
|
||||
|
||||
bool parse(DataExtractor IndexData);
|
||||
void dump(raw_ostream &OS) const;
|
||||
const Entry *getFromOffset(uint32_t Offset) const;
|
||||
const Entry *getFromHash(uint64_t Offset) const;
|
||||
|
||||
ArrayRef<DWARFSectionKind> getColumnKinds() const {
|
||||
return makeArrayRef(ColumnKinds.get(), Header.NumColumns);
|
||||
|
@ -400,8 +400,17 @@ void DWARFContext::dump(raw_ostream &OS, DIDumpOptions DumpOpts) {
|
||||
}
|
||||
|
||||
DWARFCompileUnit *DWARFContext::getDWOCompileUnitForHash(uint64_t Hash) {
|
||||
// FIXME: Improve this for the case where this DWO file is really a DWP file
|
||||
// with an index - use the index for lookup instead of a linear search.
|
||||
if (const auto &CUI = getCUIndex()) {
|
||||
if (const auto *R = CUI.getFromHash(Hash))
|
||||
if (auto CUOff = R->getOffset(DW_SECT_INFO))
|
||||
return CUs.getUnitForOffset(CUOff->Offset);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// If there's no index, just search through the CUs in the DWO - there's
|
||||
// probably only one unless this is something like LTO - though an in-process
|
||||
// built/cached lookup table could be used in that case to improve repeated
|
||||
// lookups of different CUs in the DWO.
|
||||
for (const auto &DWOCU : dwo_compile_units())
|
||||
if (DWOCU->getDWOId() == Hash)
|
||||
return DWOCU.get();
|
||||
|
@ -123,7 +123,7 @@ StringRef DWARFUnitIndex::getColumnHeader(DWARFSectionKind DS) {
|
||||
}
|
||||
|
||||
void DWARFUnitIndex::dump(raw_ostream &OS) const {
|
||||
if (!Header.NumBuckets)
|
||||
if (!*this)
|
||||
return;
|
||||
|
||||
Header.dump(OS);
|
||||
@ -170,3 +170,17 @@ DWARFUnitIndex::getFromOffset(uint32_t Offset) const {
|
||||
return &Rows[i];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const DWARFUnitIndex::Entry *DWARFUnitIndex::getFromHash(uint64_t S) const {
|
||||
uint64_t Mask = Header.NumBuckets - 1;
|
||||
|
||||
auto H = S & Mask;
|
||||
auto HP = ((S >> 32) & Mask) | 1;
|
||||
while (Rows[H].getSignature() != S && Rows[H].getSignature() != 0)
|
||||
H = (H + HP) & Mask;
|
||||
|
||||
if (Rows[H].getSignature() != S)
|
||||
return nullptr;
|
||||
|
||||
return &Rows[H];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user