JDK-8181741 : C2 compilation fails with "assert(i<_max) failed: oob"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 10
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-06-07
  • Updated: 2017-08-25
  • Resolved: 2017-06-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10 b21Fixed
Related Reports
Relates :  
Relates :  
Description
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/phaseX.hpp:134
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/scratch/opt/jprt/T/P1/231047.cphillim/s/hotspot/src/share/vm/opto/phaseX.hpp:134), pid=31568, tid=31699
#  assert(i<_max) failed: oob
#

Log files in comments.
Comments
PhaseIdealLoop::split_thru_phi() creates a new PhiNode 'phi' and sets the _igvn type through PhaseIdealLoop::register_new_node() -> PhaseIterGVN::register_new_node_with_optimizer() -> set_type_bottom(). Later in PhaseIdealLoop::split_if_with_blocks_pre() we call n->as_ConstraintCast()->dominating_cast(this) with n == 'phi' which fails because the type for 'phi' is not initialized in PhaseIdealLoop (but only in _igvn). The call to dominating_cast(this) was introduced in JDK 9 by JDK-8139771 but the the problem only shows up with JDK-8176506 which added a call to type_or_null(val). We should pass both &_igvn and 'this'. I also added an assert to type() and type_or_null() to verify that these methods are not used from PhaseIdealLoop.
08-06-2017

Able to reproduce with attached replay_pid14443.log and the fix for JDK-8181781.
08-06-2017

Current CompileTask: C2: 23083 1536 sun.reflect.annotation.AnnotationParser::parseAnnotations2 (135 bytes) Stack: [0x00007ff5cddfe000,0x00007ff5cdeff000], sp=0x00007ff5cdef9300, free space=1004k Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x17471d2] VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x162;; VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x162 V [libjvm.so+0x1747f9f] VMError::report_and_die(Thread*, char const*, int, char const*, char const*, __va_list_tag*)+0x2f;; VMError::report_and_die(Thread*, char const*, int, char const*, char const*, __va_list_tag*)+0x2f V [libjvm.so+0xadc56d] report_vm_error(char const*, int, char const*, char const*, ...)+0xdd;; report_vm_error(char const*, int, char const*, char const*, ...)+0xdd V [libjvm.so+0x89ad01] ConstraintCastNode::dominating_cast(PhaseTransform*) const+0x1e1;; ConstraintCastNode::dominating_cast(PhaseTransform*) const+0x1e1 V [libjvm.so+0x11e46d6] PhaseIdealLoop::split_if_with_blocks_pre(Node*)+0x196;; PhaseIdealLoop::split_if_with_blocks_pre(Node*)+0x196 V [libjvm.so+0x11e5f8d] PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&)+0x13d;; PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&)+0x13d V [libjvm.so+0x11de039] PhaseIdealLoop::build_and_optimize(bool, bool)+0x1249;; PhaseIdealLoop::build_and_optimize(bool, bool)+0x1249 V [libjvm.so+0xa47579] Compile::Optimize()+0xd59;; Compile::Optimize()+0xd59 V [libjvm.so+0xa48b2e] Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool, DirectiveSet*)+0x124e;; Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool, DirectiveSet*)+0x124e V [libjvm.so+0x868ab2] C2Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0x2e2;; C2Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0x2e2 V [libjvm.so+0xa544ca] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x40a;; CompileBroker::invoke_compiler_on_method(CompileTask*)+0x40a V [libjvm.so+0xa551d9] CompileBroker::compiler_thread_loop()+0x239;; CompileBroker::compiler_thread_loop()+0x239 V [libjvm.so+0x16a9cee] JavaThread::thread_main_inner()+0x22e;; JavaThread::thread_main_inner()+0x22e V [libjvm.so+0x16a9f7e] JavaThread::run()+0x1ce;; JavaThread::run()+0x1ce V [libjvm.so+0x13ed052] thread_native_entry(Thread*)+0x112;; thread_native_entry(Thread*)+0x112 C [libpthread.so.0+0x7dc5] start_thread+0xc5
07-06-2017

ILW = Assert during C2 compilation, multiple tests, disable split if optimization = HMM = P2
07-06-2017

I suspect that this is related to JDK-8176506 which was pushed just recently to JDK 10.
07-06-2017