Skip to content
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

Generalized Heapster lifetime ownership permissions #1645

Merged
merged 28 commits into from
Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
65eb3b9
changed lowned permissions to allow arbitrary input and output permis…
Apr 15, 2022
2179df3
trying to work out how to rewrite solveForPermImpl...
Apr 18, 2022
66bcaf6
figured out an idea for how to make solveForPermListImpl work with ar…
Apr 19, 2022
4f22af4
Merge branch 'master' into heapster/perms-in-lowneds
Apr 21, 2022
b4c4c7f
got Implication.hs to compile (modulo some fixmes) with the new lowne…
Apr 21, 2022
2def0af
implemented mbRangeFTsSubsetTo
Apr 21, 2022
771d8a1
fixed a non-exhaustive pattern-match
Apr 21, 2022
084cd18
finished implementing neededPermsForRanges
Apr 21, 2022
3fa5fc2
implemented getExprRanges
Apr 21, 2022
5a6ceb5
updated RustTypes.hs to work with the newly generalized lowned permis…
Apr 22, 2022
3e94a8f
fixed compiler errors in TypeChecker.hs
Apr 22, 2022
0cb6e72
fixed TypedCrucible.hs with the new lowned permission changes
Apr 22, 2022
a46c26c
updated SAWTranslation.hs for the lowned permission changes
Apr 22, 2022
102aac5
finished updating IRTTranslation.hs for new lowned permissions
Apr 22, 2022
56fba25
bug fix: incorrect modalization computation in the output permissions…
Apr 22, 2022
e77ad23
bug fix: translating ExprPerms should go via DistPerms
Apr 22, 2022
94a5e77
Merge branch 'master' into heapster/perms-in-lowneds
Apr 22, 2022
849bc42
fixed bugs in callBlockWithPerms and in how it was being called in tc…
Apr 22, 2022
a9139e0
added a fixme for later
Apr 23, 2022
50e0f7f
changed recombinePerm to drop extra eq permissions rather than raise …
Apr 23, 2022
d60ac4f
changed lifetimesTheCouldProve so that it does not suggest ending a l…
Apr 25, 2022
c03992f
added list64_head_mut example to rust_data.rs
Apr 26, 2022
d5cb5a6
changed all ExprPerm manipulation to go through DistPerms
Apr 26, 2022
898e97a
bug fix in solveForPermListImpl: changed it to apply the offsets that…
Apr 26, 2022
4ef466f
whoops, last commit forgot erased the casts of the LHS and RHS permis…
Apr 26, 2022
ab7eb5a
changed proveNeededVars to also prove any permissions on variables y …
Apr 26, 2022
fc750da
fixed up some comments
Apr 27, 2022
bf1d799
Merge branch 'master' into heapster/perms-in-lowneds
Apr 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified heapster-saw/examples/rust_data.bc
Binary file not shown.
8 changes: 8 additions & 0 deletions heapster-saw/examples/rust_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,14 @@ pub fn list64_sum(l:&List64) -> u64 {
}
}

/* Return a mutable reference to the head of a list, or None if it is empty */
pub fn list64_head_mut <'a> (l:&'a mut List64) -> Option<&'a mut u64> {
match l {
List64::Nil64 => None,
List64::Cons64 (h,_) => Some (h),
}
}

