# HG changeset patch # User Doug Simon # Date 1407187514 -7200 # Node ID 4d0d1dc5db0039a0c7a0a1f127819b222b49a3a1 # Parent 63706366f6c50860ec4c4bf7094d2e461be58098 introduce extra field to record when HotSpotGraalRuntime has been initialized to avoid spurious errors during VM shutdown for short lived applications diff -r 63706366f6c5 -r 4d0d1dc5db00 src/share/vm/graal/graalRuntime.cpp --- a/src/share/vm/graal/graalRuntime.cpp Mon Aug 04 16:50:50 2014 +0200 +++ b/src/share/vm/graal/graalRuntime.cpp Mon Aug 04 23:25:14 2014 +0200 @@ -39,6 +39,7 @@ address GraalRuntime::_external_deopt_i2c_entry = NULL; jobject GraalRuntime::_HotSpotGraalRuntime_instance = NULL; +bool GraalRuntime::_HotSpotGraalRuntime_initialized = false; void GraalRuntime::initialize_natives(JNIEnv *env, jclass c2vmClass) { uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end(); @@ -681,6 +682,7 @@ Handle GraalRuntime::get_HotSpotGraalRuntime() { if (JNIHandles::resolve(_HotSpotGraalRuntime_instance) == NULL) { + guarantee(!_HotSpotGraalRuntime_initialized, "cannot reinitialize HotSpotGraalRuntime"); Thread* THREAD = Thread::current(); check_generated_sources_sha1(CHECK_ABORT_(Handle())); TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", CHECK_ABORT_(Handle())); @@ -690,6 +692,7 @@ JavaValue result(T_OBJECT); JavaCalls::call_static(&result, klass, runtime, sig, CHECK_ABORT_(Handle())); _HotSpotGraalRuntime_instance = JNIHandles::make_global((oop) result.get_jobject()); + _HotSpotGraalRuntime_initialized = true; } return Handle(JNIHandles::resolve_non_null(_HotSpotGraalRuntime_instance)); } diff -r 63706366f6c5 -r 4d0d1dc5db00 src/share/vm/graal/graalRuntime.hpp --- a/src/share/vm/graal/graalRuntime.hpp Mon Aug 04 16:50:50 2014 +0200 +++ b/src/share/vm/graal/graalRuntime.hpp Mon Aug 04 23:25:14 2014 +0200 @@ -32,6 +32,7 @@ private: static jobject _HotSpotGraalRuntime_instance; + static bool _HotSpotGraalRuntime_initialized; static address _external_deopt_i2c_entry; static const char* _generated_sources_sha1; @@ -111,7 +112,7 @@ static void initialize_natives(JNIEnv *env, jclass c2vmClass); - static bool is_HotSpotGraalRuntime_initialized() { return _HotSpotGraalRuntime_instance != NULL; } + static bool is_HotSpotGraalRuntime_initialized() { return _HotSpotGraalRuntime_initialized; } /** * Gets the singleton HotSpotGraalRuntime instance, initializing it if necessary