Skip to content

[Dependency Scanning] Optionally, resolve direct dependencies of a module using only the ModuleDependenciesCache. #35356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Jan 11, 2021

This speeds up contexts where we need to resolve dependencies after the main scanning action is complete.
For example: libSwiftScan binary graph generation and cycle detection.

This is necessary because ordinarily, ModuleDependenciesCache must be queried on a per-loader basis.
For example:

  1. We first search for Swift modules with the SerializedModuleLoaderBase, at which point we check the cache for previously-found Swift modules. If cache is not hit, we search the filesystem.
  2. We search for Clang modules with the ClangImporter, at which point we check the cache for previously-found Clang modules. If cache is not hit, we search the filesystem.

This change allows to eliminate a bunch of filesystem searching in step (1) when a Clang modules is in the cache and we know we have completed the scan and no longer need to be concerned with the possibility that we will discover a new Swift module that will have a higher precedence in the cache query order.

…dule using only the `ModuleDependenciesCache`.

This speeds up contexts where we need to resolve dependencies after the main scanning action is complete.
For example: libSwiftScan binary graph generation and cycle detection.

This is necessary because ordinarily, ModuleDependenciesCache must be queried on a per-loader basis.
For example, we first search for Swift modules with the SerializedModuleLoaderBase, at which point we check the cache for previously-found Swift modules. If cache is not hit, we search the filesystem.
Then we search for Clang moduels with the ClangLoader, at which point we check the cache for previously-found Clang modules. If cache is not hit, we search the filesystem.

This change allows to eliminate a bunch of filesystem searching in step (1) when we know we have completed the scan and no longer need to be concerned with the correctness of the cache contents.
@artemcm artemcm requested a review from nkcsgexi January 11, 2021 22:57
@artemcm
Copy link
Contributor Author

artemcm commented Jan 12, 2021

@swift-ci please test

@artemcm
Copy link
Contributor Author

artemcm commented Jan 12, 2021

@swift-ci please smoke test

@artemcm
Copy link
Contributor Author

artemcm commented Jan 13, 2021

@swift-ci please smoke test Linux platform

Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

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

Makes sense to me.

@artemcm artemcm merged commit 02b42e2 into swiftlang:main Jan 13, 2021
@artemcm artemcm deleted the DependencyScannerUseCacheWhenAppropriate branch January 13, 2021 20:01
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