Mercurial > hg > truffle
changeset 18303:ab47ef2f2207
disable blocking compilation requests once GraalRuntime::shutdown has been called
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 07 Nov 2014 12:35:58 +0100 |
parents | fb289eb7243d |
children | bf586af6fa0c |
files | src/share/vm/compiler/compileBroker.cpp src/share/vm/graal/graalRuntime.cpp src/share/vm/graal/graalRuntime.hpp |
diffstat | 3 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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);
--- 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