Skip to content

Remove exceptions pass: introduce per-function operation #1721

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 Jan 10, 2018

Depends on #1719; please only review the second commit.

This introduces a per-function entry point for remove-exceptions. Unlike the PR for remove-virtual-functions I don't actually use it yet because it does result in more unreachable code; I'll enable this only when lazy-loading v2 (symex-driven function loading) is enabled.

Therefore don't merge this yet since it isn't tested, but this PR provides an easy place to review the change in isolation.

This replaces function_name#exception_value with a single java::@inflight_exception variable.
No more than one #exception_value variable could be populated at any given time in any case;
this reduces the number of globals introduced, and as an added bonus will make it easier to
write a per-function version of remove_exceptions.
This removes high-level exception-related instructions from a single function,
at the cost of some accuracy as we can no longer analyse other functions to
determine whether or not they may throw, and therefore always assume they will.
@tautschnig
Copy link
Collaborator

Is this code already being exercised by tests? Else, would it be possible to add some tests? Extra brownie points for making the imprecision show up in the test (for example, by outputting the goto program).

@smowton
Copy link
Contributor Author

smowton commented Jan 11, 2018

No, but it will be when the lazy-loading-via-symex PR arrives. At that point I'll add tests for exceptions+lazy-loading-v2, since that'll be the primary user. This PR is basically to provide a place to review this change in isolation.

@tautschnig
Copy link
Collaborator

FWIW: looks ok to me, save for the required rebase (which will make Doxygen on Travis happy) and the linter issue.

Copy link
Contributor

@thk123 thk123 left a comment

Choose a reason for hiding this comment

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

Looks good. Of course if you want to test dead code, you could always write a unit test for some sample GOTO programs 😇

/// Note this is somewhat less accurate than the whole-goto-model version,
/// because we can't inspect other functions to determine whether they throw
/// or not, and therefore must assume they do and always introduce post-call
/// exception dispatch.
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider explaining why we would use this version vs. the more precise version above?

@smowton
Copy link
Contributor Author

smowton commented Jan 11, 2018

CBA, sorry ;) The lazy loading v2 tests should incorporate this; I'll add units too if at that point we still think test coverage is weak.

@smowton
Copy link
Contributor Author

smowton commented Mar 23, 2018

Subsumed by #1759

@smowton smowton closed this Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants