Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8308103

Massive (up to ~30x) increase in C2 compilation time since JDK 17

    XMLWordPrintable

Details

    • b07

    Backports

      Description

        I noticed that attached JavaFuzzer generated test runs significantly longer with -Xcomp due to an increase in compilation time with C2.

        Command line:
        java -Xmx1G -Xcomp -Xbatch -XX:CompileOnly=Test -XX:MaxRAMPercentage=4.16667 Test

        JDK 16
        real 0m0,383s
        user 0m0,326s
        sys 0m0,029s

        JDK 17+23 (contains JDK-8252372)
        real 0m0,483s
        user 0m0,421s
        sys 0m0,032s

        JDK 17+35
        real 0m4,388s
        user 0m4,310s
        sys 0m0,056s

        JDK 18 and later
        real 0m10,312s
        user 0m10,116s
        sys 0m0,140s

        With 5s test timeout it fails since JDK-8267988 in JDK 17 b27.
        With 8s test timeout it fails since JDK-8272873 in JDK 18 b13.

        We seem to spend most time in here:

        #0 0x00007ffff70d9608 in Unique_Node_List::remove (n=<optimized out>, this=<optimized out>) at /oracle/valhalla/open/src/hotspot/share/opto/node.hpp:1590
        #1 Unique_Node_List::remove (this=0x7fffac2ede30, n=0x7fffae517ae0) at /oracle/valhalla/open/src/hotspot/share/opto/node.cpp:2944
        #2 0x00007ffff64ea758 in Compile::remove_modified_node (n=0x7fffae517ae0, this=0x7fffd47d4a30) at /oracle/valhalla/open/src/hotspot/share/opto/compile.cpp:1237
        #3 Compile::remove_useless_node (this=0x7fffd47d4a30, dead=0x7fffae517ae0) at /oracle/valhalla/open/src/hotspot/share/opto/compile.cpp:374
        #4 0x00007ffff71e9ceb in PhaseIterGVN::remove_globally_dead_node (this=this@entry=0x7fffd47d23f0, dead=dead@entry=0x7fffae517ae0) at /oracle/valhalla/open/src/hotspot/share/opto/phaseX.cpp:1442
        #5 0x00007ffff71eae1e in PhaseIterGVN::remove_dead_node (dead=0x7fffae517ae0, this=0x7fffd47d23f0) at /oracle/valhalla/open/src/hotspot/share/opto/phaseX.hpp:507
        #6 PhaseIterGVN::subsume_node (this=0x7fffd47d23f0, old=0x7fffae517ae0, nn=0x7fffaea5fae0) at /oracle/valhalla/open/src/hotspot/share/opto/phaseX.cpp:1491
        #7 0x00007ffff6ee8878 in PhaseIdealLoop::try_sink_out_of_loop (n=<optimized out>, this=0x7fffd47d1720) at /oracle/valhalla/open/src/hotspot/share/opto/loopopts.cpp:1821
        #8 PhaseIdealLoop::try_sink_out_of_loop (this=0x7fffd47d1720, n=<optimized out>) at /oracle/valhalla/open/src/hotspot/share/opto/loopopts.cpp:1763
        #9 0x00007ffff6ee8ad5 in PhaseIdealLoop::split_if_with_blocks_post (this=0x7fffd47d1720, n=<optimized out>) at /oracle/valhalla/open/src/hotspot/share/opto/loopopts.cpp:1618
        #10 0x00007ffff6ee9eb4 in PhaseIdealLoop::split_if_with_blocks_post (n=0x7fffac383d08, this=0x7fffd47d1720) at /oracle/valhalla/open/src/hotspot/share/opto/loopopts.cpp:2001
        #11 PhaseIdealLoop::split_if_with_blocks (this=this@entry=0x7fffd47d1720, visited=..., nstack=...) at /oracle/valhalla/open/src/hotspot/share/opto/loopopts.cpp:2001
        #12 0x00007ffff6eda5cf in PhaseIdealLoop::build_and_optimize (this=this@entry=0x7fffd47d1720) at /oracle/valhalla/open/src/hotspot/share/opto/loopnode.cpp:4517
        #13 0x00007ffff650d674 in PhaseIdealLoop::PhaseIdealLoop (mode=LoopOptsDefault, igvn=..., this=0x7fffd47d1720) at /oracle/valhalla/open/src/hotspot/share/opto/loopnode.hpp:1101

        Running with -XX:-SplitIfBlocks or explicitly disabling PhaseIdealLoop::try_sink_out_of_loop brings back old speed.

        This also shows with -XX:+CITime:

        JDK 16:
        Accumulated compiler times
        ----------------------------------------------------------
          Total compilation time : 0,293 s

        JDK 21:
        Accumulated compiler times
        ----------------------------------------------------------
          Total compilation time : 9,049 s

        Attachments

          Issue Links

            Activity

              People

                roland Roland Westrelin
                thartmann Tobias Hartmann
                Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: