-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P3
-
Affects Version/s: repo-leyden
-
Component/s: hotspot
The assert is hit when trying print C2 compiled code during training run:
$ cat User.java
public class User {
static final int secret = (int)System.currentTimeMillis() & 1;
static int av = 0;
static int bv = 0;
static void a() { av += 3; }
static void b() { bv += 5; }
static void aotCompiledMethod() {
if (secret == 0) {
a();
} else {
b();
}
}
public static void main(String[] args) {
for (int i = 0; i < 20000; i++) { aotCompiledMethod(); }
}
}
$ ./build/fastdebug/images/jdk/bin/java -Xbatch -XX:CompileCommand=print,User::aotCompiledMethod -XX:AOTMode=record -XX:AOTConfiguration=user.aotconfig User
# Internal Error (/leyden/open/src/hotspot/share/runtime/mutex.cpp:461), pid=774213, tid=774230
# assert(false) failed: Attempting to acquire lock TrainingData_lock/nosafepoint out of order with lock tty_lock/tty -- possible deadlock
#
# JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build 26-internal-vkozlov.open)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-internal-vkozlov.open, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x17bc960] Mutex::check_rank(Thread*)+0x590
Current CompileTask:
C2: 444 W0.1 Q0.0 166 b 4 User::aotCompiledMethod (16 bytes)
Stack: [0x00007efc3b01c000,0x00007efc3b11c000], sp=0x00007efc3b1173e0, free space=1004k
Native frames: (J=compiled Java code, A=AOT compiled, P=AOT preloaded, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x17bc960] Mutex::check_rank(Thread*)+0x590 (mutex.cpp:461)
V [libjvm.so+0x17bcbfc] Mutex::lock_without_safepoint_check(Thread*)+0x4c (mutex.cpp:146)
V [libjvm.so+0x1c45d78] KlassTrainingData::make(InstanceKlass*, bool)+0x2d8 (trainingData.hpp:110)
V [libjvm.so+0x1c4b2f8] CompileTrainingData::notice_jit_observation(ciEnv*, ciBaseObject*)+0x1c8 (trainingData.cpp:324)
V [libjvm.so+0xac2e25] ciObjectFactory::get_metadata(Metadata*)+0x365 (ciObjectFactory.cpp:261)
V [libjvm.so+0xa82279] ciInstance::java_lang_Class_klass()+0x179 (ciEnv.hpp:192)
V [libjvm.so+0x1c598cd] TypeOopPtr::TypeOopPtr(Type::TYPES, TypePtr::PTR, ciKlass*, TypeInterfaces const*, bool, ciObject*, int, int, TypePtr const*, int)+0x38d (type.cpp:3483)
V [libjvm.so+0x1c5a21d] TypeInstPtr::TypeInstPtr(TypePtr::PTR, ciKlass*, TypeInterfaces const*, bool, ciObject*, int, int, TypePtr const*, int)+0x3d (type.cpp:3953)
V [libjvm.so+0x1c5a6c3] TypeInstPtr::make(TypePtr::PTR, ciKlass*, TypeInterfaces const*, bool, ciObject*, int, int, TypePtr const*, int)+0xf3 (type.cpp:3990)
V [libjvm.so+0x1c5ae5f] TypeInstPtr::add_offset(long) const+0xef (type.cpp:4509)
V [libjvm.so+0x583ed6] addI_mem_immNode::format(PhaseRegAlloc*, outputStream*) const+0xd6 (ad_x86_format.cpp:5968)
V [libjvm.so+0x18989a4] PhaseOutput::dump_asm_on(outputStream*, int*, unsigned int)+0x4f4 (output.cpp:3386)
V [libjvm.so+0x18a0616] PhaseOutput::fill_buffer(C2_MacroAssembler*, unsigned int*)+0x25f6 (output.cpp:1828)
V [libjvm.so+0x18a1d59] PhaseOutput::Output()+0xc49 (output.cpp:350)
V [libjvm.so+0xbc9eb7] Compile::Code_Gen()+0xa67 (compile.cpp:3143)
V [libjvm.so+0xbcf4d3] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x21b3 (compile.cpp:900)
V [libjvm.so+0x9e14c8] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x578 (c2compiler.cpp:173)
V [libjvm.so+0xbde890] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xcb0 (compileBroker.cpp:2572)
$ cat User.java
public class User {
static final int secret = (int)System.currentTimeMillis() & 1;
static int av = 0;
static int bv = 0;
static void a() { av += 3; }
static void b() { bv += 5; }
static void aotCompiledMethod() {
if (secret == 0) {
a();
} else {
b();
}
}
public static void main(String[] args) {
for (int i = 0; i < 20000; i++) { aotCompiledMethod(); }
}
}
$ ./build/fastdebug/images/jdk/bin/java -Xbatch -XX:CompileCommand=print,User::aotCompiledMethod -XX:AOTMode=record -XX:AOTConfiguration=user.aotconfig User
# Internal Error (/leyden/open/src/hotspot/share/runtime/mutex.cpp:461), pid=774213, tid=774230
# assert(false) failed: Attempting to acquire lock TrainingData_lock/nosafepoint out of order with lock tty_lock/tty -- possible deadlock
#
# JRE version: Java(TM) SE Runtime Environment (26.0) (fastdebug build 26-internal-vkozlov.open)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-internal-vkozlov.open, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x17bc960] Mutex::check_rank(Thread*)+0x590
Current CompileTask:
C2: 444 W0.1 Q0.0 166 b 4 User::aotCompiledMethod (16 bytes)
Stack: [0x00007efc3b01c000,0x00007efc3b11c000], sp=0x00007efc3b1173e0, free space=1004k
Native frames: (J=compiled Java code, A=AOT compiled, P=AOT preloaded, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x17bc960] Mutex::check_rank(Thread*)+0x590 (mutex.cpp:461)
V [libjvm.so+0x17bcbfc] Mutex::lock_without_safepoint_check(Thread*)+0x4c (mutex.cpp:146)
V [libjvm.so+0x1c45d78] KlassTrainingData::make(InstanceKlass*, bool)+0x2d8 (trainingData.hpp:110)
V [libjvm.so+0x1c4b2f8] CompileTrainingData::notice_jit_observation(ciEnv*, ciBaseObject*)+0x1c8 (trainingData.cpp:324)
V [libjvm.so+0xac2e25] ciObjectFactory::get_metadata(Metadata*)+0x365 (ciObjectFactory.cpp:261)
V [libjvm.so+0xa82279] ciInstance::java_lang_Class_klass()+0x179 (ciEnv.hpp:192)
V [libjvm.so+0x1c598cd] TypeOopPtr::TypeOopPtr(Type::TYPES, TypePtr::PTR, ciKlass*, TypeInterfaces const*, bool, ciObject*, int, int, TypePtr const*, int)+0x38d (type.cpp:3483)
V [libjvm.so+0x1c5a21d] TypeInstPtr::TypeInstPtr(TypePtr::PTR, ciKlass*, TypeInterfaces const*, bool, ciObject*, int, int, TypePtr const*, int)+0x3d (type.cpp:3953)
V [libjvm.so+0x1c5a6c3] TypeInstPtr::make(TypePtr::PTR, ciKlass*, TypeInterfaces const*, bool, ciObject*, int, int, TypePtr const*, int)+0xf3 (type.cpp:3990)
V [libjvm.so+0x1c5ae5f] TypeInstPtr::add_offset(long) const+0xef (type.cpp:4509)
V [libjvm.so+0x583ed6] addI_mem_immNode::format(PhaseRegAlloc*, outputStream*) const+0xd6 (ad_x86_format.cpp:5968)
V [libjvm.so+0x18989a4] PhaseOutput::dump_asm_on(outputStream*, int*, unsigned int)+0x4f4 (output.cpp:3386)
V [libjvm.so+0x18a0616] PhaseOutput::fill_buffer(C2_MacroAssembler*, unsigned int*)+0x25f6 (output.cpp:1828)
V [libjvm.so+0x18a1d59] PhaseOutput::Output()+0xc49 (output.cpp:350)
V [libjvm.so+0xbc9eb7] Compile::Code_Gen()+0xa67 (compile.cpp:3143)
V [libjvm.so+0xbcf4d3] Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x21b3 (compile.cpp:900)
V [libjvm.so+0x9e14c8] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x578 (c2compiler.cpp:173)
V [libjvm.so+0xbde890] CompileBroker::invoke_compiler_on_method(CompileTask*)+0xcb0 (compileBroker.cpp:2572)