-
Notifications
You must be signed in to change notification settings - Fork 63
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
Redo Heapster Lifetime Subsumption #1410
Conversation
…pending on its type; also removed old PPInfo-related code
…ion of contained lifetimes, along with an lfinished permission
…on before eliminating it and would then go right back to trying to eliminate that same permission again...
…lock permission; changed proveVarLLVMBlocks to focus first on eliminating memblock permissions on the left that overlap with but are not contained in memblock permissions on the right
…are trying to prove on the right
…n empty block perm on the right
…s a tagged union type where we already know from something on the left what the tag is, in which case we can avoid searching for proofs of all the disjuncts other than the one that matches that known tag
…ence shape sh;emptysh with the empty shape when necessary
…rover-improvements
…rover-improvements
…y two separate functions, all of which now take lists of multi-bindings instead of multi-bindings of lists
…fetime-subsumption
…ded helper function implPushCopyM
…fied lowned permission, along with all the new and modified rules; also removed a bunch of whitespace from a previous commit
…n-empty contained lifetimes
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 don't understand the algorithm well enough to have a useful opinion about how sound the implementation is, so I can't weigh in on that. (I don't think that's what you're looking for from me, either).
From a code perspective things seem good other than the parser comment I made above.
This code seems to have a copy of the previous PR included which makes me worry that it's out of sync with master. (and which made doing the review a bit trickier)
A key aspect of lifetimes is the ability to have one lifetime contain in another, i.e., to have the bigger lifetime subsume the smaller one. Previously, the way this was modeled in Heapster was to put the
lowned
permissions of the bigger lifetimel1
inside thelowned
permissions of the smaller lifetimel2
, i.e., to represent subsumption by having a permission likel2 : lowned (ps_in2 -o ps_out2, l1:lowned (ps_in1 -o ps_out1))
The idea is that
l1
subsumingl2
means you can't endl1
until after you endl2
. Unfortunately, this gets gross, because you have implications inside implications. Further, it means you can't have a bigger lifetime subsume multiple smaller lifetimes, which is actually useful and possibly necessary in a lot of case for, e.g., Rust code.Luckily, I recently worked out the semantics of a lifetime ownership permission of the form
l1 : lowned [ls] (ps_in1 -o ps_out1)
where
ls
is a list of lifetimes that are subsumed inside ofl1
. Lifetimel1
cannot be ended unlessls
is empty, but a subsumed lifetime inls
can be removed from thelowned
permission ofl1
once it has finished. To indicate that a lifetime inls
has finished, we also include a new permission constructl2 : lfinished
along with an implication rule that allows a lifetime in the
ls
of an ownership permission to be removed if it has finished.This approach solves the above problems, because
lowned
permissions no longer contain otherlowned
permissions and because lifetimes can now contain more than one subsumed lifetime. Further, it makes lifetime permissions more compositional, allowing the implication prover to deal with different lifetimes separately.Note that this PR is based on #1406, and so should wait for that PR to be merged before it is merged.