[Lldb-commits] [PATCH] D122975: parallelize calling of Module::PreloadSymbols()
Luboš Luňák via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed May 4 11:00:08 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb7d807dbcff0: [lldb] parallelize calling of Module::PreloadSymbols() (authored by llunak).
Repository:
rG LLVM Github Monorepo
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.427068.patch
Type: text/x-patch
Size: 1546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220504/b1f675fb/attachment.bin>
More information about the lldb-commits
mailing list