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

C2: Create skeleton predicates for all If nodes in loop predication

XMLWordPrintable

    • b27

        We currently only create skeleton predicates for RangeCheck nodes and not for normal If nodes. But it is possible to also create range check predicates in loop predication for If nodes if they have the right pattern checked in IdealLoopTree::is_range_check_if(). This, however, is much more rare.

        Without skeleton predicates for these If nodes, we could run into the same problems already fixed for RangeCheck nodes (JDK-8193130 and related bugs). This is almost impossible to trigger in practice but the attached test case shows a case where we hit an assert due to a broken memory graph.

        To reproduce:
        $ java -Xbatch -XX:CompileOnly=Test -XX:-TieredCompilation -XX:-RangeCheckElimination -XX:+BailoutToInterpreterForThrows NoSkeleton.java


        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (/opt/mach5/mesos/work_dir/slaves/0c72054a-24ab-4dbb-944f-97f9341a1b96-S8340/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/ed07585a-43b8-4680-b23d-20b58c0a9937/runs/e4f38489-0635-4100-a63a-1f0cdb37a23a/workspace/open/src/hotspot/share/opto/loopopts.cpp:1601), pid=45173, tid=45186
        # assert(!n->is_Store() && !n->is_LoadStore()) failed: no node with a side effect
        .......
        Command Line: -XX:+BailoutToInterpreterForThrows -XX:CompileOnly=Test -XX:-TieredCompilation -Xbatch -XX:-RangeCheckElimination --add-modules=ALL-DEFAULT jdk.compiler/com.sun.tools.javac.launcher.Main NoSkeleton.java
        .......
        Current CompileTask:
        C2: 950 82 b Test::test (84 bytes)

        Stack: [0x00007f526c555000,0x00007f526c655000], sp=0x00007f526c64eec0, free space=999k
        Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
        V [libjvm.so+0x14d03a5] PhaseIdealLoop::try_sink_out_of_loop(Node*)+0x9f5 (loopopts.cpp:1601)
        V [libjvm.so+0x14d0538] PhaseIdealLoop::split_if_with_blocks_post(Node*)+0x58
        V [libjvm.so+0x14d11a9] PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&)+0x209
        V [libjvm.so+0x14c27cf] PhaseIdealLoop::build_and_optimize()+0x11bf
        V [libjvm.so+0xafe601] PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x261
        V [libjvm.so+0xafa05f] Compile::Optimize()+0xe2f
        V [libjvm.so+0xafc66e] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x18ce
        V [libjvm.so+0x90d7b7] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x4e7
        V [libjvm.so+0xb09b3c] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xa7c
        V [libjvm.so+0xb0a948] CompileBroker::compiler_thread_loop()+0x608
        V [libjvm.so+0x107d656] JavaThread::thread_main_inner()+0x206
        V [libjvm.so+0x1a852c0] Thread::call_run()+0x100
        V [libjvm.so+0x1715463] thread_native_entry(Thread*)+0x103

              chagedorn Christian Hagedorn
              chagedorn Christian Hagedorn
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: