A DESCRIPTION OF THE PROBLEM :
JVM crashes under JDK8 when running the test with JVM args -Xcomp -XX:LoopOptsCount=5.
Reproduce (minimal test case on JDK 8 fastdebug):
$ javac Reduced.java && java -Xcomp -XX:LoopOptsCount=5 Reduced
Default case invoked for:
opcode = 154, "LoopLimit"
o401 LoopLimit === _ o647 o373 [[o305 66 ]]
--N: o401 LoopLimit === _ o647 o373 [[o305 66 ]]
--N: o647 Binary === _ o315 o22 [[o401 ]]
_Binary_rRegI_rRegI 100 _Binary_rRegI_rRegI
_Binary_rax_RegI_rRegI 100 _Binary_rax_RegI_rRegI
--N: o315 CastII === o397 o293 [[o647 ]] #int:>=2:www carry dependency
RREGI 0 castII
RAX_REGI 0 castII
RBX_REGI 0 castII
RCX_REGI 0 castII
RDX_REGI 0 castII
RDI_REGI 0 castII
NO_RCX_REGI 0 castII
NO_RAX_RDX_REGI 0 castII
STACKSLOTI 100 storeSSI
--N: o293 AddI === _ o297 o61 [[o292 o297 o305 o310 o315 10 13 ]]
RREGI 0 RREGI
RAX_REGI 0 RAX_REGI
RBX_REGI 0 RBX_REGI
RCX_REGI 0 RCX_REGI
RDX_REGI 0 RDX_REGI
RDI_REGI 0 RDI_REGI
NO_RCX_REGI 0 NO_RCX_REGI
NO_RAX_RDX_REGI 0 NO_RAX_RDX_REGI
STACKSLOTI 100 storeSSI
--N: o22 ConI === o0 [[o58 o633 o632 o651 o629 o298 o290 o624 o625 o153 o154 o679 o649 o681 o260 o486 o482 o653 o628 o647 o256 o404 o405 o407 o408 o683 o436 o441 o442 o485 o445 o521 o522 o524 o525 o677 o675 o555 o556 o558 o559 o561 o562 o564 o565 o673 o671 o669 o667 o310 o665 o604 o605 o663 o608 o609 o661 o612 o613 o659 o616 o617 o657 o620 o621 o655 24 ]] #int:1
IMMI 10 IMMI
IMMI1 0 IMMI1
IMMI2 0 IMMI2
IMMI8 5 IMMI8
IMMI16 10 IMMI16
IMMU31 0 IMMU31
RREGI 100 loadConI
RAX_REGI 100 loadConI
RBX_REGI 100 loadConI
RCX_REGI 100 loadConI
RDX_REGI 100 loadConI
RDI_REGI 100 loadConI
NO_RCX_REGI 100 loadConI
NO_RAX_RDX_REGI 100 loadConI
STACKSLOTI 200 storeSSI
--N: o373 ConI === o0 [[o401 ]] #int:-2
IMMI 10 IMMI
IMMI8 5 IMMI8
IMMI16 10 IMMI16
RREGI 100 loadConI
RAX_REGI 100 loadConI
RBX_REGI 100 loadConI
RCX_REGI 100 loadConI
RDX_REGI 100 loadConI
RDI_REGI 100 loadConI
NO_RCX_REGI 100 loadConI
NO_RAX_RDX_REGI 100 loadConI
STACKSLOTI 200 storeSSI
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc: SuppressErrorAt=/matcher.cpp:1592
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error ((...)/hotspot/src/share/vm/opto/matcher.cpp:1592), pid=171120, tid=0x00007f84decf5700
# assert(false) failed: bad AD file
#
# JRE version: Java(TM) SE Runtime Environment (8.0_291-b94) (build 1.8.0_291-fastdebug-b94)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.291-b94-fastdebug compiled mode linux-amd64 compressed oops)
Reproduce (larger test case):
$ java -Xcomp -XX:LoopOptsCount=5 Test
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/home/user/jdk_source/jdk8u/hotspot/src/share/vm/opto/matcher.cpp:1592), pid=85165, tid=0x00007f25d9545700
# assert(false) failed: bad AD file
#
# JRE version: OpenJDK Runtime Environment (8.0) (build 1.8.0-internal-fastdebug-user_2022_03_11_16_03-b00)
# Java VM: OpenJDK 64-Bit Server VM (25.71-b00-fastdebug compiled mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
--------------- T H R E A D ---------------
Current thread (0x00007f26ac20c000): JavaThread "C2 CompilerThread3" daemon [_thread_in_native, id=85243, stack(0x00007f25d9446000,0x00007f25d9546000)]
Stack: [0x00007f25d9446000,0x00007f25d9546000], sp=0x00007f25d9541010, free space=1004k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x121fcac] VMError::report_and_die()+0x2ec
V [libjvm.so+0x797f81] report_vm_error(char const*, int, char const*, char const*)+0x61
V [libjvm.so+0xdf3a49] Matcher::Label_Root(Node const*, State*, Node*, Node const*)+0x5c9
V [libjvm.so+0xdf3e09] Matcher::match_tree(Node const*)+0x229
V [libjvm.so+0xdf65da] Matcher::xform(Node*, int)+0x93a
V [libjvm.so+0xdfa303] Matcher::match()+0xca3
V [libjvm.so+0x6fb0c2] Compile::Code_Gen()+0x82
V [libjvm.so+0x6feac4] Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool)+0xf04
V [libjvm.so+0x59ba70] C2Compiler::compile_method(ciEnv*, ciMethod*, int)+0xe0
V [libjvm.so+0x70bdf2] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x8b2
V [libjvm.so+0x70d3e0] CompileBroker::compiler_thread_loop()+0x710
V [libjvm.so+0x118b188] JavaThread::thread_main_inner()+0x1c8
V [libjvm.so+0x118b54d] JavaThread::run()+0x37d
V [libjvm.so+0xf19ca2] java_start(Thread*)+0x102
C [libpthread.so.0+0x76db] start_thread+0xdb
Current CompileTask:
C2: 4032 1033 b 4 Test::mainTest (777 bytes)
---------- BEGIN SOURCE ----------
Download TestLoopOptsCount.zip from:
<link>
---------- END SOURCE ----------
FREQUENCY : always