comparison src/share/vm/jvmci/jvmciRuntime.cpp @ 22650:939d5da65929

reduced delta against jvmci-9
author Doug Simon <doug.simon@oracle.com>
date Fri, 02 Oct 2015 10:13:56 +0200
parents 28b99a7a37d0
children da5bdbf4a008
comparison
equal deleted inserted replaced
22649:5cd42bb63fad 22650:939d5da65929
53 int JVMCIRuntime::_trivial_prefixes_count = 0; 53 int JVMCIRuntime::_trivial_prefixes_count = 0;
54 char** JVMCIRuntime::_trivial_prefixes = NULL; 54 char** JVMCIRuntime::_trivial_prefixes = NULL;
55 bool JVMCIRuntime::_shutdown_called = false; 55 bool JVMCIRuntime::_shutdown_called = false;
56 56
57 static const char* OPTION_PREFIX = "jvmci.option."; 57 static const char* OPTION_PREFIX = "jvmci.option.";
58 static const int OPTION_PREFIX_LEN = (int)strlen(OPTION_PREFIX); 58 static const size_t OPTION_PREFIX_LEN = strlen(OPTION_PREFIX);
59
60 void JVMCIRuntime::initialize_natives(JNIEnv *env, jclass c2vmClass) {
61 #ifdef _LP64
62 #ifndef TARGET_ARCH_sparc
63 uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end();
64 uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024;
65 guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)");
66 #endif // TARGET_ARCH_sparc
67 #else
68 fatal("check TLAB allocation code for address space conflicts");
69 #endif
70
71 ensure_jvmci_class_loader_is_initialized();
72
73 JavaThread* THREAD = JavaThread::current();
74 {
75 ThreadToNativeFromVM trans(THREAD);
76
77 ResourceMark rm;
78 HandleMark hm;
79
80 jvmci_compute_offsets();
81
82 // Ensure _non_oop_bits is initialized
83 Universe::non_oop_word();
84
85 env->RegisterNatives(c2vmClass, CompilerToVM::methods, CompilerToVM::methods_count());
86 }
87 if (HAS_PENDING_EXCEPTION) {
88 abort_on_pending_exception(PENDING_EXCEPTION, "Could not register natives");
89 }
90 }
91 59
92 BasicType JVMCIRuntime::kindToBasicType(jchar ch) { 60 BasicType JVMCIRuntime::kindToBasicType(jchar ch) {
93 switch(ch) { 61 switch(ch) {
94 case 'z': return T_BOOLEAN; 62 case 'z': return T_BOOLEAN;
95 case 'b': return T_BYTE; 63 case 'b': return T_BYTE;
779 747
780 // These must be loaded at this point but the linking state doesn't matter. 748 // These must be loaded at this point but the linking state doesn't matter.
781 assert(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass() != NULL, "must be loaded"); 749 assert(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass() != NULL, "must be loaded");
782 assert(SystemDictionary::HotSpotConstantPool_klass() != NULL, "must be loaded"); 750 assert(SystemDictionary::HotSpotConstantPool_klass() != NULL, "must be loaded");
783 assert(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass() != NULL, "must be loaded"); 751 assert(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass() != NULL, "must be loaded");
784 752
785 for (int i = 0; i < allContexts->length(); i++) { 753 for (int i = 0; i < allContexts->length(); i++) {
786 oop ref = allContexts->obj_at(i); 754 oop ref = allContexts->obj_at(i);
787 if (ref != NULL) { 755 if (ref != NULL) {
788 oop referent = java_lang_ref_Reference::referent(ref); 756 oop referent = java_lang_ref_Reference::referent(ref);
789 if (referent != NULL) { 757 if (referent != NULL) {
819 } 787 }
820 } 788 }
821 } 789 }
822 } 790 }
823 791
824 // private static void CompilerToVM.init() 792 // private static void CompilerToVM.registerNatives()
825 JVM_ENTRY(void, JVM_InitializeJVMCINatives(JNIEnv *env, jclass c2vmClass)) 793 JVM_ENTRY(void, JVM_RegisterJVMCINatives(JNIEnv *env, jclass c2vmClass))
826 JVMCIRuntime::initialize_natives(env, c2vmClass); 794 #ifdef _LP64
795 #ifndef TARGET_ARCH_sparc
796 uintptr_t heap_end = (uintptr_t) Universe::heap()->reserved_region().end();
797 uintptr_t allocation_end = heap_end + ((uintptr_t)16) * 1024 * 1024 * 1024;
798 guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)");
799 #endif // TARGET_ARCH_sparc
800 #else
801 fatal("check TLAB allocation code for address space conflicts");
802 #endif
803
804 JVMCIRuntime::ensure_jvmci_class_loader_is_initialized();
805
806 {
807 ThreadToNativeFromVM trans(thread);
808
809 ResourceMark rm;
810 HandleMark hm;
811
812 jvmci_compute_offsets();
813
814 // Ensure _non_oop_bits is initialized
815 Universe::non_oop_word();
816
817 env->RegisterNatives(c2vmClass, CompilerToVM::methods, CompilerToVM::methods_count());
818 }
819 if (HAS_PENDING_EXCEPTION) {
820 JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, "Could not register natives");
821 }
827 JVM_END 822 JVM_END
828 823
829 void JVMCIRuntime::ensure_jvmci_class_loader_is_initialized() { 824 void JVMCIRuntime::ensure_jvmci_class_loader_is_initialized() {
830 // This initialization code is guarded by a static pointer to the Factory class. 825 // This initialization code is guarded by a static pointer to the Factory class.
831 // Once it is non-null, the JVMCI class loader and well known JVMCI classes are 826 // Once it is non-null, the JVMCI class loader and well known JVMCI classes are