[PATCH] D120377: [lld-macho] Implement -why_live (without perf overhead)

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 23 12:21:15 PST 2022


oontvoo added inline comments.


================
Comment at: lld/MachO/MarkLive.cpp:111
+    if (!symbols.empty())
+      lld::errs() << std::string(indent, ' ') << toString(*symbols.front())
+                  << " from " << toString(symbols.front()->getFile()) << "\n";
----------------
thakis wrote:
> int3 wrote:
> > thakis wrote:
> > > can you add a comment on why this doesn't use message()?
> > oh yeah... I was thinking about how we would handle parallelization in the future, and I realized that `message()` wasn't ideal here because it would take one lock per call, whereas we want to take one lock for the whole of `printWhyLiveImpl` so that the lines wouldn't get interleaved with other concurrent messages. I'll add that comment.
> Oh, good point. But maybe it's nicer to accumulate the message in a string and only call message() once at the end? Then we need to hold the lock for a shorter time.
> 
> (Are our bumpptr allocators in a per-thread tls?)

> (Are our bumpptr allocators in a per-thread tls?)

No - the allocators are shared (and very much not thread-safe :\ )


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120377



More information about the llvm-commits mailing list