-
Notifications
You must be signed in to change notification settings - Fork 35
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
Checking only read permissions when asserting function preconditions #877
Conversation
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.
I did not notice any major problems. I have a question and a small suggestion to avoid warnings. To be clear I understand this, for the program
function f(x: Ref): Int
requires acc(x,f, 2/3)
requires acc(x,f, 2/3)
{ ... }
in the new interpretation, this is safe to call whenever we have any permission to x.f, and this precondition does not imply false, right?
Changes the meaning of permission amounts in functions:
acc(x.f, write)
oracc(x.f, wildcard)
oracc(x.f, 1/2)
oracc(x.f, b ? write : 1/2)
oracc(x.f) && acc(x.f)
oracc(x.f, 2/1)
all just require checking that a caller has some positive permission amount tox.f
. The same is true for predicate permissions.acc(x.f, b ? write : none)
is equivalent toacc(x.f, b ? 1/2 : none)
andacc(x.f, b ? wildcard : none)
but not toacc(x.f, write)
oracc(x.f, none)
.The corresponding changes in Silver warn clients who rely on the current behavior, and we provide an alternative:
asserting
expression instead.acc(x.f, b ? wildcard : none)
is now allowed only in functions (previously, any complex expressions involving wildcards were always forbidden).--respectFunctionPrePermAmounts
command line optionThe implementation in Silicon should be more efficient than just substituting wildcards everywhere: