Repository navigation
goto-symex: drop the field names of parameters when a function returns - #9634
Draft
tautschnig wants to merge 1 commit into
Draft
tautschnig wants to merge 1 commit into
tautschnig wants to merge 1 commit into
Conversation
When a function returns, pop_frame drops the L2 names of its local objects so that later merges of paths do not assign them. It looks the objects up by their own L1 name, but field sensitivity gives a struct (or an array of at most --max-field-sensitivity-array-size elements) one L2 name per field and none for the whole object. The fields of struct parameters, which never have a DEAD instruction, therefore stayed live for the rest of symbolic execution, and every later merge where one path had called the function assigned each of them again (a phi step per field and merge). DEAD had a smaller gap of the same kind: it dropped the members of a union but not the union's own name, which field sensitivity also tracks. pop_frame now also drops the names of the fields of the frame's objects that field sensitivity divides, as DEAD does, except for objects whose address is taken: string abstraction returns pointers to local dummy objects and reads them after the function returned (regression/cbmc String_Abstraction19 and Malloc13 fail otherwise). DEAD also drops the own name of a divided union. Programs that pass structs by value to functions called on some paths only gain most. A C program that calls a function with a struct parameter (a tag, a union and a pointer) on some paths of a loop of 100 iterations takes 2,730 instead of 3,330 SSA steps. A Lua front end built on CBMC, whose runtime model passes a struct of ten L2 names to most of its functions, saw 13 % to 59 % fewer steps on six small programs with symbolic table keys (a weak table: 330,266 to 177,217 steps; symbolic appends: 221,728 to 108,752). regression/cbmc/dead-field-names checks that no merge assigns the fields of a returned parameter or of a dead local union (test.desc fails on develop; verify.desc checks the verdict). scripts/profile_cbmc.py --auto-large --runs 3: the same steps on all ten benchmarks; pre-solver time -1.5 % to +25.5 % across runs in both orders on a host shared with other jobs (load 7 to 23), within its noise. regression/cbmc (also with --paths lifo), cbmc-concurrency, cbmc-cpp, cbmc-cover, cbmc-shadow-memory and cbmc-primitives pass with --validate-goto-model --validate-ssa-equation; cbmc-library's mmap/test, mmap/test_02 and munmap/test fail with these options, as on develop. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a function returns, pop_frame drops the L2 names of its local objects so that later merges of paths do not assign them. It looks the objects up by their own L1 name, but field sensitivity gives a struct (or an array of at most --max-field-sensitivity-array-size elements) one L2 name per field and none for the whole object. The fields of struct parameters, which never have a DEAD instruction, therefore stayed live for the rest of symbolic execution, and every later merge where one path had called the function assigned each of them again (a phi step per field and merge). DEAD had a smaller gap of the same kind: it dropped the members of a union but not the union's own name, which field sensitivity also tracks.
pop_frame now also drops the names of the fields of the frame's objects that field sensitivity divides, as DEAD does, except for objects whose address is taken: string abstraction returns pointers to local dummy objects and reads them after the function returned (regression/cbmc String_Abstraction19 and Malloc13 fail otherwise). DEAD also drops the own name of a divided union.
Programs that pass structs by value to functions called on some paths only gain most. A C program that calls a function with a struct parameter (a tag, a union and a pointer) on some paths of a loop of 100 iterations takes 2,730 instead of 3,330 SSA steps. A Lua front end built on CBMC, whose runtime model passes a struct of ten L2 names to most of its functions, saw 13 % to 59 % fewer steps on six small programs with symbolic table keys (a weak table: 330,266 to 177,217 steps; symbolic appends: 221,728 to 108,752).
regression/cbmc/dead-field-names checks that no merge assigns the fields of a returned parameter or of a dead local union (test.desc fails on develop; verify.desc checks the verdict).
scripts/profile_cbmc.py --auto-large --runs 3: the same steps on all ten benchmarks; pre-solver time -1.5 % to +25.5 % across runs in both orders on a host shared with other jobs (load 7 to 23), within its noise.
regression/cbmc (also with --paths lifo), cbmc-concurrency, cbmc-cpp, cbmc-cover, cbmc-shadow-memory and cbmc-primitives pass with --validate-goto-model --validate-ssa-equation; cbmc-library's mmap/test, mmap/test_02 and munmap/test fail with these options, as on develop.