Skip to content

[ownership] Add a higher level construct called BorrowScopeIntroducingOperand #27337

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

Conversation

gottesmm
Copy link
Contributor

This will allow me to put easily in support for validating the implicit borrow scope creating in certain cases in ossa.

In this specific PR, I implement the construct and I add support for validating that owned parameters used by coroutines are not destroyed before the coroutine ends.

@gottesmm
Copy link
Contributor Author

@swift-ci test

@gottesmm
Copy link
Contributor Author

@swift-ci test source compatibility

@gottesmm
Copy link
Contributor Author

I am testing source compatibility since I am expanding the ownership verification checks and want to make sure I am not breaking anything.

};

/// Operands that create a new borrow scope for an owned value passed as the
/// operand's value.
Copy link
Contributor

@atrick atrick Sep 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this a little confusing. When an instruction produces a borrowed value, all of its uses are using the borrowed value. So how is an operand introducing the borrow?

Maybe this is just a BorrowedOperand?

@atrick
Copy link
Contributor

atrick commented Sep 24, 2019

So, the operand's operation introduces a borrow scope and the operand's value is borrowed for the duration of that operation's borrow scope. BorrowedOperand works for me.

@atrick
Copy link
Contributor

atrick commented Sep 24, 2019

As is so often the case, long names are not helpful in communicating subtle information, where a short description works very well.

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 529fb139d693fdf9461df60297065a9e68f06fdd

@gottesmm
Copy link
Contributor Author

os x failed in lldb

@gottesmm
Copy link
Contributor Author

@swift-ci test os x platform

@gottesmm
Copy link
Contributor Author

For those listening in, I did a bunch of testing here since I am expanding our verification here for end_apply.

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 529fb139d693fdf9461df60297065a9e68f06fdd

…d to work with implicit uses of owned parameters implied by their use by a borrow scope introducing value.

For now this only is used for ensuring that an owned value that has a
begin_borrow use, adds the end_borrows matched to the begin_borrow to the owned
values implicit regular user list.

I am going to use this same functionality to model the requirements around
begin_apply and mark_dependence (when I add an end_mark_dependence instruction).
…ser list of owned parameters passed as guaranteed parameters to a begin_apply.

This just follows automagically from the recent work that I did with introducing
BorrowScopeIntroducingOperands.

I confirmed locally that the negative tests do not fail as expected when
visiting the destroys of the guaranteed parameters.
@gottesmm gottesmm force-pushed the pr-e029383157166756e653b260323559ce3a8eab16 branch from 529fb13 to f9f3f53 Compare September 26, 2019 02:11
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

2 similar comments
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm gottesmm merged commit 5e8ba1d into swiftlang:master Sep 26, 2019
@gottesmm gottesmm deleted the pr-e029383157166756e653b260323559ce3a8eab16 branch September 26, 2019 03:24
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