Mercurial > hg > graal-compiler
diff src/share/vm/graal/graalRuntime.cpp @ 16683:4d0d1dc5db00
introduce extra field to record when HotSpotGraalRuntime has been initialized to avoid spurious errors during VM shutdown for short lived applications
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 04 Aug 2014 23:25:14 +0200 |
parents | 58622d6b1097 |
children | dd8449afc086 |
line wrap: on
line diff
--- 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)); }