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

Updating the output type of alloca in heapster #1491

Merged
merged 9 commits into from
Nov 13, 2021
Merged

Conversation

jpaykin
Copy link
Contributor

@jpaykin jpaykin commented Oct 29, 2021

The alloca command was previously given the following heapster return type:

                  ret:ptr((W,0) |-> true, (W,M) |-> true, (W,2*M) |-> true,
                          ..., (w, (i-1)*M, 8*(sz-(i-1)*M)) |-> true)

which indicated a block of size sz broken up into chunks of size M. However, this produced undesired behavior when allocating data structures whose fields were not all the same size, such as structs. This update gives alloca an unstructured return type described as a memblock:

                 ret:memblock(W,0,sz,emptysh)

This branch is work in progress as I ensure all heapster examples pass and that the change can correctly interpret fields.

@jpaykin jpaykin added the subsystem: heapster Issues specifically related to memory verification using Heapster label Oct 29, 2021
@jpaykin
Copy link
Contributor Author

jpaykin commented Oct 29, 2021

This branch passes all the tests in the saw/script/heapster/saw/examples directory except for arrays.saw:

"heapster_typecheck_fun" (/home/jennifer/work/PICARD/saw-script/heapster-saw/examples/arrays.saw:44:1-44:23):
Inferred type
  sort 1
Not a subtype of expected type
  sort 0
For term
  sort 0

The code referenced is the following call to heapster_typecheck_fun:

heapster_typecheck_fun env "sum_2d"
  "(l1:bv 64,l2:bv 64). arg0:array(W,0,<l1,*8,fieldsh(array(W,0,<l2,*8,fieldsh(int64<>)))), \
                      \ arg1:eq(llvmword(l1)), arg2:eq(llvmword(l2)) -o \
                      \ arg0:array(W,0,<l1,*8,fieldsh(array(W,0,<l2,*8,fieldsh(int64<>)))), \
                      \ arg1:true, arg2:true, ret:int64<>";

@jpaykin jpaykin changed the title WIP: Updating the output type of alloca in heapster Updating the output type of alloca in heapster Nov 5, 2021
Copy link
Contributor

@eddywestbrook eddywestbrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, this looks great! Though we do have to wait for #1496 to get merged before this one.

@jpaykin jpaykin added the PR: ready to merge Magic flag for pull requests to ask Mergify to merge given an approval and a successful CI run label Nov 12, 2021
@mergify mergify bot merged commit 486dd18 into master Nov 13, 2021
@mergify mergify bot deleted the heapster-alloca branch November 13, 2021 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: ready to merge Magic flag for pull requests to ask Mergify to merge given an approval and a successful CI run subsystem: heapster Issues specifically related to memory verification using Heapster
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants