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

C2 compilation asserts due to unexpected irreducible loop

XMLWordPrintable

    • master

      A quick summary:
      - Problem: we use "split_if" for "IfNode::Ideal_common" to split through a Region that is loop-head, and the splitting of the Region introduces a second loop entry -> irreducible loop.
      - We have the "split_if" for "IfNode::Ideal_common" to do split-if on straight-line code. But we currently execute this before loop-opts, and so we don't know if the region we split through is actually a loop head. We guard against LoopNode, but a Region only becomes a LoopNode in loop-opts.
      - We also have split-if in loop-opts, which is more careful about splitting through loop-heads.
      - Just removing the straight-line split-if probably leads to a regression, as the loop-opts version only executes if there are loops for example.
      - We could consider delaying the straight-line split-if until after loop-opts. But I don't know if that could lead to regressions in any way.

      I discussed a possible temporary solution with [~thartmann]:
      - We would like JDK-8348570 to be unblocked for [~shade].
      - Convert the assert into a bailout-check, so we are sure we behave correctly in product. Compiling with irreducible loops behaves correctly in almost all cases, but there could be exceptions.
      - For now, have the assert behind a Verify flag, so that JDK-8348570 is unblocked. Later, we can remove the Verify flag and alway enable the assert again.

      -------------------- Original Description ----------------------

      (synopsis is provisional, change as you see fit)

      I have been testing various compilation modes in the context of JDK-8348570, and noticed this failure:

      $ CONF=linux-x86_64-server-fastdebug make images test TEST=applications/ctw/modules/java_desktop_2.java TEST_VM_OPTS="-XX:PerMethodTrapLimit=0"

      java.lang.Error: modules_java_desktop_2685: failed during compilation of class #2885 : javax/swing/plaf/basic/BasicScrollBarUI
      at sun.hotspot.tools.ctw.CtwRunner.startCtwforAllClasses(CtwRunner.java:231)
      at sun.hotspot.tools.ctw.CtwRunner.run(CtwRunner.java:129)
      at sun.hotspot.tools.ctw.CtwRunner.main(CtwRunner.java:75)
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
      at java.base/java.lang.reflect.Method.invoke(Method.java:565)
      at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
      at java.base/java.lang.Thread.run(Thread.java:1447)

      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/home/shade/trunks/jdk/src/hotspot/share/opto/cfgnode.cpp:445), pid=2894539, tid=2894609
      # assert(loop_status() == RegionNode::LoopStatus::MaybeIrreducibleEntry) failed: must be marked irreducible
      #

      Current CompileTask:
      C2:7425 7243 b 4 javax.swing.plaf.basic.BasicScrollBarUI$ScrollListener::actionPerformed (351 bytes)

      Stack: [0x000077ddab66b000,0x000077ddab76b000], sp=0x000077ddab765c80, free space=1003k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x9326a4] RegionNode::verify_can_be_irreducible_entry() const+0x54 (cfgnode.cpp:445)
      V [libjvm.so+0x1387cd0] PhaseIdealLoop::build_loop_tree_impl(Node*, int)+0x190 (loopnode.cpp:5635)
      V [libjvm.so+0x1397817] PhaseIdealLoop::build_loop_tree()+0x507 (loopnode.cpp:5509)
      V [libjvm.so+0x139b7bb] PhaseIdealLoop::build_and_optimize()+0x16b (loopnode.cpp:4663)
      V [libjvm.so+0xa9b1dc] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x3ac (loopnode.hpp:1114)
      V [libjvm.so+0xa93ffc] Compile::Optimize()+0x53c (compile.cpp:2379)
      V [libjvm.so+0xa98d53] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1bc3 (compile.cpp:852)
      V [libjvm.so+0x8e2047] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1b7 (c2compiler.cpp:142)
      V [libjvm.so+0xaa5b20] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xb60 (compileBroker.cpp:2319)
      V [libjvm.so+0xaa6978] CompileBroker::compiler_thread_loop()+0x5c8 (compileBroker.cpp:1977)
      V [libjvm.so+0xf8d1de] JavaThread::thread_main_inner()+0xee (javaThread.cpp:777)
      V [libjvm.so+0x1aa47be] Thread::call_run()+0xbe (thread.cpp:232)
      V [libjvm.so+0x15bdd1b] thread_native_entry(Thread*)+0x12b (os_linux.cpp:860)
      Registers:

        1. img_001.png
          img_001.png
          37 kB
        2. img_002.png
          img_002.png
          37 kB
        3. Test.java
          1 kB

            epeter Emanuel Peter
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: