Skip to content

[ownership] Refactor linear lifetime checker so that it doesnt requir… #26767

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

gottesmm
Copy link
Contributor

…e a value (only a beginBlock).

NFCI.

The checker internally doesn't actually use the value for anything except for
diagnostics and getting the value's parent block. So what this commit does is
change the value to be optional state that is used in the diagnostics if it is
available and otherwise uses its own ptr to the beginBlock. This will allow me
to make two different constructors, one that takes a value (and sets the
beginBlock ptr to its own parent block) and one that just takes a block. In
certain cases, basing it off of the value can lead to counter-intuitive bugs
(esp if code is using Builder.emit*ValueOperation() to create retain/release in
non-ossa code).

The reason why I am doing this is I want to introduce a higher level API on top
of this for a common pattern in ossa (and code written for both modes): lifetime
extending a value from a use point to a later program point by using a copy. I
will explain this in more detail in a forthcoming commit.

…e a value (only a beginBlock).

NFCI.

The checker internally doesn't actually use the value for anything except for
diagnostics and getting the value's parent block. So what this commit does is
change the value to be optional state that is used in the diagnostics if it is
available and otherwise uses its own ptr to the beginBlock. This will allow me
to make two different constructors, one that takes a value (and sets the
beginBlock ptr to its own parent block) and one that just takes a block. In
certain cases, basing it off of the value can lead to counter-intuitive bugs
(esp if code is using Builder.emit*ValueOperation() to create retain/release in
non-ossa code).

The reason why I am doing this is I want to introduce a higher level API on top
of this for a common pattern in ossa (and code written for both modes): lifetime
extending a value from a use point to a later program point by using a copy. I
will explain this in more detail in a forthcoming commit.
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test and merge

@swift-ci swift-ci merged commit b1b0fbe into swiftlang:master Aug 21, 2019
@gottesmm gottesmm deleted the pr-b143026be92ec6a7185359880471760ab238040f branch August 21, 2019 19:21
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.

2 participants