Skip to content

Conversation

@adrian-prantl
Copy link

@adrian-prantl adrian-prantl commented Nov 14, 2025

Set up an explicit Swift module loader
and populate it with explicitly specified Swift modules.

This change allows LLDB to precisely load the explicitly built main
module belonging to the current CU from disk. The mere presence of an
ESML also recursively enables the same behavior for all of its
dependencies, since that functionality is already implemented in the
Swift compiler.

This fixes a performance cliff encountered when debugging with dSYMs
which contain all user modules, but none from the SDK, thus triggering
an implicit build of any SDK dependencies.

During the transition period this behavior can be disabled with a setting.

rdar://164274588

Depends on:
#11833
swiftlang/swift#85519
swiftlang/swift-driver#2012

and populate it with explicitly specified Swift modules.

This change allows LLDB to precisely load the explicitly built main
module belonging to the current CU from disk. The mere presence of an
ESML also recursively enables the same behavior for all of its
dependencies, since that functionality is already implemented in the
Swift compiler.

This fixes a performance cliff encountered when debugging with dSYMs
which contain all user modules, but none from the SDK, thus triggering
an implicit build of any SDK dependencies.

During the transition period this behavior can be disabled with a setting.

rdar://164274588
@adrian-prantl
Copy link
Author

@swift-ci test

Copy link

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks fine other than I am not sure if CAS module is loaded correctly.

if (props.GetUseSwiftExplicitModuleLoader()) {
auto &search_path_opts = GetCompilerInvocation().getSearchPathOptions();
std::unique_ptr<swift::ModuleLoader> esml_up =
swift::ExplicitSwiftModuleLoader::create(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this loader load module from CAS correctly?

So for caching build, we actually stored the explicit module map inside the CAS so the file is actually loaded from there. We can probably switch that up to use a regular file instead now (I created a special code path because the explicit module map wasn't deterministic before, but it should be now).

@adrian-prantl
Copy link
Author

@swift-ci test windows

@adrian-prantl
Copy link
Author

@swift-ci test linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants