Skip to content

Commit 7e0bc44

Browse files
committed
[lldb] Disable conformance loading by default
This feature is not yet ready. Even locally loading the witnesses takes too long. rdar://143847977
1 parent cbb922c commit 7e0bc44

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

lldb/include/lldb/Core/ModuleList.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class ModuleListProperties : public Properties {
8282
bool GetUseSwiftDWARFImporter() const;
8383
bool SetUseSwiftDWARFImporter(bool new_value);
8484
bool GetSwiftValidateTypeSystem() const;
85+
bool GetSwiftLoadConformances() const;
8586
SwiftModuleLoadingMode GetSwiftModuleLoadingMode() const;
8687
bool SetSwiftModuleLoadingMode(SwiftModuleLoadingMode);
8788

lldb/source/Core/CoreProperties.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ let Definition = "modulelist" in {
2828
def SwiftValidateTypeSystem: Property<"swift-validate-typesystem", "Boolean">,
2929
DefaultFalse,
3030
Desc<"Validate all Swift typesystem queries. Used for testing an asserts-enabled LLDB only.">;
31+
def SwiftLoadConformances: Property<"swift-load-conformances", "Boolean">,
32+
DefaultFalse,
33+
Desc<"Resolve type alias via the conformance section. Disabled for performance reasons">;
3134
def SwiftModuleLoadingMode: Property<"swift-module-loading-mode", "Enum">,
3235
DefaultEnumValue<"eSwiftModuleLoadingModePreferSerialized">,
3336
EnumValues<"OptionEnumValues(g_swift_module_loading_mode_enums)">,

lldb/source/Core/ModuleList.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,12 @@ bool ModuleListProperties::GetSwiftValidateTypeSystem() const {
200200
idx, g_modulelist_properties[idx].default_uint_value != 0);
201201
}
202202

203+
bool ModuleListProperties::GetSwiftLoadConformances() const {
204+
const uint32_t idx = ePropertySwiftLoadConformances;
205+
return GetPropertyAtIndexAs<bool>(
206+
idx, g_modulelist_properties[idx].default_uint_value != 0);
207+
}
208+
203209
SwiftModuleLoadingMode ModuleListProperties::GetSwiftModuleLoadingMode() const {
204210
const uint32_t idx = ePropertySwiftModuleLoadingMode;
205211
return GetPropertyAtIndexAs<SwiftModuleLoadingMode>(

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3102,13 +3102,11 @@ SwiftLanguageRuntime::ResolveTypeAlias(CompilerType alias) {
31023102
return llvm::createStringError("no reflection context");
31033103

31043104
// FIXME: The current implementation that loads all conformances
3105-
// up-front creates too much small memory traffic. As a stop-gap,
3106-
// disable the feature on remote devices.
3107-
auto &triple = GetProcess().GetTarget().GetArchitecture().GetTriple();
3108-
if (triple.isOSDarwin() && !triple.isTargetMachineMac())
3109-
return llvm::createStringError("conformance loading disabled on remote "
3110-
"devices for performance reasons");
3111-
3105+
// up-front creates too much small memory traffic during the
3106+
// LookupTypeWitness step.
3107+
if (!ModuleList::GetGlobalModuleListProperties().GetSwiftLoadConformances())
3108+
return llvm::createStringError("conformance loading disabled in settings");
3109+
31123110
for (const std::string &protocol : GetConformances(in_type)) {
31133111
auto *type_ref =
31143112
reflection_ctx->LookupTypeWitness(in_type, member, protocol);

lldb/test/API/lang/swift/typealias_othermodule/TestSwiftTypeAliasOthermodule.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def test(self):
1111
"""Test that type aliases can be imported from reflection metadata"""
1212
arch = self.getArchitecture()
1313
self.build()
14+
self.expect('settings set symbols.swift-load-conformances true')
1415
log = self.getBuildArtifact("types.log")
1516
self.runCmd('log enable lldb expr types -f "%s"' % log)
1617
lldbutil.run_to_source_breakpoint(

0 commit comments

Comments
 (0)