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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 15:36:40 PDT 2019


ruiu marked an inline comment as done.
ruiu 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();
----------------
pcc wrote:
> 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.
Yeah maybe. This change is more like a mechanical translation with some inlining, so I don't know if I should do that now. Do you want me to modify this change?


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