-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[TypeChecker/SILGen] Dynamic enforcement of witness/objc isolation with @preconcurrency attribute #70867
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
[TypeChecker/SILGen] Dynamic enforcement of witness/objc isolation with @preconcurrency attribute #70867
Conversation
f2c5e44
to
ae4662d
Compare
@swift-ci please test |
@swift-ci please test source compatibility |
@@ -1604,11 +1604,15 @@ struct InheritedEntry : public TypeLoc { | |||
/// Whether there was an @retroactive attribute. | |||
bool isRetroactive = false; | |||
|
|||
/// Whether there was an @preconcurrency attribute. | |||
bool isPreconcurrency = false; |
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.
Should these be bitfields?
/// conformances" bits. | ||
llvm::PointerIntPair<DeclContext *, 3, unsigned> ContextAndBits; | ||
|
||
/// Indicates whether the conformance is invalid. | ||
bool Invalid : 1; |
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.
You can combine the bits from ContextAndBits and SourceKindAndImplyingConformance with 'Invalid' into a single bitfield
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.
We discussed this offline with Slava and I'm going to follow-up with bitfield changes in a separate PR.
…mances Suppress warnings/errors when actor isolated synchroneous witness is matched against `@preconcurrency` conformance requirement. Witness thunk assumes isolation of the witness but instead of a hop to its executor it would emit a runtime check to make sure that its always called from the expected context.
…d @preconcurrency witness thunks For `@preconcurrency` conformance witness thunks replace hop to executor with a precondition to make sure that the thunk is always called in the expected context.
…at adopted concurrency Don't treat isolated or explicitly `nonisolated` requirements as preconcurrency because in that case we consider protocol as concurrency adopter.
ae4662d
to
1caafee
Compare
@swift-ci please test |
@swift-ci please test source compatibility |
@swift-ci please test |
@swift-ci please test source compatibility |
@swift-ci please test |
@swift-ci please test Linux platform |
Initial implementation of
@preconcurrency
conformances and dynamic actor isolation enforcement that comes with them.The PR:
@preconcurrency
attribute available in inheritance clauses of types and extensions@objc
thunks to make sure that calls happens on expected executor.@preconcurrency
attributes on conformances as having no effect when no diagnostics were suppressed by them.Resolves: rdar://102342433
Resolves: rdar://80972126