forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DynamicLoaderDarwin load images in parallel with preload (llvm#110646)
This change enables `DynamicLoaderDarwin` to load modules in parallel using the thread pool. This new behavior is controlled by a new setting `plugin.dynamic-loader.darwin.experimental.enable-parallel-image-load`, which is enabled by default. When disabled, DynamicLoaderDarwin will load modules sequentially as before.
- Loading branch information
Showing
9 changed files
with
215 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwinProperties.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//===-- DynamicLoaderDarwinProperties.cpp ---------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "DynamicLoaderDarwinProperties.h" | ||
|
||
using namespace lldb_private; | ||
|
||
#define LLDB_PROPERTIES_dynamicloaderdarwin_experimental | ||
#include "DynamicLoaderDarwinProperties.inc" | ||
|
||
enum { | ||
#define LLDB_PROPERTIES_dynamicloaderdarwin_experimental | ||
#include "DynamicLoaderDarwinPropertiesEnum.inc" | ||
}; | ||
|
||
llvm::StringRef DynamicLoaderDarwinProperties::GetSettingName() { | ||
static constexpr llvm::StringLiteral g_setting_name("darwin"); | ||
return g_setting_name; | ||
} | ||
|
||
DynamicLoaderDarwinProperties::ExperimentalProperties::ExperimentalProperties() | ||
: Properties(std::make_shared<OptionValueProperties>( | ||
GetExperimentalSettingsName())) { | ||
m_collection_sp->Initialize(g_dynamicloaderdarwin_experimental_properties); | ||
} | ||
|
||
DynamicLoaderDarwinProperties::DynamicLoaderDarwinProperties() | ||
: Properties(std::make_shared<OptionValueProperties>(GetSettingName())), | ||
m_experimental_properties(std::make_unique<ExperimentalProperties>()) { | ||
m_collection_sp->AppendProperty( | ||
Properties::GetExperimentalSettingsName(), | ||
"Experimental settings - setting these won't produce errors if the " | ||
"setting is not present.", | ||
true, m_experimental_properties->GetValueProperties()); | ||
} | ||
|
||
bool DynamicLoaderDarwinProperties::GetEnableParallelImageLoad() const { | ||
return m_experimental_properties->GetPropertyAtIndexAs<bool>( | ||
ePropertyEnableParallelImageLoad, | ||
g_dynamicloaderdarwin_experimental_properties | ||
[ePropertyEnableParallelImageLoad] | ||
.default_uint_value != 0); | ||
} | ||
|
||
DynamicLoaderDarwinProperties &DynamicLoaderDarwinProperties::GetGlobal() { | ||
static DynamicLoaderDarwinProperties g_settings; | ||
return g_settings; | ||
} |
34 changes: 34 additions & 0 deletions
34
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwinProperties.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//===-- DynamicLoaderDarwinProperties.h -------------------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLDB_SOURCE_PLUGINS_DYNAMICLOADER_MACOSX_DYLD_DYNAMICLOADERDARWINPROPERTIES_H | ||
#define LLDB_SOURCE_PLUGINS_DYNAMICLOADER_MACOSX_DYLD_DYNAMICLOADERDARWINPROPERTIES_H | ||
|
||
#include "lldb/Core/UserSettingsController.h" | ||
|
||
namespace lldb_private { | ||
|
||
class DynamicLoaderDarwinProperties : public Properties { | ||
public: | ||
class ExperimentalProperties : public Properties { | ||
public: | ||
ExperimentalProperties(); | ||
}; | ||
static llvm::StringRef GetSettingName(); | ||
static DynamicLoaderDarwinProperties &GetGlobal(); | ||
DynamicLoaderDarwinProperties(); | ||
~DynamicLoaderDarwinProperties() override = default; | ||
bool GetEnableParallelImageLoad() const; | ||
|
||
private: | ||
std::unique_ptr<ExperimentalProperties> m_experimental_properties; | ||
}; | ||
|
||
} // namespace lldb_private | ||
|
||
#endif // LLDB_SOURCE_PLUGINS_DYNAMICLOADER_MACOSX_DYLD_DYNAMICLOADERDARWINPROPERTIES_H |
Oops, something went wrong.