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

Undo unsound change to getValue #208

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Undo unsound change to getValue #208

wants to merge 3 commits into from

Conversation

wmdietl
Copy link
Member

@wmdietl wmdietl commented Apr 2, 2022

When boxing primitive values, an artificial call like Integer.valueOf(arg) is created in the CFG.
The tree arg then maps to the post-conversion node.
The first iteration to the CFG will not find a value for arg and the previous change to getValue then uses the pre-conversion node instead.

In the test case, this only happens in simple CFGs and switching pre- and post-conversion nodes has no impact.
However, if a fix-point iteration is necessary, this can lead to using the post-conversion value as argument to valueOf, which is wrong.

This PR introduces a new temporary variable to hold the argument to valueOf, to ensure they are not mixed up.
However, this has a large performance overhead: checker/tests/all-systems/Issue301.java on my system now takes more than double the time to check, with both the Nullness and Signedness Checkers.

Items:

  • Write a test type system where Integer.valueOf takes one type and returns an incompatible different type. Write a test case that requires a fix-point iteration and see whether this exposes the problem with the original code.
  • See whether there is a more efficient way to achieve sound behavior
  • The code in CFGTranslationPhaseOne is very similar to other code for new temporary variables. See how to extract this into a helper function.

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.

None yet

1 participant