[Lldb-commits] [PATCH] D122975: parallelize calling of Module::PreloadSymbols()
Luboš Luňák via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Sat Apr 16 10:57:44 PDT 2022
llunak updated this revision to Diff 423247.
llunak added a comment.
Adapted to API changes from D123225 <https://reviews.llvm.org/D123225>.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122975/new/
https://reviews.llvm.org/D122975
Files:
lldb/source/Target/Target.cpp
Index: lldb/source/Target/Target.cpp
===================================================================
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -62,6 +62,7 @@
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SetVector.h"
+#include "llvm/Support/ThreadPool.h"
#include <memory>
#include <mutex>
@@ -1623,6 +1624,17 @@
void Target::ModulesDidLoad(ModuleList &module_list) {
const size_t num_images = module_list.GetSize();
if (m_valid && num_images) {
+ if (GetPreloadSymbols()) {
+ // Try to preload symbols in parallel.
+ llvm::ThreadPoolTaskGroup task_group(Debugger::GetThreadPool());
+ auto preload_symbols_fn = [&](size_t idx) {
+ ModuleSP module_sp(module_list.GetModuleAtIndex(idx));
+ module_sp->PreloadSymbols();
+ };
+ for (size_t idx = 0; idx < num_images; ++idx)
+ task_group.async(preload_symbols_fn, idx);
+ task_group.wait();
+ }
for (size_t idx = 0; idx < num_images; ++idx) {
ModuleSP module_sp(module_list.GetModuleAtIndex(idx));
LoadScriptingResourceForModule(module_sp, this);
@@ -2170,11 +2182,6 @@
});
}
- // Preload symbols outside of any lock, so hopefully we can do this for
- // each library in parallel.
- if (GetPreloadSymbols())
- module_sp->PreloadSymbols();
-
llvm::SmallVector<ModuleSP, 1> replaced_modules;
for (ModuleSP &old_module_sp : old_modules) {
if (m_images.GetIndexForModule(old_module_sp.get()) !=
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122975.423247.patch
Type: text/x-patch
Size: 1546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220416/b3bf1593/attachment-0001.bin>
More information about the lldb-commits
mailing list