RFR: 8350563: C2 compilation fails because PhaseCCP does not reach a fixpoint [v6]

Christian Hagedorn chagedorn at openjdk.org
Thu Mar 20 14:32:38 UTC 2025


On Wed, 19 Mar 2025 16:18:33 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:

>> Hello, please consider this fix for [JDK-8350563](https://bugs.openjdk.org/browse/JDK-8350563) contributed by my colleague Matthias Ernst.
>> 
>> https://github.com/openjdk/jdk/pull/22856 introduced a new `Value()` optimization for the pattern `AndIL(Con, Mask)`.
>> This optimization can look through CastNodes, and therefore requires additional logic in CCP to push these
>> transitive uses to the worklist.
>> 
>> The optimization is closely related to analogous optimizations for SHIFT nodes, and we also extend the existing logic for
>> CCP worklist handling: the current logic is "if the shift input to a SHIFT node changes, push indirect AND node uses to the CCP worklist".
>> We extend it by adding "if the (new) type of a node is an IntegerType that `is_con, ...` to the predicate.
>
> Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update test/hotspot/jtreg/compiler/ccp/TestAndConZeroCCP.java
>   
>   Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>

There was a test failure in a bigger test that I cannot share. But I was able to extract a simple reproducer:


public class Test {

    public static void main(String[] args) {
        test();
    }

    static void test() {
        Integer.parseInt("1");
    }
}

Run with (might need to run multiple times or increase `RepeatCompilation` count since it is dependent on the seed):

java -XX:RepeatCompilation=300 -XX:+StressIGVN -XX:+StressCCP -Xcomp -XX:CompileOnly=*Integer::parseInt Test.java

Output:

  304  ConI  === 0  [[ 506 ]]  #int:255
  996  CastII  === 461 453  [[ 557 546 535 524 1034 506 ]]  #int:-256..127 extra types: {0:int:-256} strong dependency !orig=[478] !jvms: Integer::parseInt @ bci:144 (line 550)
  506  AndI  === _ 996 304  [[ 507 ]]  !jvms: Integer::parseInt @ bci:170 (line 552)
told = int:0
tnew = top
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/2a0767be-5c1b-4719-9b4f-f71b11137965-S769/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/1111ed35-4920-43a2-b273-caace0afc18d/runs/09365b8c-550a-453d-9bbb-ff3c7dc04263/workspace/open/src/hotspot/share/opto/phaseX.cpp:1790), pid=196209, tid=196227
#  fatal error: Not monotonic
#
# JRE version: Java(TM) SE Runtime Environment (25.0) (fastdebug build 25-internal-LTS-2025-03-19-2013139.christian.hagedorn.jdk-test)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 25-internal-LTS-2025-03-19-2013139.christian.hagedorn.jdk-test, compiled mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x16a26c9]  PhaseCCP::verify_type(Node*, Type const*, Type const*)+0x169

-------------

PR Comment: https://git.openjdk.org/jdk/pull/23871#issuecomment-2740654541


More information about the hotspot-compiler-dev mailing list