Skip to content

Rewrite LoadBorrowImmutabilityChecker #34385

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
merged 4 commits into from
Oct 22, 2020

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Oct 21, 2020

AccessPath allows us to discard a lot of the original implementation.

The verification will now be as complete as it can be within the
capability of our SIL utilities. It is much more aggressive with
respect to boxes, references, and pointers. It's more efficient in
that it only considers "overlapping" uses.

It is also now wholly consistent with the utilities that it uses, so
can be reenabled.

We could probably go even further and remove the switch statement
entirely, relying on AccessPath to recognize any operations that
propagate addresses, boxes, or pointers. But I didn't want to
potentially weaken enforcement without more careful consideration.

Limit names to a straightforward and unambiguous statement of
purpose. They should not pose additional questions which can only be
answered by reading the code. Nuanced meaning belongs in descriptions
and code comments.

These are all examples that legitimately made reading the code very
difficult for me:

- LoadBorrowInvalidationChecker: what does "invalidation" mean in this
  context? How does that extend the meaning of "checker"? How can
  something ever pass a checker and not be invalid?

- constructValuesForKey outside of an ADT does not state purpose at all.

- wellBehavedWriteAccumulator: Raises questions about what writes are
  included and the broader semantics of the parent function. It turns
  out that well-behavedness is handled by the function's return value
  and has nothing to do with the accumulator.
@atrick
Copy link
Contributor Author

atrick commented Oct 21, 2020

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Oct 21, 2020

@swift-ci test source compatibility

@atrick atrick requested a review from gottesmm October 21, 2020 21:38
@atrick atrick force-pushed the rewrite-loadborrowchecker branch 2 times, most recently from 3fda11b to 7a6e914 Compare October 21, 2020 21:44
@atrick
Copy link
Contributor Author

atrick commented Oct 21, 2020

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Oct 21, 2020

@swift-ci test source compatibility

The verification will now be as complete as it can be within the
capability of our SIL utilities. It is much more aggressive with
respect to boxes, references, and pointers. It's more efficient in
that it only considers "overlapping" uses.

It is also now wholly consistent with the utilities that it uses, so
can be reenabled.

We could probably go even further and remove the switch statement
entirely, relying on AccessPath to recognize any operations that
propagate addresses, boxes, or pointers. But I didn't want to
potentially weaken enforcement without more careful consideration.
@atrick atrick force-pushed the rewrite-loadborrowchecker branch from 7a6e914 to 0f1beed Compare October 21, 2020 22:02
@atrick
Copy link
Contributor Author

atrick commented Oct 21, 2020

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Oct 21, 2020

@swift-ci test source compatibility

@atrick
Copy link
Contributor Author

atrick commented Oct 22, 2020

SCK Evergreen is failing on the main branch

@atrick atrick merged commit a353176 into swiftlang:main Oct 22, 2020
@atrick atrick deleted the rewrite-loadborrowchecker branch November 9, 2020 17:13
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.

1 participant