-
Notifications
You must be signed in to change notification settings - Fork 4
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
Changes to avoid unnecessary assumptions #246
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After a conversation with @mlimbeck, we figured that the specs that we use in the router are sometimes a bit awkward and force us to introduce a few adhoc assumptions (e.g.,
assume d.WellConfigured()
inRun
) which can be made into preconditions if we change slightly our predicates. The goal of this PR is to restructure the predicates used in the dataplane to avoid such assumptions, and to eliminate the need for calling// @ IgnoreFromHere()
before the call tod.mtx.Unlock
inRun
. In the process, we changed slightly the specifications of some public methods in a few ways:d.mtx
. We can easily address this later, and it is not urgent at allnil
)read
closure from inside other closures. To overcome that, we manually asserted the preconditions (there are no postconditions to establish). This is cumbersome, ugly, and prone to errors when specs change. In this PR, I introduce a much better temporary fix that requires passingd
as a parameter to the closure, which allows us to perform the call.To avoid unnecessary work at the moment, we did not update the postconditions to preserve information hiding in the setters as well. Instead, we dropped them for now and we plan to add them lazily, on a per-need basis.
This PR can be seen as a step towards addressing #155 (although completely solving that would require strengthening Gobra's type system).
While doing this PR, I also noticed a few unused ghost methods and some small issues that I fixed.
I also run into a very annoying incompleteness in the termination checker of Viper that I
will likely reportreported (viperproject/silver#773 (comment)) as a bug.Finally, verifying
Run
now seems to be much faster due to better info hiding. However, verifyinginitMetrics
takes much longer. I could spend some time looking into this, but given our current priorities and the fact that the spec of this method should not change again, it is better to spend my time somewhere else.The only thing missing to conclude this PR is to refactorthis PR is ready for review and for mergingRun
. Once that is done,