[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
This commit is contained in:
Keno Fischer 2015-12-03 21:27:59 +00:00
parent 5e8701c356
commit eb59d468d9
2 changed files with 4 additions and 3 deletions

View File

@ -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();

View File

@ -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