-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Dependency Scanning] Use a standalone DependencyScanningFilesystem
on the scanner, sharing a common status
cache from Clang's dependency service cache
#72932
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
Conversation
591b024
to
8ca0a1d
Compare
@swift-ci test |
8ca0a1d
to
3427209
Compare
@swift-ci test |
new clang::tooling::dependencies::DependencyScanningWorkerFilesystem( | ||
globalScanningService.ClangScanningService->getSharedCache(), | ||
ScanASTContext.SourceMgr.getFileSystem()); | ||
ScanASTContext.SourceMgr.setFileSystem(std::move(DepFS)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the lifetime of ScanASTContext
?
I'm asking because each instance of DependencyScanningWorkerFilesystem
has a copy of a subset of the shared cache to reduce lock contention in the shared cache. We should create as few of these VFSs as possible in order to avoid re-populating the local cache from the shared cache over and over again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its lifetime is the entire scan. And until we enable parallel-scanning by-default, there is only one of these workers.
… on the scanner, sharing a common `status` cache from Clang's dependency service cache
3427209
to
1804a84
Compare
@swift-ci test |
Built-in Clang dependency scanner uses a
DependencyScanningFilesystem
which relies on thestat
cache owned by its parentDependencyScanningService
. This way repeated attempts to query a filesystem entry hit the cache during scanning. Until now, the Swift scanner did not share thisstat
cache so filesystem entry lookups by the Swift scanner went directly to the "real" underlying filesystem, resulting in often duplicated calls tostat
. This change makes the Swift scanner use/share Clang Scanner'sstat
cache, unifying the filesystem abstraction for the two.