[PATCH] D157459: Make DWARFContext more thread safe.

Alex Langford via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 15 10:53:15 PDT 2023


bulbazord added a comment.

I think I'm somewhat on the same page as David here. The big concern I have is that although this probably works today, it's not very resilient or future-proof. It's difficult to guarantee future contributors or future reviewers will know or remember to guard member variable mutations with the mutex. I won't block this patch because I know the work to refactor the abstraction to be concurrency-safe is non-trivial, but I am concerned about the long term implications.



================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp:1070-1094
 const DWARFDebugNames &DWARFContext::getDebugNames() {
   return getAccelTable(Names, *DObj, DObj->getNamesSection(),
                        DObj->getStrSection(), isLittleEndian());
 }
 
 const AppleAcceleratorTable &DWARFContext::getAppleNames() {
   return getAccelTable(AppleNames, *DObj, DObj->getAppleNamesSection(),
----------------
I think either all of these getters either need to be protected or `getAccelTable` needs to be protected. They can all mutate these member variables.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157459



More information about the llvm-commits mailing list