[PATCH] D143793: Add the ability to segment GSYM files.

jeffrey tan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 10:59:18 PST 2023


yinghuitan accepted this revision.
yinghuitan added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/lib/DebugInfo/GSYM/GsymCreator.cpp:503-505
+  std::lock_guard<std::mutex> Guard(Mutex);
+  Funcs.push_back(DstFI);
+  return Funcs.back().cacheEncoding();
----------------
clayborg wrote:
> yinghuitan wrote:
> > Is the lock only needed during accessing `Funcs` field? Maybe scope locking it instead of locking the entire function.
> This is correctly scoped right at the end of the function to only lock during Funcs modification and using the Funcs.back().
My original worry is compiler can hoist `Guard` to the beginning of the function causing the function scope locking. Now thinking about this, compiler shouldn't be doing that because it will have the side effect of changing the locking semantics. Still, I think it would be more explicit to add these into a sub-scope. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143793



More information about the llvm-commits mailing list