Skip to content

[5.6][SourceKit] Enqueue SwiftASTConsumers async on a queue #40497

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

ahoppen
Copy link
Member

@ahoppen ahoppen commented Dec 10, 2021

Cherry-pick #40493, #40339 and #40504 to release/5.6.


Enqueuing SwiftASTConsumers might be expensive because getBuildOperationForConsumer consults the file system. Since all results from the AST build are processed asynchronously anyway, there’s no need to perform the enqueuing synchronously.

Also cherry-picks #40339 because #40493 depends on the fact that you can’t specify fixed snapshots to use when building an AST.

rdar://86289703

…lding an AST

The feature was never used and just complicated the implementation.
FileContents already contains the stamps.
We never need to have two copies of the same `FileContent` object, so we don’t need a copy constructor and can thus pass it on the stack again, instead of storing it on the heap.
@ahoppen
Copy link
Member Author

ahoppen commented Dec 10, 2021

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c13d6cd4c628ef6efac5f96820d3209a7389d8be

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - c13d6cd4c628ef6efac5f96820d3209a7389d8be

Enqueuing `SwiftASTConsumer`s might be expensive because `getBuildOperationForConsumer` consults the file system. Since all results from the AST build are processed asynchronously anyway, there’s no need to perform the enqueuing  synchronously.

rdar://86289703
@ahoppen ahoppen force-pushed the pr-5.6/enqueue-consumer-on-background-queue branch from c13d6cd to b9379ae Compare December 10, 2021 08:35
@ahoppen
Copy link
Member Author

ahoppen commented Dec 10, 2021

@swift-ci Please test

…ciated source file is reopened

If a file isn’t opened with a `key.sourcefile` argument, we don’t store a snapshot for it. This could cause a crash when trying to consult its snapshot to see whether an AST can be reused for cursor info.
@ahoppen
Copy link
Member Author

ahoppen commented Dec 10, 2021

@swift-ci Please test

@ahoppen ahoppen requested a review from akyrtzi December 10, 2021 17:01
@akyrtzi akyrtzi merged commit cde15b8 into swiftlang:release/5.6 Dec 10, 2021
@ahoppen ahoppen deleted the pr-5.6/enqueue-consumer-on-background-queue branch January 25, 2022 10:48
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.

3 participants