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

Crash in PhaseIdealLoop::remix_address_expressions due to unexpected Region instead of Loop

    XMLWordPrintable

Details

    • b12

    Backports

      Description

        javac Test.java
        java -XX:-TieredCompilation -Xbatch -XX:CompileCommand=compileonly,*::test Test

        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (/workspace/open/src/hotspot/share/opto/node.hpp:921), pid=1308573, tid=1308587
        # assert(is_Loop()) failed: invalid node class: Region
        #
        # JRE version: Java(TM) SE Runtime Environment (23.0+10) (fastdebug build 23-ea+10-652)
        # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 23-ea+10-652, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
        # Problematic frame:
        # V [libjvm.so+0x12bceee] Node::as_Loop() const [clone .part.0]+0xe

        [...]

        Current CompileTask:
        C2:95 1 % b Test::test @ 46 (79 bytes)

        Stack: [0x00007f25a292b000,0x00007f25a2a2c000], sp=0x00007f25a2a26c70, free space=1007k
        Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
        V [libjvm.so+0x12bceee] Node::as_Loop() const [clone .part.0]+0xe (node.hpp:921)
        V [libjvm.so+0x12c1774] PhaseIdealLoop::remix_address_expressions(Node*)+0x7c4
        V [libjvm.so+0x12c37be] PhaseIdealLoop::split_if_with_blocks_pre(Node*)+0xee
        V [libjvm.so+0x12c86c7] PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&)+0x1d7
        V [libjvm.so+0x12bb2fd] PhaseIdealLoop::build_and_optimize()+0xf2d
        V [libjvm.so+0x9f66b8] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x388
        V [libjvm.so+0x9f0fd3] Compile::Optimize()+0x4c3
        V [libjvm.so+0x9f51a5] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1c35
        V [libjvm.so+0x848ca5] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1d5
        V [libjvm.so+0xa00e9c] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x92c
        V [libjvm.so+0xa01b28] CompileBroker::compiler_thread_loop()+0x468
        V [libjvm.so+0xec458c] JavaThread::thread_main_inner()+0xcc
        V [libjvm.so+0x17ae2d6] Thread::call_run()+0xb6
        V [libjvm.so+0x14ba117] thread_native_entry(Thread*)+0x127

        The root cause is a missing '_head->is_Loop()' check to handle the case when the loop head is not a LoopNode but a RegionNode because the loop is irreducible:

        (rr) p n_loop->_head->dump(1)
          412 IfTrue === 411 [[ 345 ]] #1 !jvms: Test$Class1::Class1_method0 @ bci:286 (line 119)
          339 SafePoint === 336 1 340 1 1 344 290 1 1 1 1 291 1 1 293 294 295 1 320 297 1 298 299 300 301 302 1 303 1 [[ 345 ]] SafePoint !jvms: Test$Class1::Class1_method0 @ bci:307 (line 122)
          345 Region === 345 339 412 [[ 345 456 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 1861 1863 1865 1867 1882 1888 ]] #irreducible !jvms: Test$Class1::Class1_method0 @ bci:138 (line 101)

        We then crash when invoking LoopNode::skip_strip_mined on a RegionNode or assert in debug.

        This is a regression from JDK-8303511 in JDK 21 b13. All later JDK versions are affected. The fix was also backported to older releases but these are not affected, probably because JDK-8280126 was not backported.

        Attachments

          Issue Links

            Activity

              People

                thartmann Tobias Hartmann
                thartmann Tobias Hartmann
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: