[llvm] r254651 - [RuntimeDyld] DenseMap -> std::unordered_map
Keno Fischer via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 3 13:27:59 PST 2015
Author: kfischer
Date: Thu Dec 3 15:27:59 2015
New Revision: 254651
URL: http://llvm.org/viewvc/llvm-project?rev=254651&view=rev
Log:
[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
Modified:
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=254651&r1=254650&r2=254651&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Thu Dec 3 15:27:59 2015
@@ -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();
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h?rev=254651&r1=254650&r2=254651&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h Thu Dec 3 15:27:59 2015
@@ -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
More information about the llvm-commits
mailing list