Currently ciMethod() uses simple MutexLocker for Compile_lock:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/ci/ciMethod.cpp#L112
During Leyden testing with -XX:+LogCompilation flag we hit assert because ciMethod() could be called from ciEnv::register_method() which already holds this lock:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/ci/ciEnv.cpp#L1060
# Internal Error (/Users/vkozlov/work/leyden/open/src/hotspot/share/runtime/mutex.cpp:118), pid=98648, tid=27907
# assert(owner() != self) failed: invariant
V [libjvm.dylib+0x58e90c] print_error_for_unit_test(char const*, char const*, char*)+0x0
V [libjvm.dylib+0xe35938] Mutex::lock(Thread*)+0x110
V [libjvm.dylib+0x411cd0] ciMethod::ciMethod(methodHandle const&, ciInstanceKlass*)+0x334
V [libjvm.dylib+0x433f7c] ciObjectFactory::create_new_metadata(Metadata*)+0x2cc
V [libjvm.dylib+0x432184] ciObjectFactory::get_metadata(Metadata*)+0x1a0
V [libjvm.dylib+0x5c4060] Dependencies::write_dependency_to(CompileLog*, Dependencies::DepType, GrowableArray<Dependencies::DepArgument>*, Klass*)+0x2d4
V [libjvm.dylib+0x5c5144] Dependencies::DepStream::log_dependency(Klass*)+0x258
V [libjvm.dylib+0x5c9ab0] Dependencies::DepStream::check_new_klass_dependency(NewKlassDepChange*)+0x3ec
V [libjvm.dylib+0x5c2f88] Dependencies::DepStream::check_dependency()+0x40
V [libjvm.dylib+0x5c2cf4] Dependencies::validate_dependencies(CompileTask*, char**)+0x16c
V [libjvm.dylib+0x3fbc68] ciEnv::validate_compile_task_dependencies(ciMethod*)+0x3c
V [libjvm.dylib+0x3fc11c] ciEnv::register_method(ciMethod*, int, CodeOffsets*, int, CodeBuffer*, int, OopMapSet*, ExceptionHandlerTable*, ImplicitExceptionTable*, AbstractCompiler*, bool, bool, bool, bool, bool, int, bool, SCCEntry*)+0x3e4
get_metadata() is called here:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/code/dependencies.cpp#L695
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/ci/ciMethod.cpp#L112
During Leyden testing with -XX:+LogCompilation flag we hit assert because ciMethod() could be called from ciEnv::register_method() which already holds this lock:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/ci/ciEnv.cpp#L1060
# Internal Error (/Users/vkozlov/work/leyden/open/src/hotspot/share/runtime/mutex.cpp:118), pid=98648, tid=27907
# assert(owner() != self) failed: invariant
V [libjvm.dylib+0x58e90c] print_error_for_unit_test(char const*, char const*, char*)+0x0
V [libjvm.dylib+0xe35938] Mutex::lock(Thread*)+0x110
V [libjvm.dylib+0x411cd0] ciMethod::ciMethod(methodHandle const&, ciInstanceKlass*)+0x334
V [libjvm.dylib+0x433f7c] ciObjectFactory::create_new_metadata(Metadata*)+0x2cc
V [libjvm.dylib+0x432184] ciObjectFactory::get_metadata(Metadata*)+0x1a0
V [libjvm.dylib+0x5c4060] Dependencies::write_dependency_to(CompileLog*, Dependencies::DepType, GrowableArray<Dependencies::DepArgument>*, Klass*)+0x2d4
V [libjvm.dylib+0x5c5144] Dependencies::DepStream::log_dependency(Klass*)+0x258
V [libjvm.dylib+0x5c9ab0] Dependencies::DepStream::check_new_klass_dependency(NewKlassDepChange*)+0x3ec
V [libjvm.dylib+0x5c2f88] Dependencies::DepStream::check_dependency()+0x40
V [libjvm.dylib+0x5c2cf4] Dependencies::validate_dependencies(CompileTask*, char**)+0x16c
V [libjvm.dylib+0x3fbc68] ciEnv::validate_compile_task_dependencies(ciMethod*)+0x3c
V [libjvm.dylib+0x3fc11c] ciEnv::register_method(ciMethod*, int, CodeOffsets*, int, CodeBuffer*, int, OopMapSet*, ExceptionHandlerTable*, ImplicitExceptionTable*, AbstractCompiler*, bool, bool, bool, bool, bool, int, bool, SCCEntry*)+0x3e4
get_metadata() is called here:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/code/dependencies.cpp#L695
- links to
-
Commit(master) openjdk/jdk/88eff4c3
-
Review(master) openjdk/jdk/20187