[PATCH] D59800: Use a class instead of lambda-based callbacks to organize garbage collector.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 15:28:13 PDT 2019


pcc added inline comments.


================
Comment at: lld/ELF/MarkLive.cpp:255
   // Mark all reachable sections.
-  while (!Q.empty())
-    forEachSuccessor<ELFT>(*Q.pop_back_val(), Enqueue);
+  while (!Queue.empty()) {
+    InputSectionBase &Sec = *Queue.pop_back_val();
----------------
This seems fine for now, but with partitioning we'll need to do this multiple times:
https://github.com/pcc/llvm-project/blob/d40cc2e48b560445c4c741cc72a8c6bab47fb2eb/lld/ELF/MarkLive.cpp#L269
https://github.com/pcc/llvm-project/blob/d40cc2e48b560445c4c741cc72a8c6bab47fb2eb/lld/ELF/MarkLive.cpp#L288

Maybe it should be the user of MarkLive who adds GC roots? Then with partitioning the code will end up looking like:
```
for (unsigned I = 1; I != NumPartitions; ++I) {
  MarkLive<ELFT> M(I);
  // enqueue symbols/sections for partition I
  M.mark();
}
```
where `mark()` contains the code in this loop.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59800





More information about the llvm-commits mailing list