diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-05-19 05:13:57 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-05-19 05:13:57 +0000 |
commit | bb19a13c0b3fe1ecdc1e46bbf2b06ffc1e25e04e (patch) | |
tree | a4383c7cf16b2a6b8e8aa1ff61435ceec0c6a7de /lldb/source/Symbol | |
parent | fe12d0e3e551a29b880ecfc7673810ce18567765 (diff) | |
download | bcm5719-llvm-bb19a13c0b3fe1ecdc1e46bbf2b06ffc1e25e04e.tar.gz bcm5719-llvm-bb19a13c0b3fe1ecdc1e46bbf2b06ffc1e25e04e.zip |
second pass over removal of Mutex and Condition
llvm-svn: 270024
Diffstat (limited to 'lldb/source/Symbol')
-rw-r--r-- | lldb/source/Symbol/ClangExternalASTSourceCommon.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Symbol/CompactUnwindInfo.cpp | 24 | ||||
-rw-r--r-- | lldb/source/Symbol/DWARFCallFrameInfo.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Symbol/Symtab.cpp | 70 | ||||
-rw-r--r-- | lldb/source/Symbol/TypeSystem.cpp | 15 | ||||
-rw-r--r-- | lldb/source/Symbol/UnwindTable.cpp | 22 |
6 files changed, 65 insertions, 73 deletions
diff --git a/lldb/source/Symbol/ClangExternalASTSourceCommon.cpp b/lldb/source/Symbol/ClangExternalASTSourceCommon.cpp index e3e9a513ecc..77aea1eafc4 100644 --- a/lldb/source/Symbol/ClangExternalASTSourceCommon.cpp +++ b/lldb/source/Symbol/ClangExternalASTSourceCommon.cpp @@ -9,7 +9,6 @@ #include "lldb/Symbol/ClangExternalASTSourceCommon.h" #include "lldb/Core/Stream.h" -#include "lldb/Host/Mutex.h" using namespace lldb_private; diff --git a/lldb/source/Symbol/CompactUnwindInfo.cpp b/lldb/source/Symbol/CompactUnwindInfo.cpp index 233ca91ec8d..564f03872da 100644 --- a/lldb/source/Symbol/CompactUnwindInfo.cpp +++ b/lldb/source/Symbol/CompactUnwindInfo.cpp @@ -130,19 +130,17 @@ namespace lldb_private { // constructor //---------------------- - -CompactUnwindInfo::CompactUnwindInfo(ObjectFile& objfile, SectionSP& section_sp) : - m_objfile (objfile), - m_section_sp (section_sp), - m_section_contents_if_encrypted (), - m_mutex (), - m_indexes (), - m_indexes_computed (eLazyBoolCalculate), - m_unwindinfo_data (), - m_unwindinfo_data_computed (false), - m_unwind_header () +CompactUnwindInfo::CompactUnwindInfo(ObjectFile &objfile, SectionSP §ion_sp) + : m_objfile(objfile), + m_section_sp(section_sp), + m_section_contents_if_encrypted(), + m_mutex(), + m_indexes(), + m_indexes_computed(eLazyBoolCalculate), + m_unwindinfo_data(), + m_unwindinfo_data_computed(false), + m_unwind_header() { - } //---------------------- @@ -223,7 +221,7 @@ CompactUnwindInfo::IsValid (const ProcessSP &process_sp) void CompactUnwindInfo::ScanIndex (const ProcessSP &process_sp) { - Mutex::Locker locker(m_mutex); + std::lock_guard<std::mutex> guard(m_mutex); if (m_indexes_computed == eLazyBoolYes && m_unwindinfo_data_computed) return; diff --git a/lldb/source/Symbol/DWARFCallFrameInfo.cpp b/lldb/source/Symbol/DWARFCallFrameInfo.cpp index e594bd5d258..a3194307323 100644 --- a/lldb/source/Symbol/DWARFCallFrameInfo.cpp +++ b/lldb/source/Symbol/DWARFCallFrameInfo.cpp @@ -308,9 +308,9 @@ DWARFCallFrameInfo::GetFDEIndex () if (m_fde_index_initialized) return; - - Mutex::Locker locker(m_fde_index_mutex); - + + std::lock_guard<std::mutex> guard(m_fde_index_mutex); + if (m_fde_index_initialized) // if two threads hit the locker return; diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 41ab8fefc73..b11b731014d 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -25,16 +25,14 @@ using namespace lldb; using namespace lldb_private; - - -Symtab::Symtab(ObjectFile *objfile) : - m_objfile (objfile), - m_symbols (), - m_file_addr_to_index (), - m_name_to_index (), - m_mutex (Mutex::eMutexTypeRecursive), - m_file_addr_to_index_computed (false), - m_name_indexes_computed (false) +Symtab::Symtab(ObjectFile *objfile) + : m_objfile(objfile), + m_symbols(), + m_file_addr_to_index(), + m_name_to_index(), + m_mutex(), + m_file_addr_to_index_computed(false), + m_name_indexes_computed(false) { } @@ -76,7 +74,7 @@ Symtab::AddSymbol(const Symbol& symbol) size_t Symtab::GetNumSymbols() const { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); return m_symbols.size(); } @@ -90,9 +88,9 @@ Symtab::SectionFileAddressesChanged () void Symtab::Dump (Stream *s, Target *target, SortOrder sort_order) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); -// s->Printf("%.*p: ", (int)sizeof(void*) * 2, this); + // s->Printf("%.*p: ", (int)sizeof(void*) * 2, this); s->Indent(); const FileSpec &file_spec = m_objfile->GetFileSpec(); const char * object_name = nullptr; @@ -171,7 +169,7 @@ Symtab::Dump (Stream *s, Target *target, SortOrder sort_order) void Symtab::Dump(Stream *s, Target *target, std::vector<uint32_t>& indexes) const { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); const size_t num_symbols = GetNumSymbols(); //s->Printf("%.*p: ", (int)sizeof(void*) * 2, this); @@ -224,7 +222,7 @@ CompareSymbolID (const void *key, const void *p) Symbol * Symtab::FindSymbolByID (lldb::user_id_t symbol_uid) const { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); Symbol *symbol = (Symbol*)::bsearch (&symbol_uid, &m_symbols[0], @@ -474,7 +472,7 @@ Symtab::AppendSymbolNamesToMap (const IndexCollection &indexes, if (add_demangled || add_mangled) { Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__); - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); // Create the name index vector to be able to quickly search by name NameToIndexMap::Entry entry; @@ -506,7 +504,7 @@ Symtab::AppendSymbolNamesToMap (const IndexCollection &indexes, uint32_t Symtab::AppendSymbolIndexesWithType (SymbolType symbol_type, std::vector<uint32_t>& indexes, uint32_t start_idx, uint32_t end_index) const { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); uint32_t prev_size = indexes.size(); @@ -524,7 +522,7 @@ Symtab::AppendSymbolIndexesWithType (SymbolType symbol_type, std::vector<uint32_ uint32_t Symtab::AppendSymbolIndexesWithTypeAndFlagsValue (SymbolType symbol_type, uint32_t flags_value, std::vector<uint32_t>& indexes, uint32_t start_idx, uint32_t end_index) const { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); uint32_t prev_size = indexes.size(); @@ -542,7 +540,7 @@ Symtab::AppendSymbolIndexesWithTypeAndFlagsValue (SymbolType symbol_type, uint32 uint32_t Symtab::AppendSymbolIndexesWithType (SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& indexes, uint32_t start_idx, uint32_t end_index) const { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); uint32_t prev_size = indexes.size(); @@ -632,7 +630,7 @@ namespace { void Symtab::SortSymbolIndexesByValue (std::vector<uint32_t>& indexes, bool remove_duplicates) const { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); Timer scoped_timer (__PRETTY_FUNCTION__,__PRETTY_FUNCTION__); // No need to sort if we have zero or one items... @@ -657,7 +655,7 @@ Symtab::SortSymbolIndexesByValue (std::vector<uint32_t>& indexes, bool remove_du uint32_t Symtab::AppendSymbolIndexesWithName (const ConstString& symbol_name, std::vector<uint32_t>& indexes) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__); if (symbol_name) @@ -674,7 +672,7 @@ Symtab::AppendSymbolIndexesWithName (const ConstString& symbol_name, std::vector uint32_t Symtab::AppendSymbolIndexesWithName (const ConstString& symbol_name, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& indexes) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__); if (symbol_name) @@ -700,7 +698,7 @@ Symtab::AppendSymbolIndexesWithName (const ConstString& symbol_name, Debug symbo uint32_t Symtab::AppendSymbolIndexesWithNameAndType (const ConstString& symbol_name, SymbolType symbol_type, std::vector<uint32_t>& indexes) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); if (AppendSymbolIndexesWithName(symbol_name, indexes) > 0) { @@ -719,7 +717,7 @@ Symtab::AppendSymbolIndexesWithNameAndType (const ConstString& symbol_name, Symb uint32_t Symtab::AppendSymbolIndexesWithNameAndType (const ConstString& symbol_name, SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& indexes) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); if (AppendSymbolIndexesWithName(symbol_name, symbol_debug_type, symbol_visibility, indexes) > 0) { @@ -739,7 +737,7 @@ Symtab::AppendSymbolIndexesWithNameAndType (const ConstString& symbol_name, Symb uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType (const RegularExpression ®exp, SymbolType symbol_type, std::vector<uint32_t>& indexes) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); uint32_t prev_size = indexes.size(); uint32_t sym_end = m_symbols.size(); @@ -763,7 +761,7 @@ Symtab::AppendSymbolIndexesMatchingRegExAndType (const RegularExpression ®exp uint32_t Symtab::AppendSymbolIndexesMatchingRegExAndType (const RegularExpression ®exp, SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& indexes) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); uint32_t prev_size = indexes.size(); uint32_t sym_end = m_symbols.size(); @@ -790,7 +788,7 @@ Symtab::AppendSymbolIndexesMatchingRegExAndType (const RegularExpression ®exp Symbol * Symtab::FindSymbolWithType (SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, uint32_t& start_idx) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); const size_t count = m_symbols.size(); for (size_t idx = start_idx; idx < count; ++idx) @@ -810,7 +808,7 @@ Symtab::FindSymbolWithType (SymbolType symbol_type, Debug symbol_debug_type, Vis size_t Symtab::FindAllSymbolsWithNameAndType (const ConstString &name, SymbolType symbol_type, std::vector<uint32_t>& symbol_indexes) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__); // Initialize all of the lookup by name indexes before converting NAME @@ -830,7 +828,7 @@ Symtab::FindAllSymbolsWithNameAndType (const ConstString &name, SymbolType symbo size_t Symtab::FindAllSymbolsWithNameAndType (const ConstString &name, SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& symbol_indexes) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__); // Initialize all of the lookup by name indexes before converting NAME @@ -850,7 +848,7 @@ Symtab::FindAllSymbolsWithNameAndType (const ConstString &name, SymbolType symbo size_t Symtab::FindAllSymbolsMatchingRexExAndType (const RegularExpression ®ex, SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& symbol_indexes) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); AppendSymbolIndexesMatchingRegExAndType(regex, symbol_type, symbol_debug_type, symbol_visibility, symbol_indexes); return symbol_indexes.size(); @@ -859,7 +857,7 @@ Symtab::FindAllSymbolsMatchingRexExAndType (const RegularExpression ®ex, Symb Symbol * Symtab::FindFirstSymbolWithNameAndType (const ConstString &name, SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); Timer scoped_timer (__PRETTY_FUNCTION__, "%s", __PRETTY_FUNCTION__); if (!m_name_indexes_computed) @@ -1026,7 +1024,7 @@ Symtab::InitAddressIndexes() void Symtab::CalculateSymbolSizes () { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); if (!m_symbols.empty()) { @@ -1060,7 +1058,7 @@ Symtab::CalculateSymbolSizes () Symbol * Symtab::FindSymbolAtFileAddress (addr_t file_addr) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); if (!m_file_addr_to_index_computed) InitAddressIndexes(); @@ -1077,7 +1075,7 @@ Symtab::FindSymbolAtFileAddress (addr_t file_addr) Symbol * Symtab::FindSymbolContainingFileAddress (addr_t file_addr) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); if (!m_file_addr_to_index_computed) InitAddressIndexes(); @@ -1095,7 +1093,7 @@ Symtab::FindSymbolContainingFileAddress (addr_t file_addr) void Symtab::ForEachSymbolContainingFileAddress(addr_t file_addr, std::function<bool(Symbol *)> const &callback) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); if (!m_file_addr_to_index_computed) InitAddressIndexes(); @@ -1159,7 +1157,7 @@ Symtab::FindFunctionSymbols (const ConstString &name, unsigned temp_symbol_indexes_size = temp_symbol_indexes.size(); if (temp_symbol_indexes_size > 0) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::recursive_mutex> guard(m_mutex); for (unsigned i = 0; i < temp_symbol_indexes_size; i++) { SymbolContext sym_ctx; diff --git a/lldb/source/Symbol/TypeSystem.cpp b/lldb/source/Symbol/TypeSystem.cpp index f8690aa79ef..2cd82f221f9 100644 --- a/lldb/source/Symbol/TypeSystem.cpp +++ b/lldb/source/Symbol/TypeSystem.cpp @@ -163,10 +163,7 @@ TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx, #pragma mark TypeSystemMap -TypeSystemMap::TypeSystemMap() : - m_mutex (), - m_map (), - m_clear_in_progress(false) +TypeSystemMap::TypeSystemMap() : m_mutex(), m_map(), m_clear_in_progress(false) { } @@ -179,7 +176,7 @@ TypeSystemMap::Clear () { collection map; { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::mutex> guard(m_mutex); map = m_map; m_clear_in_progress = true; } @@ -195,7 +192,7 @@ TypeSystemMap::Clear () } map.clear(); { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::mutex> guard(m_mutex); m_map.clear(); m_clear_in_progress = false; } @@ -205,7 +202,7 @@ TypeSystemMap::Clear () void TypeSystemMap::ForEach (std::function <bool(TypeSystem *)> const &callback) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::mutex> guard(m_mutex); // Use a std::set so we only call the callback once for each unique // TypeSystem instance std::set<TypeSystem *> visited; @@ -224,7 +221,7 @@ TypeSystemMap::ForEach (std::function <bool(TypeSystem *)> const &callback) TypeSystem * TypeSystemMap::GetTypeSystemForLanguage (lldb::LanguageType language, Module *module, bool can_create) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::mutex> guard(m_mutex); collection::iterator pos = m_map.find(language); if (pos != m_map.end()) return pos->second.get(); @@ -252,7 +249,7 @@ TypeSystemMap::GetTypeSystemForLanguage (lldb::LanguageType language, Module *mo TypeSystem * TypeSystemMap::GetTypeSystemForLanguage (lldb::LanguageType language, Target *target, bool can_create) { - Mutex::Locker locker (m_mutex); + std::lock_guard<std::mutex> guard(m_mutex); collection::iterator pos = m_map.find(language); if (pos != m_map.end()) return pos->second.get(); diff --git a/lldb/source/Symbol/UnwindTable.cpp b/lldb/source/Symbol/UnwindTable.cpp index d11410947c8..87c18d94b07 100644 --- a/lldb/source/Symbol/UnwindTable.cpp +++ b/lldb/source/Symbol/UnwindTable.cpp @@ -27,14 +27,14 @@ using namespace lldb; using namespace lldb_private; -UnwindTable::UnwindTable (ObjectFile& objfile) : - m_object_file (objfile), - m_unwinds (), - m_initialized (false), - m_mutex (), - m_eh_frame_up (), - m_compact_unwind_up (), - m_arm_unwind_up () +UnwindTable::UnwindTable(ObjectFile &objfile) + : m_object_file(objfile), + m_unwinds(), + m_initialized(false), + m_mutex(), + m_eh_frame_up(), + m_compact_unwind_up(), + m_arm_unwind_up() { } @@ -47,7 +47,7 @@ UnwindTable::Initialize () if (m_initialized) return; - Mutex::Locker locker(m_mutex); + std::lock_guard<std::mutex> guard(m_mutex); if (m_initialized) // check again once we've acquired the lock return; @@ -90,7 +90,7 @@ UnwindTable::GetFuncUnwindersContainingAddress (const Address& addr, SymbolConte Initialize(); - Mutex::Locker locker(m_mutex); + std::lock_guard<std::mutex> guard(m_mutex); // There is an UnwindTable per object file, so we can safely use file handles addr_t file_addr = addr.GetFileAddress(); @@ -152,7 +152,7 @@ UnwindTable::GetUncachedFuncUnwindersContainingAddress (const Address& addr, Sym void UnwindTable::Dump (Stream &s) { - Mutex::Locker locker(m_mutex); + std::lock_guard<std::mutex> guard(m_mutex); s.Printf("UnwindTable for '%s':\n", m_object_file.GetFileSpec().GetPath().c_str()); const_iterator begin = m_unwinds.begin(); const_iterator end = m_unwinds.end(); |