JDK-8261229 : MethodData is not correctly initialized with TieredStopAtLevel=3
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-02-05
  • Updated: 2021-02-21
  • Resolved: 2021-02-08
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 17
17 b09Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
After JDK-8251462, we are seeing the following assert in Valhalla testing with TieredStopAtLevel=3:

#  Internal Error (/oracle/valhalla/open/src/hotspot/share/c1/c1_LIRGenerator.cpp:967), pid=1143369, tid=1143383
#  assert(data != __null) failed: must have profiling data

Current CompileTask:
C1:    533  169    b  3       compiler.valhalla.inlinetypes.TestArrays::<clinit> (134 bytes)

Stack: [0x00007f187003c000,0x00007f187013d000],  sp=0x00007f187013ace0,  free space=1019k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x7b6a64]  LIRGenerator::profile_branch(If*, Instruction::Condition)+0x424
V  [libjvm.so+0x7dcfc1]  LIRGenerator::do_If(If*)+0x1e1
V  [libjvm.so+0x7b06c4]  LIRGenerator::do_root(Instruction*)+0xa4
V  [libjvm.so+0x7b381e]  non-virtual thunk to LIRGenerator::block_do(BlockBegin*)+0x5e
V  [libjvm.so+0x773d74]  BlockList::iterate_forward(BlockClosure*)+0x94
V  [libjvm.so+0x7286b6]  Compilation::emit_lir()+0x5d6
V  [libjvm.so+0x72b65b]  Compilation::compile_java_method()+0x43b
V  [libjvm.so+0x72c1f0]  Compilation::compile_method()+0x1d0
V  [libjvm.so+0x72cc66]  Compilation::Compilation(AbstractCompiler*, ciEnv*, ciMethod*, int, BufferBlob*, bool, DirectiveSet*)+0x3c6
V  [libjvm.so+0x72e113]  Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x1a3
V  [libjvm.so+0xa68ff1]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0xea1
V  [libjvm.so+0xa69c78]  CompileBroker::compiler_thread_loop()+0x5a8
V  [libjvm.so+0x192eea6]  JavaThread::thread_main_inner()+0x256
V  [libjvm.so+0x1935810]  Thread::call_run()+0x100
V  [libjvm.so+0x15f74e6]  thread_native_entry(Thread*)+0x116

A quick investigation showed that CompilerConfig::is_c1_simple_only() incorrectly returns true.

It's concerning that none of our mainline testing caught this.
Comments
Changeset: 29a428f5 Author: Igor Veresov <iveresov@openjdk.org> Date: 2021-02-08 17:08:36 +0000 URL: https://git.openjdk.java.net/jdk/commit/29a428f5
08-02-2021

Same problem occurs with whitebox/GetCodeHeapEntriesTest.java, whitebox/BlockingCompilation.java, whitebox/AllocationCodeBlobTest.java when run with -XX:TieredStopAtLevel=3
06-02-2021

Mostly a typo. The problem will only manifest if the compilation request (for a level 3 compile) is submitted through the WB API in presence of the TieredStopAtLevel={2,3} flag. Suggested fix: diff --git a/src/hotspot/share/compiler/compilerDefinitions.cpp b/src/hotspot/share/compiler/compilerDefinitions.cpp index 4d056334634..cd29c595e87 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.cpp +++ b/src/hotspot/share/compiler/compilerDefinitions.cpp @@ -80,7 +80,7 @@ bool CompilationModeFlag::initialize() { // Now that the flag is parsed, we can use any methods of CompilerConfig. if (normal()) { - if (CompilerConfig::is_c1_only()) { + if (CompilerConfig::is_c1_simple_only()) { _mode = Mode::QUICK_ONLY; } else if (CompilerConfig::is_c2_or_jvmci_compiler_only()) { _mode = Mode::HIGH_ONLY;
05-02-2021

ILW = Assert/crash during C1 compilation due to incomplete initialization of MDO data, rare but reproducible with Valhalla testing via Whitebox API, disable C1 profiling = HLM = P3
05-02-2021

The following assert triggers immediately when executing with TieredStopAtLevel=2,3 --- a/src/hotspot/share/compiler/compilerDefinitions.cpp +++ b/src/hotspot/share/compiler/compilerDefinitions.cpp @@ -581,6 +581,7 @@ void CompilerConfig::ergo_initialize() { FLAG_SET_DEFAULT(UseLoopCounter, true); } +assert(!CompilerConfig::is_c1_simple_only(), "Fail");
05-02-2021