Files
clang-p2996/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwinProperties.cpp
Dmitrii Galimzianov 5f2cf99e14 DynamicLoaderDarwin load images in parallel with preload (#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.
2024-10-15 13:25:01 -07:00

54 lines
2.0 KiB
C++

//===-- 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;
}