diff options
| author | JosJuice <josjuice@gmail.com> | 2025-06-30 19:12:00 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2025-07-27 16:26:47 +0200 |
| commit | 803e6b017bf8bb82ee65b48fa244eb1e4c89034d (patch) | |
| tree | ae337c9e6d6e4787d017061b14b01c2579fcabd7 /Source/Core/Common/SymbolDB.cpp | |
| parent | 59d126d21582d2fd2df05dc33d5eeebaf097204a (diff) | |
PPCSymbolDB: Reduce lock contention in LoadMap/LoadMapOnBoot
By building the map in a local variable and then swapping it with the
member variable, we avoid the need to hold a lock while building the
map.
Diffstat (limited to 'Source/Core/Common/SymbolDB.cpp')
| -rw-r--r-- | Source/Core/Common/SymbolDB.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Source/Core/Common/SymbolDB.cpp b/Source/Core/Common/SymbolDB.cpp index 88f281e497..ad438b8277 100644 --- a/Source/Core/Common/SymbolDB.cpp +++ b/Source/Core/Common/SymbolDB.cpp @@ -5,6 +5,7 @@ #include <cstring> #include <map> +#include <mutex> #include <string> #include <utility> @@ -49,6 +50,8 @@ bool SymbolDB::IsEmpty() const bool SymbolDB::Clear(const char* prefix) { + std::lock_guard lock(m_mutex); + // TODO: honor prefix m_map_name.clear(); if (IsEmpty()) @@ -62,8 +65,13 @@ bool SymbolDB::Clear(const char* prefix) void SymbolDB::Index() { + Index(&m_functions); +} + +void SymbolDB::Index(XFuncMap* functions) +{ int i = 0; - for (auto& func : m_functions) + for (auto& func : *functions) { func.second.index = i++; } |
