[PATCH] D76977: [lld-macho] Implement basic export trie

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 28 18:22:53 PDT 2020


int3 marked an inline comment as done.
int3 added inline comments.


================
Comment at: lld/MachO/ExportTrie.cpp:90
+        StringRef bNodeStr = edge.child->cumulativeString;
+        bNodeStr = bNodeStr.drop_back(edgeStr.size() - n).copy(bAlloc);
+        auto *bNode = make<TrieNode>(bNodeStr);
----------------
smeenai wrote:
> int3 wrote:
> > The original implementation used a unique BumpPtrAllocator instance for the export trie construction, which gets deallocated once trie serialization is complete. Here I am using the global `bAlloc` that doesn't deallocate till the end of the program. Not if it's worth using a local allocator instance to reduce memory consumption
> I think LLD generally just allocates everything using the global allocator and deallocates it in one fell swoop at the end (or just lets the OS clean it up), so this should be fine. I'd be curious if anything in LLD COFF or ELF uses local allocators though.
I made that comment on the original build-trie-via-insertion diff, which did a bunch of unnecessary string copying. The current diff just uses StringRefs that point to the character buffers of the symbols themselves and assumes they are immutable while the trie is being built and serialized, so this is no longer an issue.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76977/new/

https://reviews.llvm.org/D76977





More information about the llvm-commits mailing list