-
Notifications
You must be signed in to change notification settings - Fork 274
Symex code_deadt: always use L2 generation zero #4407
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
Symex code_deadt: always use L2 generation zero #4407
Conversation
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: c5ef60b).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/104955360
The string solver was consuming a very large amount of memory with the limit set to 10000; this appears to be pure chance whether the solver picks a solution requiring universals to be instantiated a large number of times. The other tests in this directory are already set to limit string length to 1000, so I just do the same thing here.
This means that merge_goto's special merge logic for generation zero works on both dead local variables and on #return_value global variables defined for the second and subsequent times, discounting the control-flow where the variable is dead.
c5ef60b
to
d201bad
Compare
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: d201bad).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/105014174
/// Drops an L1 name from the local L2 map | ||
void drop_l1_name(const irep_idt &l1_identifier) | ||
{ | ||
level2.current_names.erase(l1_identifier); |
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 would think these methods should belong to the symex_level2t
class
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'll keep it alongside its close cousin increase_generation
for now; if we want to refactor we should do them together (I don't mind either way)
Now that we have #4199 and so decreasing the L2 generation number during symex is no longer a problem, we can simply use L2 generation 0 to represent all dead variables. Direct reads while the variable is certainly dead will still yield a nondet value, as generation 0 is never defined, while
merge_goto
's special-casing of generation 0 (0 MERGE N == N for any nonzero generation N) can optimise the case where paths featuring a dead variable converge with those where it is still live, similar to how it already handles paths where a variable was not declared.This is particularly useful for Java functions that throw, as symex will assume that code using
#return_value
flows from paths where it was defined (i.e. the normal return path), rather than considering the case where it is not defined (the exception-throwing path).