-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[region-isolation] Only make partial_apply actor derived if we capture an isolated parameter... not just any actor. #72004
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
@swift-ci smoke test |
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.
Other than the two questionable assertions, this looks good.
…ated parameter in the closure's function signature. This ensures that when region isolation is enabled, we can begin properly modeling when a closure should not be allowed to be isolated. In the next commit, I am going to loosen this and we should be able to pass in actors outside of methods without the closure being afflicted with "actor derived-ness".
…e an isolated parameter... not just any actor. Before I couldn't do this since, @sil_isolated was not represented on partial_applies. Since in the previous commit, I added support to the compiler to represent this, I can now limit this query so now one can pass an actor instance outside of its method to a nonisolated non-Sendable partial apply. Since it is Sendable, it is always safe to do this since we are passing the actor. rdar://123881277
Problem was that in CaptureInfo we were determining if a value was isLocalCapture by calling CapturedValue::getDecl(). This doesn't work for dynamic self metadata which is never an isolation parameter (it is a metatype) and doesn't have a decl. I am preparing a small addition to this PR with a patch that fixes that issue by adding a new isLocalCapture to CapturedValue that does the correct thing. |
Specifically, CaptureInfo previously as a pattern in CaptureInfo.cpp would attempt to ascertain if a CapturedValue was a local capture by checking the CapturedValue's decl. Unfortunately, when we have captured dynamic self metadata, we do not even have a getDecl() and should return false. I fixed this by adding a new API to CaptureValue that checks if it has a decl before checking if the decl is a local capture. This avoids this problem.
341682f
to
f48bd90
Compare
…re that we actually process it via an assert. A little paranoia never hurts.
@swift-ci smoke test |
a76eb10
to
77e2cd3
Compare
@swift-ci smoke test |
@swift-ci smoke test |
@swift-ci smoke test |
@swift-ci smoke test macOS platform |
Before I couldn't do this since, @sil_isolated was not represented on partial_applies. In the first commit in this commit series, I added support to the frontend so that we now emit partial_applies with sil_isolated parameters.
In the second commit, I use this information to restrict when the partial_apply is considered to be "actor derived" to if the partial_apply parameter is @sil_isolated.
rdar://123881277