Model Object.clone() in PTA for better precision for may-fail-cast#209
Open
jjppp wants to merge 2 commits intopascal-lab:masterfrom
Open
Model Object.clone() in PTA for better precision for may-fail-cast#209jjppp wants to merge 2 commits intopascal-lab:masterfrom
Object.clone() in PTA for better precision for may-fail-cast#209jjppp wants to merge 2 commits intopascal-lab:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #209 +/- ##
============================================
- Coverage 75.69% 75.68% -0.01%
- Complexity 4668 4669 +1
============================================
Files 482 483 +1
Lines 16147 16153 +6
Branches 2203 2204 +1
============================================
+ Hits 12222 12225 +3
- Misses 3059 3061 +2
- Partials 866 867 +1
🚀 New features to boost your workflow:
|
Contributor
silverbullettt
left a comment
There was a problem hiding this comment.
It's unlikely that we'll be adding other methods to the native model of the Object class. How about renaming it to ObjectCloneModel to make its meaning clearer?
9381c90 to
2b58e36
Compare
Member
Author
|
I have renamed |
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.
Currently,
Object.clone()is modeled viaDefaultNativeModel, which generates a plain return as the method body. This modeling, though general, is not suitable for pointer analysis, as it requires extra level of context-sensitivity to distinguish incoming and outcoming object flows.By modeling
Object.clone()using theIRModelPlugin, we can obtain better precision formay-fail-castwhen analyzing programs context-insensitively.This is because the return type of
clone()the method isjava.lang.Object, and its invocations are often invoked and then cast into the correct type to be used later, as in the following example from jdk17.https://github.com/openjdk/jdk17u/blob/30ef840c3736270330fc0a26849c2456406facfe/src/java.base/share/classes/java/util/IdentityHashMap.java#L704-L713
On five benchmarks (
antlr,bloat,jedit-3.0,columba-1.4, andbriss-0.9from java-benchmarks) we achieve an average reduction of 148 casts that may fail when analyzed context-insensitively, with slightly better precision on other analysis metrics.Diff for master and object-clone-model