/* Find an element in a List64 and return a mutable reference to it */
pub fn list64_find_mut <'a> (x:u64, l:&'a mut List64) -> Option<&'a mut u64> {
match l {
Expand Down
12 changes: 12 additions & 0 deletions heapster-saw/examples/rust_data.saw
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,17 @@ list64_tail_sym <- heapster_find_symbol env "11list64_tail";
heapster_typecheck_fun_rename env list64_tail_sym "list64_tail"
"<> fn (l:List64) -> Option<List64>";

// list64_head_mut
list64_head_mut_sym <- heapster_find_symbol env "15list64_head_mut";
heapster_typecheck_fun_rename env list64_head_mut_sym "list64_head_mut"
"<'a> fn (l:&'a mut List64) -> Option<&'a mut u64>";

// list64_find_mut
list64_find_mut_sym <- heapster_find_symbol env "15list64_find_mut";
heapster_typecheck_fun_rename env list64_find_mut_sym "list64_find_mut"
"<'a> fn (x:u64, l:&'a mut List64) -> Option<&'a mut u64>";

/*
hash_map_insert_gt_to_le_sym <- heapster_find_symbol env "hash_map_insert_gt_to_le";
heapster_typecheck_fun_rename
env hash_map_insert_gt_to_le_sym
Expand Down Expand Up @@ -628,6 +639,7 @@ heapster_set_translation_checks env false;
list20_head_sym <- heapster_find_symbol env "11list20_head";
heapster_typecheck_fun_rename env list20_head_sym "list20_head"
"<'a> fn (x:&'a List20<List<u64>>) -> &'a List<u64>";
*/


/***
Expand Down
13 changes: 13 additions & 0 deletions heapster-saw/src/Verifier/SAW/Heapster/CruUtil.hs
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,19 @@ cruCtxReplicate n tp =
| Some ctx <- cruCtxReplicate (predNat n) tp
-> Some (CruCtxCons ctx tp)

-- | A representation of a context of types as a sequence of 'KnownRepr'
-- instances
--
-- FIXME: this can go away when existentials take explicit 'TypeRepr's instead
-- of 'KnownRepr TypeRepr' instances, as per issue #79
type KnownCruCtx = RAssign (KnownReprObj TypeRepr)

-- | Convert a 'KnownCruCtx' to a 'CruCtx'
knownCtxToCruCtx :: KnownCruCtx ctx -> CruCtx ctx
knownCtxToCruCtx MNil = CruCtxNil
knownCtxToCruCtx (ctx :>: KnownReprObj) =
CruCtxCons (knownCtxToCruCtx ctx) knownRepr


----------------------------------------------------------------------
-- * Misc Operations on Crucible Objects
Expand Down
12 changes: 6 additions & 6 deletions heapster-saw/src/Verifier/SAW/Heapster/IRTTranslation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ instance ContainsIRTRecName (AtomicPerm a) where
containsIRTRecName n (Perm_NamedConj _ args _) = containsIRTRecName n args
containsIRTRecName n (Perm_LLVMFrame fperm) =
containsIRTRecName n (map fst fperm)
containsIRTRecName _ (Perm_LOwned _ _ _) = False
containsIRTRecName _ (Perm_LOwnedSimple _) = False
containsIRTRecName _ (Perm_LOwned _ _ _ _ _) = False
containsIRTRecName _ (Perm_LOwnedSimple _ _) = False
containsIRTRecName _ (Perm_LCurrent _) = False
containsIRTRecName _ Perm_LFinished = False
containsIRTRecName n (Perm_Struct ps) = containsIRTRecName n ps
Expand Down Expand Up @@ -414,9 +414,9 @@ instance IRTTyVars (AtomicPerm a) where
[nuMP| Perm_NamedConj npn args off |] ->
namedPermIRTTyVars mb_p npn args off
[nuMP| Perm_LLVMFrame _ |] -> return ([], IRTVarsNil)
[nuMP| Perm_LOwned _ _ _ |] ->
[nuMP| Perm_LOwned _ _ _ _ _ |] ->
throwError "lowned permission in an IRT definition!"
[nuMP| Perm_LOwnedSimple _ |] ->
[nuMP| Perm_LOwnedSimple _ _ |] ->
throwError "lowned permission in an IRT definition!"
[nuMP| Perm_LCurrent _ |] -> return ([], IRTVarsNil)
[nuMP| Perm_LFinished |] -> return ([], IRTVarsNil)
Expand Down Expand Up @@ -664,9 +664,9 @@ instance IRTDescs (AtomicPerm a) where
([nuMP| Perm_NamedConj npn args off |], _) ->
namedPermIRTDescs npn args off ixs
([nuMP| Perm_LLVMFrame _ |], _) -> return []
([nuMP| Perm_LOwned _ _ _ |], _) ->
([nuMP| Perm_LOwned _ _ _ _ _ |], _) ->
error "lowned permission made it to IRTDesc translation"
([nuMP| Perm_LOwnedSimple _ |], _) ->
([nuMP| Perm_LOwnedSimple _ _ |], _) ->
error "lowned permission made it to IRTDesc translation"
([nuMP| Perm_LCurrent _ |], _) -> return []
([nuMP| Perm_LFinished |], _) -> return []
Expand Down
826 changes: 497 additions & 329 deletions heapster-saw/src/Verifier/SAW/Heapster/Implication.hs

Large diffs are not rendered by default.

Loading