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

C2: assert(is_Loop()) failed: invalid node class: Region

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 23
    • hotspot

      Via class-file fuzzing, a reproducer for an old and already fixed bug was found: JDK-8326638

      emanuel@emanuel-oracle:/oracle-work/triage/current$ java -jar ~/Documents/asmtools-7.0-build/release/lib/asmtools.jar jasm X.jasm
      emanuel@emanuel-oracle:/oracle-work/triage/current$ /oracle-work/jdk-22+36-2370/jdk-22/fastdebug/bin/java -XX:+TraceLoopOpts -Xbatch -XX:CompileCommand=printcompilation,*::* X
      CompileCommand: PrintCompilation *.* bool PrintCompilation = true
      109 1 b 3 java.lang.Object::<init> (1 bytes)
      115 2 b 3 java.lang.String::coder (15 bytes)
      120 3 b 3 java.lang.String::length (11 bytes)
      121 4 b 3 java.lang.String::hashCode (60 bytes)
      124 5 b 3 java.lang.String::startsWith (123 bytes)
      126 6 b 4 java.lang.String::length (11 bytes)
      128 7 b 4 java.lang.String::startsWith (123 bytes)
      134 8 % b 3 X::runTest @ 10 (79 bytes)
      136 9 b 3 X::runTest (79 bytes)
      138 10 % b 4 X::runTest @ 46 (79 bytes)
      Loop: N0/N0 has_sfpt
        Loop: N693/N685 limit_check profile_predicated predicated sfpts={ 147 646 124 }
          Loop: N165/N160 IRREDUCIBLE sfpts={ 160 597 }
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/opt/mach5/mesos/work_dir/slaves/0db9c48f-6638-40d0-9a4b-bd9cc7533eb8-S10125/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/b95bb701-7fd6-4df6-8110-9cd10ccdcd10/runs/1bfcc8e3-2708-4eb4-b892-56d3ce138b9e/workspace/open/src/hotspot/share/opto/node.hpp:920), pid=1113072, tid=1113086
      # assert(is_Loop()) failed: invalid node class: Region
      #
      # JRE version: Java(TM) SE Runtime Environment (22.0+36) (fastdebug build 22+36-2370)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22+36-2370, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x12b01ce] Node::as_Loop() const [clone .part.0]+0xe
      #
      # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /oracle-work/triage/current/core.1113072)
      #
      # An error report file with more information is saved as:
      # /oracle-work/triage/current/hs_err_pid1113072.log
      #
      # Compiler replay data is saved as:
      # /oracle-work/triage/current/replay_pid1113072.log
      #
      # If you would like to submit a bug report, please visit:
      # https://bugreport.java.com/bugreport/crash.jsp
      #
      Aborted (core dumped)


      We have the same stacktrace as with JDK-8326638. hs_err shows the bug is also in PhaseIdealLoop::remix_address_expressions, as the suspected duplicate.

      Current CompileTask:
      C2:166 10 % b 4 X::runTest @ 46 (79 bytes)

      Stack: [0x00007f8bde9ab000,0x00007f8bdeaac000], sp=0x00007f8bdeaa6cc0, free space=1007k
      Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0x12b01ce] Node::as_Loop() const [clone .part.0]+0xe (node.hpp:920)
      V [libjvm.so+0x12b4334] PhaseIdealLoop::remix_address_expressions(Node*)+0x7c4
      V [libjvm.so+0x12b629e] PhaseIdealLoop::split_if_with_blocks_pre(Node*)+0xee
      V [libjvm.so+0x12bb157] PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&)+0x1d7
      V [libjvm.so+0x12ae477] PhaseIdealLoop::build_and_optimize()+0xe87
      V [libjvm.so+0x9f1248] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x388
      V [libjvm.so+0x9ebdf3] Compile::Optimize()+0x4c3
      V [libjvm.so+0x9efce4] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b44
      V [libjvm.so+0x83bd37] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1e7
      V [libjvm.so+0x9fb6ec] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x92c
      V [libjvm.so+0x9fc378] CompileBroker::compiler_thread_loop()+0x468
      V [libjvm.so+0xeba71c] JavaThread::thread_main_inner()+0xcc
      V [libjvm.so+0x17a10d6] Thread::call_run()+0xb6
      V [libjvm.so+0x14ab447] thread_native_entry(Thread*)+0x127


      Confirmation that it was indeed fixed by JDK-8326638:
       /home/empeter/jdk-23+12-866/jdk-23/fastdebug/bin/java -XX:+TraceLoopOpts -Xbatch -XX:CompileCommand=printcompilation,*::* TestInfiniteLoopBreak
      -> assert(is_Loop()) failed: invalid node class: Region

       /home/empeter/jdk-23+12-867/jdk-23/fastdebug/bin/java -XX:+TraceLoopOpts -Xbatch -XX:CompileCommand=printcompilation,*::* TestInfiniteLoopBreak
      -> no crash.

        1. hs_err_pid1113072.log
          69 kB
        2. replay_pid1113072.log
          132 kB
        3. X.class
          0.5 kB
        4. X.jasm
          1 kB

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

              Created:
              Updated:
              Resolved: