Skip to content

[5.5] Short-circuit GlobalActorAttributeRequest attempting to get the Source Location of a serialized decl. #38035

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
merged 1 commit into from
Jun 24, 2021

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Jun 22, 2021

Cherry-pick of #38034

When querying the attr from a serialized decl, dependning on deserialization order, getting its source-location may launch into arbitrary type-checking when querying interface types of such decls. Which, in turn, may do things like query (to print) USRs. This ends up being prone to request evaluator cycles.

Because this only applies to serialized decls, we can be confident that they already fell through this checking as primaries, so, for now, to avoid cycles, we simply ignore the source location on serialized decls only.

Long-term, we are planning to remove the merge-modules jobs, which will help with not having to deal with this scenario.
Alternatively, we would need to ensure that at decl deserialization time we cache the GlobalActorAttributeRequest when we see this attribute, but this would require further surgery to either serialization format or the GlobalActorAttr model, because such caching requires access to the DeclID of the global actor being referenced, which is not currently easily accessible.

Resolves rdar://79563942

…rce Location of a serialized decl.

When querying the attr from  a serialized decl, dependning on deserialization order, getting its source-location may launch into arbitrary type-checking when querying interface types of such decls. Which, in turn, may do things like query (to print) USRs. This ends up being prone to request evaluator cycles.

Because this only applies to serialized decls, we can be confident that they already fell through this checking as primaries, so, for now, to avoid cycles, we simply ignore the source location on serialized decls only.

Long-term, we are planning to remove the `merge-modules` jobs, which will help with not having to deal with this scenario.
Alternatively, we would need to ensure that at decl deserialization time we cache the `GlobalActorAttributeRequest` when we see this attribute, but this would require further surgery to either serialization format or the `GlobalActorAttr` model, because such caching requires access to the `DeclID` of the global actor being referenced, which is not currently easily accessible.

Resolves rdar://79563942
@artemcm artemcm added the r5.5 label Jun 22, 2021
@artemcm artemcm requested review from DougGregor and CodaFi June 22, 2021 21:19
@artemcm artemcm requested a review from a team as a code owner June 22, 2021 21:19
@artemcm
Copy link
Contributor Author

artemcm commented Jun 22, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 30aed66

@artemcm
Copy link
Contributor Author

artemcm commented Jun 23, 2021

@swift-ci please test macOS platform

2 similar comments
@artemcm
Copy link
Contributor Author

artemcm commented Jun 23, 2021

@swift-ci please test macOS platform

@artemcm
Copy link
Contributor Author

artemcm commented Jun 23, 2021

@swift-ci please test macOS platform

@DougGregor DougGregor merged commit 866d200 into swiftlang:release/5.5 Jun 24, 2021
@AnthonyLatsis AnthonyLatsis added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.5 labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants