Skip to content

Commit 967fa38

Browse files
author
Kevin Frei
committed
Updated from code review feedback
1 parent a70ad4a commit 967fa38

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ class DWARFUnit {
258258

259259
std::shared_ptr<DWARFUnit> DWO;
260260

261-
mutable llvm::sys::RWMutex m_cu_die_array_mutex;
262-
mutable llvm::sys::RWMutex m_all_die_array_mutex;
261+
mutable llvm::sys::RWMutex CUDieArrayMutex;
262+
mutable llvm::sys::RWMutex AllDieArrayMutex;
263263

264264
protected:
265265
friend dwarf_linker::parallel::CompileUnit;

llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -497,35 +497,34 @@ void DWARFUnit::extractDIEsIfNeeded(bool CUDieOnly) {
497497

498498
Error DWARFUnit::tryExtractDIEsIfNeeded(bool CUDieOnly) {
499499
{
500-
llvm::sys::ScopedReader Lock(m_cu_die_array_mutex);
500+
llvm::sys::ScopedReader Lock(CUDieArrayMutex);
501501
if ((CUDieOnly && !DieArray.empty()) || DieArray.size() > 1)
502502
return Error::success(); // Already parsed.
503503
}
504504
bool HasCUDie = false;
505505
{
506-
llvm::sys::ScopedWriter Lock(m_cu_die_array_mutex);
506+
llvm::sys::ScopedWriter Lock(CUDieArrayMutex);
507507
if ((CUDieOnly && !DieArray.empty()) || DieArray.size() > 1)
508508
return Error::success(); // Already parsed.
509509
HasCUDie = !DieArray.empty();
510510
extractDIEsToVector(!HasCUDie, !CUDieOnly, DieArray);
511511
}
512512
{
513-
llvm::sys::ScopedReader Lock(m_all_die_array_mutex);
513+
llvm::sys::ScopedReader Lock(AllDieArrayMutex);
514514
if (DieArray.empty())
515515
return Error::success();
516516

517-
// If CU DIE was just parsed, copy several attribute values from it.
518517
if (HasCUDie)
519518
return Error::success();
520519
}
521-
llvm::sys::ScopedWriter Lock(m_all_die_array_mutex);
520+
llvm::sys::ScopedWriter Lock(AllDieArrayMutex);
522521
if (DieArray.empty())
523522
return Error::success();
524523

525-
// If CU DIE was just parsed, copy several attribute values from it.
526524
if (HasCUDie)
527525
return Error::success();
528526

527+
// If CU DIE was just parsed, copy several attribute values from it.
529528
DWARFDie UnitDie(this, &DieArray[0]);
530529
if (std::optional<uint64_t> DWOId =
531530
toUnsigned(UnitDie.find(DW_AT_GNU_dwo_id)))
@@ -674,8 +673,8 @@ void DWARFUnit::clearDIEs(bool KeepCUDie) {
674673
// It depends on the implementation whether the request is fulfilled.
675674
// Create a new vector with a small capacity and assign it to the DieArray to
676675
// have previous contents freed.
677-
llvm::sys::ScopedWriter CULock(m_cu_die_array_mutex);
678-
llvm::sys::ScopedWriter AllLock(m_all_die_array_mutex);
676+
llvm::sys::ScopedWriter CULock(CUDieArrayMutex);
677+
llvm::sys::ScopedWriter AllLock(AllDieArrayMutex);
679678
DieArray = (KeepCUDie && !DieArray.empty())
680679
? std::vector<DWARFDebugInfoEntry>({DieArray[0]})
681680
: std::vector<DWARFDebugInfoEntry>();

llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ Error DwarfTransformer::convert(uint32_t NumThreads, OutputAggregator &Out) {
591591
DICtx.clearLineTableForUnit(CU.get());
592592
// Free any DIEs that were allocated by the DWARF parser.
593593
// If/when they're needed by other CU's, they'll be recreated.
594-
CU->clearDIEs(false);
594+
CU->clearDIEs(/*KeepCUDie=*/false);
595595
}
596596
} else {
597597
// LLVM Dwarf parser is not thread-safe and we need to parse all DWARF up
@@ -626,7 +626,7 @@ Error DwarfTransformer::convert(uint32_t NumThreads, OutputAggregator &Out) {
626626
DICtx.clearLineTableForUnit(CU.get());
627627
// Free any DIEs that were allocated by the DWARF parser.
628628
// If/when they're needed by other CU's, they'll be recreated.
629-
CU->clearDIEs(false);
629+
CU->clearDIEs(/*KeepCUDie=*/false);
630630
// Print ThreadLogStorage lines into an actual stream under a lock
631631
std::lock_guard<std::mutex> guard(LogMutex);
632632
if (Out.GetOS()) {
@@ -641,7 +641,7 @@ Error DwarfTransformer::convert(uint32_t NumThreads, OutputAggregator &Out) {
641641
}
642642
// Now get rid of all the DIEs that may have been recreated
643643
for (const auto &CU : DICtx.compile_units())
644-
CU->clearDIEs(false);
644+
CU->clearDIEs(/*KeepCUDie=*/false);
645645
size_t FunctionsAddedCount = Gsym.getNumFunctionInfos() - NumBefore;
646646
Out << "Loaded " << FunctionsAddedCount << " functions from DWARF.\n";
647647
return Error::success();

0 commit comments

Comments
 (0)