[PATCH] D54968: [ELF] --gdb-index: use const char *, uint32_t to replace CachedHashStringRef
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 27 12:51:10 PST 2018
MaskRay created this revision.
MaskRay added a reviewer: ruiu.
Herald added subscribers: llvm-commits, arphaman, arichardson, emaste.
Herald added a reviewer: espindola.
This decreases the size of NameAttrEntry from 20 bytes to 16 bytes on 64-bit platforms.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D54968
Files:
ELF/SyntheticSections.cpp
ELF/SyntheticSections.h
Index: ELF/SyntheticSections.h
===================================================================
--- ELF/SyntheticSections.h
+++ ELF/SyntheticSections.h
@@ -684,7 +684,8 @@
};
struct NameAttrEntry {
- llvm::CachedHashStringRef Name;
+ const char *Name;
+ uint32_t NameHash;
uint32_t CuIndexAndAttrs;
};
Index: ELF/SyntheticSections.cpp
===================================================================
--- ELF/SyntheticSections.cpp
+++ ELF/SyntheticSections.cpp
@@ -2433,7 +2433,7 @@
while (I < CUs.size() && CUs[I].CuOffset < Set.Offset)
++I;
for (const DWARFDebugPubTable::Entry &Ent : Set.Entries)
- Ret.push_back({{Ent.Name, computeGdbHash(Ent.Name)},
+ Ret.push_back({Ent.Name.data(), computeGdbHash(Ent.Name),
(Ent.Descriptor.toBits() << 24) | I});
}
}
@@ -2475,19 +2475,20 @@
uint32_t I = 0;
for (ArrayRef<NameAttrEntry> Entries : NameAttrs) {
for (const NameAttrEntry &Ent : Entries) {
- size_t ShardId = Ent.Name.hash() >> Shift;
+ size_t ShardId = Ent.NameHash >> Shift;
if ((ShardId & (Concurrency - 1)) != ThreadId)
continue;
+ CachedHashStringRef Name(Ent.Name, Ent.NameHash);
uint32_t V = Ent.CuIndexAndAttrs + CuIdxs[I];
- size_t &Idx = Map[ShardId][Ent.Name];
+ size_t &Idx = Map[ShardId][Name];
if (Idx) {
Symbols[ShardId][Idx - 1].CuVector.push_back(V);
continue;
}
Idx = Symbols[ShardId].size() + 1;
- Symbols[ShardId].push_back({Ent.Name, {V}, 0, 0});
+ Symbols[ShardId].push_back({Name, {V}, 0, 0});
}
++I;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54968.175560.patch
Type: text/x-patch
Size: 1697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181127/453834b0/attachment.bin>
More information about the llvm-commits
mailing list