[PATCH] D157459: Make DWARFContext more thread safe.
Jonas Devlieghere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 15 15:54:14 PDT 2023
JDevlieghere added a comment.
To Adrian's point: what are the guarantees provided by the `DWARFContext`? I'm slightly worried about overhead but care more about providing clear expectations. For example, the `LLVMContext` explicitly provides no locking guarantees [1] and leaves it up to the consumer.
[1] https://llvm.org/doxygen/classllvm_1_1LLVMContext.html#details
================
Comment at: llvm/include/llvm/DebugInfo/DWARF/DWARFContext.h:51
+ // Mutex protecting multi-threaded access to the DWARFContext.
+ std::recursive_mutex Mutex;
std::optional<DenseMap<uint64_t, DWARFTypeUnit *>> NormalTypeUnits;
----------------
Does this have to be a recursive mutex? I was under the impression that they're somewhat frowned upon. I think the CppCoreGuidelines called it something along the lines of working around bad reasoning and adding unnecessary overhead.
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