diff options
author | Keno Fischer <kfischer@college.harvard.edu> | 2015-12-03 21:27:59 +0000 |
---|---|---|
committer | Keno Fischer <kfischer@college.harvard.edu> | 2015-12-03 21:27:59 +0000 |
commit | eb59d468d9af54bf096a985b42ee583f088aa0c6 (patch) | |
tree | bd445a2b9dbe56c7a90c0ea1bed77b68d5408031 /llvm/lib/ExecutionEngine/RuntimeDyld | |
parent | 5e8701c356a25b18715f0f25ed4521cdc8a05b15 (diff) | |
download | bcm5719-llvm-eb59d468d9af54bf096a985b42ee583f088aa0c6.tar.gz bcm5719-llvm-eb59d468d9af54bf096a985b42ee583f088aa0c6.zip |
[RuntimeDyld] DenseMap -> std::unordered_map
DenseMap is most applicable when both keys and values are small.
In this case, the value violates that assumption, causing quite
significant memory overhead. A std::unordered_map is more appropriate
in this case (or at least fixed the memory problems I was seeing).
Differential Revision: http://reviews.llvm.org/D14910
llvm-svn: 254651
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld')
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index dd02ece3a9f..a95f3bbe417 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -97,11 +97,11 @@ void RuntimeDyldImpl::resolveRelocations() { // The Section here (Sections[i]) refers to the section in which the // symbol for the relocation is located. The SectionID in the relocation // entry provides the section to which the relocation will be applied. - int Idx = it->getFirst(); + int Idx = it->first; uint64_t Addr = Sections[Idx].getLoadAddress(); DEBUG(dbgs() << "Resolving relocations Section #" << Idx << "\t" << format("%p", (uintptr_t)Addr) << "\n"); - resolveRelocationList(it->getSecond(), Addr); + resolveRelocationList(it->second, Addr); } Relocations.clear(); diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h index 914efd24660..dafd3c8793c 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h @@ -30,6 +30,7 @@ #include "llvm/Support/SwapByteOrder.h" #include "llvm/Support/raw_ostream.h" #include <map> +#include <unordered_map> #include <system_error> using namespace llvm; @@ -264,7 +265,7 @@ protected: // Relocations to sections already loaded. Indexed by SectionID which is the // source of the address. The target where the address will be written is // SectionID/Offset in the relocation itself. - DenseMap<unsigned, RelocationList> Relocations; + std::unordered_map<unsigned, RelocationList> Relocations; // Relocations to external symbols that are not yet resolved. Symbols are // external when they aren't found in the global symbol table of all loaded |