Skip to content

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

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Mar 19, 2019

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).

Copy link
Contributor

@allredj allredj left a 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

smowton added 2 commits March 19, 2019 18:20
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.
@smowton smowton force-pushed the smowton/feature/dead-always-uses-generation-zero branch from c5ef60b to d201bad Compare March 19, 2019 18:20
Copy link
Contributor

@allredj allredj left a 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

@peterschrammel peterschrammel removed their assignment Mar 19, 2019
/// Drops an L1 name from the local L2 map
void drop_l1_name(const irep_idt &l1_identifier)
{
level2.current_names.erase(l1_identifier);
Copy link
Contributor

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

Copy link
Contributor Author

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)

@smowton smowton merged commit ed7a3ba into diffblue:develop Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants