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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 22 20:48:32 PST 2015


Any preference of map over unordered_map
On Nov 22, 2015 1:28 PM, "Keno Fischer via llvm-commits" <
llvm-commits at lists.llvm.org> wrote:

> 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();
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151122/c11aae74/attachment.html>


More information about the llvm-commits mailing list