-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Nullness Analysis for GenBCode #4519
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
Tracks nullness of values using an ASM analyzer. Tracking nullness requires alias tracking for local variables and stack values. For example, after an instance call, local variables that point to the same object as the receiver are treated not-null.
When inlining an instance call, the inliner has to ensure that a NPE is still thrown if the receiver object is null. By using the nullness analysis, we can avoid emitting this code in case the receiver object is known to be not-null.
Address feedback in scala#4516 / 57b8da4. Save allocations of NullnessValue - there's only 4 possible instances. Also save tuple allocations in InstructionStackEffect.
|
Review by @retronym. I looked through the test failures of the I will submit fixes to this build separately, there are several reasons it regressed. The main one is that since a40ee59, the |
|
|
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.
typo "Extendsions"
|
pushed two more commits |
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 can't see anything in the JVM spec that prohibits reassignment of the this parameter, (even thought Javac and Scalac would never emit such code.)
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.
2.6.1 Local Variables
...
The Java Virtual Machine uses local variables to pass parameters on method invocation. On class method invocation, any parameters are passed in consecutive local variables starting from local variable 0. On instance method invocation, local variable 0 is always used to pass a reference to the object on which the instance method is being invoked (this in the Java programming language). Any parameters are subsequently passed in consecutive local variables starting from local variable 1.astore Store reference into local variable
...
The index is an unsigned byte that must be an index into the local variable array of the current frame (§2.6)
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.
Thanks, that's a good point. The code here is correct because only sets the initial value of the local variable 0. If it is re-assigned within a method, its nullness will be updated in the frame after the store instruction.
|
LGTM |
Nullness Analysis for GenBCode
Re-submission of #4516, but target 2.11.x
Early review feedback integrated (in new commits).