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

Heapster permIndicesForProvingOffset using llvmPermContainsArray #1536

Merged
merged 1 commit into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion heapster-saw/src/Verifier/SAW/Heapster/Implication.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4770,7 +4770,7 @@ permIndicesForProvingOffset ps imprecise_p off =
let ixs_holdss = flip findMaybeIndices ps $ \p ->
case llvmPermContainsOffset off p of
Just (_, True) -> Just True
Just _ | isLLVMArrayPerm p && imprecise_p -> Just False
Just _ | llvmPermContainsArray p && imprecise_p -> Just False
_ -> Nothing in
case find (\(_,holds) -> holds) ixs_holdss of
Just (i,_) -> [i]
Expand Down
13 changes: 13 additions & 0 deletions heapster-saw/src/Verifier/SAW/Heapster/Permissions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3733,6 +3733,19 @@ llvmAtomicPermEndOffset p =
llvmAtomicPermRange :: AtomicPerm (LLVMPointerType w) -> Maybe (BVRange w)
llvmAtomicPermRange p = fmap llvmBlockRange $ llvmAtomicPermToBlock p

-- | Test if an LLVM atomic permission contains some range of offsets that have
-- an array shape
llvmPermContainsArray :: AtomicPerm (LLVMPointerType w) -> Bool
llvmPermContainsArray (Perm_LLVMArray _) = True
llvmPermContainsArray (Perm_LLVMBlock bp) =
shapeContainsArray $ llvmBlockShape bp where
shapeContainsArray :: PermExpr (LLVMShapeType w) -> Bool
shapeContainsArray (PExpr_ArrayShape _ _ _) = True
shapeContainsArray (PExpr_SeqShape sh1 sh2) =
shapeContainsArray sh1 || shapeContainsArray sh2
shapeContainsArray _ = False
llvmPermContainsArray _ = False

-- | Set the range of an 'LLVMBlock'
llvmBlockSetRange :: LLVMBlockPerm w -> BVRange w -> LLVMBlockPerm w
llvmBlockSetRange bp (BVRange off len) =
Expand Down