[llvm] Reduce llvm-gsymutil memory usage (PR #91023)
Kevin Frei via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 7 13:53:17 PDT 2024
================
@@ -658,6 +711,9 @@ void DWARFUnit::clearDIEs(bool KeepCUDie) {
// It depends on the implementation whether the request is fulfilled.
// Create a new vector with a small capacity and assign it to the DieArray to
// have previous contents freed.
+ llvm::sys::ScopedWriter FreeLock(CUDieFreeMutex);
+ llvm::sys::ScopedWriter CULock(CUDieArrayMutex);
+ llvm::sys::ScopedWriter AllLock(AllDieArrayMutex);
----------------
kevinfrei wrote:
I can't remove the other two locks. They have to stay, as the freeing mechanism requires it. The third lock (Free) is specifically to deal with the issue that @ayermolo pointed out a couple revisions ago. (Freeing could free just the CU DIE while the non-CU DIE stuff was being initialized, resulting in an invalid state of no CU DIE, but non-CU DIE's are parsed). The entire process is kind of a mess, but I need a "CU DIE initialization" RWLock, plus the "Non-CU DIE initialization" lock as two separate entities, as initializing the non-CU DIE's can trigger recursion (you have to be able to grab the reader lock of the CU DIE init to tell that it's already been initialized, then bail)
https://github.com/llvm/llvm-project/pull/91023
More information about the llvm-commits
mailing list