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

PhaseIdealLoop::only_has_infinite_loops must detect all loops that never lead to termination

XMLWordPrintable

    • b27

        This is a reduction from a fuzzer test I am using for JDK-8280126, but it used to work on my un-synced repo. Probably it is related to the issues in JDK-8294217.

        When I last debugged the test, it seemed to create an infinite irreducible loop, that did not have a NeverBranch node inserted. That was also against my assumption at the time. But I was able to work around that. Now it seems to be triggered in maiinline already.

        Reproduce it:
        java -jar ~/Documents/asmtools-7.0-build/release/lib/asmtools.jar jasm TestIrreducibleInfiniteNoNeverBranch.jasm
        java -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:CompileCommand=compileonly,TestIrreducibleInfiniteNoNeverBranch::test* -XX:-TieredCompilation -XX:-RenumberLiveNodes -Xbatch -Xcomp -XX:PerMethodTrapLimit=0 -XX:+TraceLoopOpts TestIrreducibleInfiniteNoNeverBranch

        I vaguely remember that -XX:PerMethodTrapLimit=0 was required to create this graph.

        # To suppress the following error report, specify this argument
        # after -XX: or in .hotspotrc: SuppressErrorAt=/loopnode.cpp:4300
        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (/home/emanuel/Documents/fork2-jdk/open/src/hotspot/share/opto/loopnode.cpp:4300), pid=1154129, tid=1154142
        # assert(_ltree_root->_child == __null || C->has_loops() || only_has_infinite_loops() || C->has_exception_backedge()) failed: parsing found no loops but there are some
        #
        # JRE version: Java(TM) SE Runtime Environment (20.0) (slowdebug build 20-internal-2022-11-25-1142101.emanuel...)
        # Java VM: Java HotSpot(TM) 64-Bit Server VM (slowdebug 20-internal-2022-11-25-1142101.emanuel..., compiled mode, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
        # Problematic frame:
        # V [libjvm.so+0xf685e3] PhaseIdealLoop::build_and_optimize()+0x353
        #
        # 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 /home/emanuel/Documents/debug-tools/bytecode-fuzzer/core.1154129)
        #
        # An error report file with more information is saved as:
        # /home/emanuel/Documents/debug-tools/bytecode-fuzzer/hs_err_pid1154129.log
        #
        # Compiler replay data is saved as:
        # /home/emanuel/Documents/debug-tools/bytecode-fuzzer/replay_pid1154129.log
        #
        # If you would like to submit a bug report, please visit:
        # https://bugreport.java.com/bugreport/crash.jsp
        #

        Current CompileTask:
        C2:36803 100 % b 4 Test::test @ 2 (27 bytes)

        Stack: [0x00007f4fc436f000,0x00007f4fc4470000], sp=0x00007f4fc446ad80, free space=1007k
        Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
        V [libjvm.so+0x12a2718] PhaseIdealLoop::place_outside_loop(Node*, IdealLoopTree*) const+0x348 (loopopts.cpp:1266)
        V [libjvm.so+0x12a5bd6] PhaseIdealLoop::try_sink_out_of_loop(Node*)+0x376 (loopopts.cpp:1753)
        V [libjvm.so+0x12a6603] PhaseIdealLoop::split_if_with_blocks_post(Node*)+0x83 (loopopts.cpp:1531)
        V [libjvm.so+0x12a6ec6] PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&)+0x96 (loopopts.cpp:1964)
        V [libjvm.so+0x1299519] PhaseIdealLoop::build_and_optimize()+0xee9 (loopnode.cpp:4815)
        V [libjvm.so+0x9e4770] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x390 (loopnode.hpp:1117)
        V [libjvm.so+0x9df283] Compile::Optimize()+0x4c3 (compile.cpp:2366)
        V [libjvm.so+0x9e3326] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b06 (compile.cpp:852)
        V [libjvm.so+0x835575] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1d5 (c2compiler.cpp:142)
        V [libjvm.so+0x9eef68] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x928 (compileBroker.cpp:2303)
        V [libjvm.so+0x9efbf8] CompileBroker::compiler_thread_loop()+0x478 (compileBroker.cpp:1961)
        V [libjvm.so+0xe994dc] JavaThread::thread_main_inner()+0xcc (javaThread.cpp:757)
        V [libjvm.so+0x17b9076] Thread::call_run()+0xb6 (thread.cpp:225)
        V [libjvm.so+0x14a1717] thread_native_entry(Thread*)+0x127 (os_linux.cpp:858)

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

                Created:
                Updated:
                Resolved: