[PATCH] D14910: [RuntimeDyld] DenseMap -> std::map

Keno Fischer via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 22 13:28:45 PST 2015


loladiro created this revision.
loladiro added a reviewer: lhames.
loladiro added a subscriber: llvm-commits.
loladiro set the repository for this revision to rL LLVM.

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::map is more appropriate in this case (or at least fixed the memory problems I was seeing).

Repository:
  rL LLVM

http://reviews.llvm.org/D14910

Files:
  lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
  lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h

Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
===================================================================
--- lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
+++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
@@ -226,7 +226,7 @@
   // 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::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
Index: lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
===================================================================
--- lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -96,11 +96,11 @@
     // 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].LoadAddress;
     DEBUG(dbgs() << "Resolving relocations Section #" << Idx << "\t"
                  << format("%p", (uintptr_t)Addr) << "\n");
-    resolveRelocationList(it->getSecond(), Addr);
+    resolveRelocationList(it->second, Addr);
   }
   Relocations.clear();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14910.40888.patch
Type: text/x-patch
Size: 1560 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151122/cadc00df/attachment.bin>


More information about the llvm-commits mailing list