-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ownership] Add verification that parent borrow scopes completely enclose implicit child borrow scopes introduced via BorrowScopeOperand #27376
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
…lose implicit child borrow scopes introduced via BorrowScopeOperand. As an example consider a begin_borrow/end_borrow scope and a coroutine: ``` %0 = begin_borrow %... ... %token = apply %coroutine(%0) ... end_apply %token ... end_borrow %0 ``` With this change, we will validate that the end_borrow never enters the region of code until the coroutine is actually finished executing (as shown by the end_apply).
@swift-ci test |
@swift-ci test source compatibility |
Once this is in, I am going to introduce mark_dependence as an instruction like this. |
Build failed |
Nice! The OS X check caught something |
Build failed |
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.
lgtm
@atrick Found the problem. Mandatory inlining was not handling coroutines correctly. It was inserting the end_borrows/destroys for certain values after the apply site of the coroutine, not after the end_apply, abort_apply. Interestingly, I was just improving this code here in #27405 where I refactored out this apply site functionality (since I needed it somewhere else where begin_apply was actually not supported). I am going to add in a commit based upon that one for FullApplySites only that acts like insertAfter [see #27405] for apply and try_apply and that returns the token users of the begin_apply as insertion points for begin_apply instead. The nice thing about this is when we add a coroutine apply function that is a terminator (which I imagine we will), all this code will be correct automagically. The beauty of having abstractions! = ). |
I landed the coroutine fix. I am curious if this passes now. |
@swift-ci test |
@swift-ci test source compatibility |
Debug source compat suite failure was a jenkins error. |
@swift-ci Please Test Source Compatibility Debug |
Release Source Compat only failure is a known failure: 17:35:51 FAIL: Sourcery, 5.1, 20bdf6, Swift Package I expected Debug to fail in a similar way. |
Debug did fail the same way. Merging! |
As an example consider a begin_borrow/end_borrow scope and a coroutine:
With this change, we will validate that the end_borrow never enters the region
of code until the coroutine is actually finished executing (as shown by the
end_apply).