# HG changeset patch # User Doug Simon # Date 1415360158 -3600 # Node ID ab47ef2f220731a62aa1b9c545928288f231017a # Parent fb289eb7243d9dd3c7bfda3254bac90d6e9bb42c disable blocking compilation requests once GraalRuntime::shutdown has been called diff -r fb289eb7243d -r ab47ef2f2207 src/share/vm/compiler/compileBroker.cpp --- a/src/share/vm/compiler/compileBroker.cpp Fri Nov 07 12:34:18 2014 +0100 +++ b/src/share/vm/compiler/compileBroker.cpp Fri Nov 07 12:35:58 2014 +0100 @@ -1212,6 +1212,13 @@ if (!GraalRuntime::is_HotSpotGraalRuntime_initialized() && compiler(comp_level)->is_graal()) { blocking = false; } + + // Don't allow blocking compilation requests if we are in GraalRuntime::shutdown + // to avoid deadlock between compiler thread(s) and threads run at shutdown + // such as the DestroyJavaVM thread. + if (GraalRuntime::shutdown_called()) { + blocking = false; + } } // Don't allow blocking compiles #endif diff -r fb289eb7243d -r ab47ef2f2207 src/share/vm/graal/graalRuntime.cpp --- a/src/share/vm/graal/graalRuntime.cpp Fri Nov 07 12:34:18 2014 +0100 +++ b/src/share/vm/graal/graalRuntime.cpp Fri Nov 07 12:35:58 2014 +0100 @@ -41,6 +41,7 @@ address GraalRuntime::_external_deopt_i2c_entry = NULL; jobject GraalRuntime::_HotSpotGraalRuntime_instance = NULL; bool GraalRuntime::_HotSpotGraalRuntime_initialized = false; +bool GraalRuntime::_shutdown_called = false; void GraalRuntime::initialize_natives(JNIEnv *env, jclass c2vmClass) { uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end(); @@ -989,6 +990,7 @@ void GraalRuntime::shutdown() { if (_HotSpotGraalRuntime_instance != NULL) { + _shutdown_called = true; JavaThread* THREAD = JavaThread::current(); HandleMark hm(THREAD); TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", CHECK_ABORT); diff -r fb289eb7243d -r ab47ef2f2207 src/share/vm/graal/graalRuntime.hpp --- a/src/share/vm/graal/graalRuntime.hpp Fri Nov 07 12:34:18 2014 +0100 +++ b/src/share/vm/graal/graalRuntime.hpp Fri Nov 07 12:35:58 2014 +0100 @@ -36,6 +36,8 @@ static address _external_deopt_i2c_entry; static const char* _generated_sources_sha1; + static bool _shutdown_called; + /** * Reads the OptionValue object from a specified static field. * @@ -141,6 +143,10 @@ static void shutdown(); + static bool shutdown_called() { + return _shutdown_called; + } + /** * Given an interface representing a Graal service (i.e. sub-interface of * com.oracle.graal.api.runtime.Service), gets an array of objects, one per