[9] RFR (XS): 8153357: C2 creates incorrect cast after eliminating phi with unique input

Zoltán Majó zoltan.majo at oracle.com
Thu Apr 14 13:21:00 UTC 2016


Hi,


please review the patch for 8153357.

https://bugs.openjdk.java.net/browse/JDK-8153357

Problem: When determining the unique input of a phi, the C2 compiler 
removes cast nodes connecting the phi to its unique input.
http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/a76d63163758/src/share/vm/opto/cfgnode.cpp#l1181

Then (if the phi has indeed a unique input), the C2 compiler attempts 
replace the phi with a cast node. The new cast node feeds from the 
unique input.

To be able to remove the phi node, the C2 compiler must  to determine 
the type of cast to add in place of the phi node (CastII, CastPP, or 
CheckCastPP).
http://hg.openjdk.java.net/jdk9/hs-comp/hotspot/file/a76d63163758/src/share/vm/opto/cfgnode.cpp#l1705

The failure in the bug report appears because the C2 compiler adds a 
cast node of unexpected type to the graph (a CheckCastPP instead of a 
CastPP when casting between two klass pointers).

Please find more details about the cause of the failure in the bug 
description:
https://bugs.openjdk.java.net/browse/JDK-8153357?focusedCommentId=13927108&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13927108


Solution: Refine C2's logic to determine the type of cast node added.

Webrev:
http://cr.openjdk.java.net/~zmajo/8153357/webrev.00/

Testing:
- JPRT;
- all hotspot compiler tests with RBT (-Xmixed, -Xcomp);
- 500 non-failing runs with the reproducer (the problem reproduces with 
< 100 runs).

Thank you and best regards,


Zoltan



More information about the hotspot-compiler-dev mailing list