-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8316533: C2 compilation fails with assert(verify(phase)) failed: missing Value() optimization #16361
Conversation
👋 Welcome back epeter! A progress list of the required criteria for merging this PR into |
Webrevs
|
|
||
package compiler.types; | ||
|
||
public class TestSubTypeOfAsbtractClass { |
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:
public class TestSubTypeOfAsbtractClass { | |
public class TestSubTypeOfAbstractClass { |
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 had copied the mistake from the other test: TestSubTypeOfAsbtractClassWrongResult.java
* @bug 8316533 | ||
* @summary Oop of abstract class A is subtype checked after null-check | ||
* @requires vm.compiler2.enabled | ||
* @run main/othervm -XX:CompileCommand=printcompilation,*A::test |
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.
-XX:CompileCommand=printcompilation,*A::test
is unnecessary.
|
||
|
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.
Please remove these extra line breaks.
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.
Looks good, I just have a few minor comments and style suggestions.
@eme64 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 8 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
From Roberto Co-authored-by: Roberto Castañeda Lozano <robcasloz@users.noreply.github.com>
|
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.
Looks good to me. @rwestrel should take a look as well.
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.
Looks reasonable to me.
Thanks @TobiHartmann @robcasloz @rwestrel for the reviews! |
Going to push as commit b5c863b.
Your commit was automatically rebased without conflicts. |
Problem
We have a
abstract
classA
with no subtype. Hence, a reference of typeA
must always benull
(unless a subclass were to be loaded, which we guard against with a compile dependency).But there are at least these two ways a
A:NotNull
can be created:A
toA:NotNull
.A
. ThenParm0
has typeA
, which is improved toA:NotNull
because thethis/self
pointer cannot benull
.This means we are now left with an impossible type
A:NotNull
, a path that uses this type will never be executed.The question is now what should happen at a
SubTypeCheck
if we do:SubTypeCheck( oop #A:NotNull , constant-classptr-A-exact )
The verification happens because we do these two different things:
SubTypeCheck
: we first detect that we have a constant classptr of a classA
, which is abstract and has no subtype. Hence, we conclude that any oop compared to it cannot be a subtype (there are no subtypes), and it cannot be of the same type (class is abstract). Hence, any oop must be a supertype (TypeInt::CC_GT).LoadKlass
(this constant folds toconstant-classptr-A-exact
, because the type of the oop isA:NotNull
). TheCmpP
node compares the two klasses, and sees that they are identical, and returns anTypeInt::CC_EQ
.Alternatives
Both results are reasonable, but they are in fact both supersets of the true result. We should take the intersection of the two and get
Type:TOP
, since the input type is already impossible. In fact, it would be best if the impossible type was never created. We could do that by improvingCmpP
to detect the impossible type and constant fold towards thenull
path, removing theA:NotNull
path. It is harder to deal with the forced-compilation of non-static methods of an abstract class with no subclasses - here we would basically have to forbid compilation or replace the compilation with aHalt
.Solution
Instead, I have now decided to change the logic in
SubTypeCheckNode
to returnEQ
in case the oop has the same klass and isNotNull
.Testing
Tier1-6 and stress testing. Running...
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16361/head:pull/16361
$ git checkout pull/16361
Update a local copy of the PR:
$ git checkout pull/16361
$ git pull https://git.openjdk.org/jdk.git pull/16361/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 16361
View PR using the GUI difftool:
$ git pr show -t 16361
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16361.diff
Webrev
Link to Webrev Comment