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

C2 failed: regular loops only (counted loop inside infinite loop)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 22
    • 8, 11, 17, 19, 20, 21
    • hotspot
    • b02

    Description

      Found this with my jasm fuzzer.


      java -jar ~/Documents/asmtools-7.0-build/release/lib/asmtools.jar jasm Y.jasm
      /home/emanuel/Documents/fork7-jdk/build/linux-x64-debug/jdk/bin/java -Xcomp -XX:CompileCommand=compileonly,Y::test -XX:-TieredCompilation -XX:PerMethodTrapLimit=0 Y

      With Y.class:
      $ java -Xcomp -XX:CompileCommand=compileonly,Y::test -XX:-TieredCompilation -XX:PerMethodTrapLimit=0 Y

      # Internal Error (/home/emanuel/Documents/fork7-jdk/open/src/hotspot/share/opto/loopnode.cpp:1748), pid=412841, tid=412854
      # assert(x->Opcode() == Op_Loop || x->Opcode() == Op_LongCountedLoop) failed: regular loops only
      #
      # JRE version: Java(TM) SE Runtime Environment (21.0) (fastdebug build 21-internal-LTS-2023-05-23-0419418.emanuel...)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 21-internal-LTS-2023-05-23-0419418.emanuel..., compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x128fbb2] PhaseIdealLoop::is_counted_loop(Node*, IdealLoopTree*&, BasicType)+0x3082


      The "x" in question is this:
      85 Region === 85 76 101 [[ 85 92 96 88 ]] #reducible !jvms: Y::test @ bci:6

      I suspect something has to do with infinite loops, I see a NeverBranch above the region. Maybe the region has not been converted to a LoopNode yet because of the infinite loop?

      (rr) p x->dump_bfs(100,0,"#c")
      dist dump
      ---------------------------------------------
        13 0 Root === 0 116 [[ 0 1 3 25 36 40 41 ]]
        12 62 IfTrue === 61 [[ 117 ]] #1 !jvms: Y::test @ bci:41
        12 50 IfFalse === 48 [[ 117 ]] #0 !jvms: Y::test @ bci:35
        12 3 Start === 3 0 [[ 3 5 10 7 115 ]] #{0:control, 1:abIO, 2:memory, 3:rawptr:BotPTR, 4:return_address, 5:int, 6:int, 7:java/lang/Object *, 8:java/lang/Object *}
        11 117 Region === 117 50 62 [[ 117 119 118 ]] !orig=[30] !jvms: Y::test @ bci:26
        11 5 Parm === 3 [[ 119 ]] Control !jvms: Y::test @ bci:-1
        10 119 Loop === 119 5 117 [[ 119 33 43 38 ]] inner !orig=[30] !jvms: Y::test @ bci:26
         9 38 SafePoint === 119 1 7 1 1 43 10 1 1 1 1 37 1 1 1 1 25 37 [[ 48 ]] SafePoint !jvms: Y::test @ bci:35
         8 48 If === 38 47 [[ 49 50 ]] P=0.100000, C=-1.000000 !jvms: Y::test @ bci:35
         7 49 IfTrue === 48 [[ 61 ]] #1 !orig=54 !jvms: Y::test @ bci:35
         6 61 If === 49 60 [[ 62 63 ]] P=0.900000, C=-1.000000 !jvms: Y::test @ bci:41
         5 63 IfFalse === 61 [[ 70 ]] #0 !jvms: Y::test @ bci:41
         5 100 IfTrue === 99 [[ 70 ]] #1 !jvms: Y::test @ bci:15
         4 70 Region === 70 100 63 [[ 70 112 80 73 ]] #reducible !jvms: Y::test @ bci:44
         3 92 SafePoint === 85 1 7 1 1 96 91 1 1 1 1 1 1 1 1 1 91 25 [[ 99 ]] SafePoint !jvms: Y::test @ bci:15
         3 112 NeverBranch === 70 [[ 113 114 ]]
         2 99 If === 92 98 [[ 100 101 ]] P=0.100000, C=-1.000000 !jvms: Y::test @ bci:15
         2 113 CProj === 112 [[ 76 ]] #0
         1 101 IfFalse === 99 [[ 85 ]] #0 !jvms: Y::test @ bci:15
         1 76 SafePoint === 113 1 7 1 1 80 73 1 1 1 1 1 1 1 1 1 [[ 85 ]] SafePoint !jvms: Y::test @ bci:44
         0 85 Region === 85 76 101 [[ 85 92 96 88 ]] #reducible !jvms: Y::test @ bci:6


      Stack: [0x00007f48d00c4000,0x00007f48d01c4000], sp=0x00007f48d01bde60, free space=999k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x128f5a2] PhaseIdealLoop::is_counted_loop(Node*, IdealLoopTree*&, BasicType)+0x3082 (loopnode.cpp:1748)
      V [libjvm.so+0x128f640] IdealLoopTree::counted_loop(PhaseIdealLoop*)+0x40
      V [libjvm.so+0x128f6b2] IdealLoopTree::counted_loop(PhaseIdealLoop*)+0xb2
      V [libjvm.so+0x128f6b2] IdealLoopTree::counted_loop(PhaseIdealLoop*)+0xb2
      V [libjvm.so+0x1295e31] PhaseIdealLoop::build_and_optimize()+0x801
      V [libjvm.so+0x9f2c70] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x250
      V [libjvm.so+0x9ee6fe] Compile::Optimize()+0x56e
      V [libjvm.so+0x9f19a5] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1ae5
      V [libjvm.so+0x84b8e4] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x3c4
      V [libjvm.so+0x9fd7a0] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xa00
      V [libjvm.so+0x9fe628] CompileBroker::compiler_thread_loop()+0x618
      V [libjvm.so+0xeb7bac] JavaThread::thread_main_inner()+0xcc
      V [libjvm.so+0x17953ba] Thread::call_run()+0xba
      V [libjvm.so+0x149586c] thread_native_entry(Thread*)+0x11c

      Attachments

        1. hs_err_pid414292.log
          73 kB
        2. replay_pid414292.log
          153 kB
        3. Y.class
          0.4 kB
        4. Y.jasm
          1 kB
        5. Y2.jasm
          0.8 kB

        Issue Links

          Activity

            People

              epeter Emanuel Peter
              epeter Emanuel Peter
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: