Mercurial > hg > graal-jvmci-8
comparison 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 |
comparison
equal
deleted
inserted
replaced
16682:63706366f6c5 | 16683:4d0d1dc5db00 |
---|---|
37 #include "runtime/reflection.hpp" | 37 #include "runtime/reflection.hpp" |
38 #include "utilities/debug.hpp" | 38 #include "utilities/debug.hpp" |
39 | 39 |
40 address GraalRuntime::_external_deopt_i2c_entry = NULL; | 40 address GraalRuntime::_external_deopt_i2c_entry = NULL; |
41 jobject GraalRuntime::_HotSpotGraalRuntime_instance = NULL; | 41 jobject GraalRuntime::_HotSpotGraalRuntime_instance = NULL; |
42 bool GraalRuntime::_HotSpotGraalRuntime_initialized = false; | |
42 | 43 |
43 void GraalRuntime::initialize_natives(JNIEnv *env, jclass c2vmClass) { | 44 void GraalRuntime::initialize_natives(JNIEnv *env, jclass c2vmClass) { |
44 uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end(); | 45 uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end(); |
45 uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024; | 46 uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024; |
46 AMD64_ONLY(guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)")); | 47 AMD64_ONLY(guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)")); |
679 } | 680 } |
680 } | 681 } |
681 | 682 |
682 Handle GraalRuntime::get_HotSpotGraalRuntime() { | 683 Handle GraalRuntime::get_HotSpotGraalRuntime() { |
683 if (JNIHandles::resolve(_HotSpotGraalRuntime_instance) == NULL) { | 684 if (JNIHandles::resolve(_HotSpotGraalRuntime_instance) == NULL) { |
685 guarantee(!_HotSpotGraalRuntime_initialized, "cannot reinitialize HotSpotGraalRuntime"); | |
684 Thread* THREAD = Thread::current(); | 686 Thread* THREAD = Thread::current(); |
685 check_generated_sources_sha1(CHECK_ABORT_(Handle())); | 687 check_generated_sources_sha1(CHECK_ABORT_(Handle())); |
686 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", CHECK_ABORT_(Handle())); | 688 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", CHECK_ABORT_(Handle())); |
687 KlassHandle klass = load_required_class(name); | 689 KlassHandle klass = load_required_class(name); |
688 TempNewSymbol runtime = SymbolTable::new_symbol("runtime", CHECK_ABORT_(Handle())); | 690 TempNewSymbol runtime = SymbolTable::new_symbol("runtime", CHECK_ABORT_(Handle())); |
689 TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/graal/hotspot/HotSpotGraalRuntime;", CHECK_ABORT_(Handle())); | 691 TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/graal/hotspot/HotSpotGraalRuntime;", CHECK_ABORT_(Handle())); |
690 JavaValue result(T_OBJECT); | 692 JavaValue result(T_OBJECT); |
691 JavaCalls::call_static(&result, klass, runtime, sig, CHECK_ABORT_(Handle())); | 693 JavaCalls::call_static(&result, klass, runtime, sig, CHECK_ABORT_(Handle())); |
692 _HotSpotGraalRuntime_instance = JNIHandles::make_global((oop) result.get_jobject()); | 694 _HotSpotGraalRuntime_instance = JNIHandles::make_global((oop) result.get_jobject()); |
695 _HotSpotGraalRuntime_initialized = true; | |
693 } | 696 } |
694 return Handle(JNIHandles::resolve_non_null(_HotSpotGraalRuntime_instance)); | 697 return Handle(JNIHandles::resolve_non_null(_HotSpotGraalRuntime_instance)); |
695 } | 698 } |
696 | 699 |
697 // private static void CompilerToVMImpl.init() | 700 // private static void CompilerToVMImpl.init() |