Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/thread.cpp @ 2177:3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
Summary: move symbols from permgen into C heap and reference count them
Reviewed-by: never, acorn, jmasa, stefank
author | coleenp |
---|---|
date | Thu, 27 Jan 2011 16:11:27 -0800 |
parents | ccfcb502af3f |
children | d25d4ca69222 fb539912d338 f36c9fe788b8 |
comparison
equal
deleted
inserted
replaced
2176:27e4ea99855d | 2177:3582bf76420e |
---|---|
35 #include "memory/oopFactory.hpp" | 35 #include "memory/oopFactory.hpp" |
36 #include "memory/universe.inline.hpp" | 36 #include "memory/universe.inline.hpp" |
37 #include "oops/instanceKlass.hpp" | 37 #include "oops/instanceKlass.hpp" |
38 #include "oops/objArrayOop.hpp" | 38 #include "oops/objArrayOop.hpp" |
39 #include "oops/oop.inline.hpp" | 39 #include "oops/oop.inline.hpp" |
40 #include "oops/symbolOop.hpp" | 40 #include "oops/symbol.hpp" |
41 #include "prims/jvm_misc.hpp" | 41 #include "prims/jvm_misc.hpp" |
42 #include "prims/jvmtiExport.hpp" | 42 #include "prims/jvmtiExport.hpp" |
43 #include "prims/jvmtiThreadState.hpp" | 43 #include "prims/jvmtiThreadState.hpp" |
44 #include "prims/privilegedStack.hpp" | 44 #include "prims/privilegedStack.hpp" |
45 #include "runtime/aprofiler.hpp" | 45 #include "runtime/aprofiler.hpp" |
889 bool Thread::set_as_starting_thread() { | 889 bool Thread::set_as_starting_thread() { |
890 // NOTE: this must be called inside the main thread. | 890 // NOTE: this must be called inside the main thread. |
891 return os::create_main_thread((JavaThread*)this); | 891 return os::create_main_thread((JavaThread*)this); |
892 } | 892 } |
893 | 893 |
894 static void initialize_class(symbolHandle class_name, TRAPS) { | 894 static void initialize_class(Symbol* class_name, TRAPS) { |
895 klassOop klass = SystemDictionary::resolve_or_fail(class_name, true, CHECK); | 895 klassOop klass = SystemDictionary::resolve_or_fail(class_name, true, CHECK); |
896 instanceKlass::cast(klass)->initialize(CHECK); | 896 instanceKlass::cast(klass)->initialize(CHECK); |
897 } | 897 } |
898 | 898 |
899 | 899 |
900 // Creates the initial ThreadGroup | 900 // Creates the initial ThreadGroup |
901 static Handle create_initial_thread_group(TRAPS) { | 901 static Handle create_initial_thread_group(TRAPS) { |
902 klassOop k = SystemDictionary::resolve_or_fail(vmSymbolHandles::java_lang_ThreadGroup(), true, CHECK_NH); | 902 klassOop k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_ThreadGroup(), true, CHECK_NH); |
903 instanceKlassHandle klass (THREAD, k); | 903 instanceKlassHandle klass (THREAD, k); |
904 | 904 |
905 Handle system_instance = klass->allocate_instance_handle(CHECK_NH); | 905 Handle system_instance = klass->allocate_instance_handle(CHECK_NH); |
906 { | 906 { |
907 JavaValue result(T_VOID); | 907 JavaValue result(T_VOID); |
908 JavaCalls::call_special(&result, | 908 JavaCalls::call_special(&result, |
909 system_instance, | 909 system_instance, |
910 klass, | 910 klass, |
911 vmSymbolHandles::object_initializer_name(), | 911 vmSymbols::object_initializer_name(), |
912 vmSymbolHandles::void_method_signature(), | 912 vmSymbols::void_method_signature(), |
913 CHECK_NH); | 913 CHECK_NH); |
914 } | 914 } |
915 Universe::set_system_thread_group(system_instance()); | 915 Universe::set_system_thread_group(system_instance()); |
916 | 916 |
917 Handle main_instance = klass->allocate_instance_handle(CHECK_NH); | 917 Handle main_instance = klass->allocate_instance_handle(CHECK_NH); |
919 JavaValue result(T_VOID); | 919 JavaValue result(T_VOID); |
920 Handle string = java_lang_String::create_from_str("main", CHECK_NH); | 920 Handle string = java_lang_String::create_from_str("main", CHECK_NH); |
921 JavaCalls::call_special(&result, | 921 JavaCalls::call_special(&result, |
922 main_instance, | 922 main_instance, |
923 klass, | 923 klass, |
924 vmSymbolHandles::object_initializer_name(), | 924 vmSymbols::object_initializer_name(), |
925 vmSymbolHandles::threadgroup_string_void_signature(), | 925 vmSymbols::threadgroup_string_void_signature(), |
926 system_instance, | 926 system_instance, |
927 string, | 927 string, |
928 CHECK_NH); | 928 CHECK_NH); |
929 } | 929 } |
930 return main_instance; | 930 return main_instance; |
931 } | 931 } |
932 | 932 |
933 // Creates the initial Thread | 933 // Creates the initial Thread |
934 static oop create_initial_thread(Handle thread_group, JavaThread* thread, TRAPS) { | 934 static oop create_initial_thread(Handle thread_group, JavaThread* thread, TRAPS) { |
935 klassOop k = SystemDictionary::resolve_or_fail(vmSymbolHandles::java_lang_Thread(), true, CHECK_NULL); | 935 klassOop k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK_NULL); |
936 instanceKlassHandle klass (THREAD, k); | 936 instanceKlassHandle klass (THREAD, k); |
937 instanceHandle thread_oop = klass->allocate_instance_handle(CHECK_NULL); | 937 instanceHandle thread_oop = klass->allocate_instance_handle(CHECK_NULL); |
938 | 938 |
939 java_lang_Thread::set_thread(thread_oop(), thread); | 939 java_lang_Thread::set_thread(thread_oop(), thread); |
940 java_lang_Thread::set_priority(thread_oop(), NormPriority); | 940 java_lang_Thread::set_priority(thread_oop(), NormPriority); |
943 Handle string = java_lang_String::create_from_str("main", CHECK_NULL); | 943 Handle string = java_lang_String::create_from_str("main", CHECK_NULL); |
944 | 944 |
945 JavaValue result(T_VOID); | 945 JavaValue result(T_VOID); |
946 JavaCalls::call_special(&result, thread_oop, | 946 JavaCalls::call_special(&result, thread_oop, |
947 klass, | 947 klass, |
948 vmSymbolHandles::object_initializer_name(), | 948 vmSymbols::object_initializer_name(), |
949 vmSymbolHandles::threadgroup_string_void_signature(), | 949 vmSymbols::threadgroup_string_void_signature(), |
950 thread_group, | 950 thread_group, |
951 string, | 951 string, |
952 CHECK_NULL); | 952 CHECK_NULL); |
953 return thread_oop(); | 953 return thread_oop(); |
954 } | 954 } |
955 | 955 |
956 static void call_initializeSystemClass(TRAPS) { | 956 static void call_initializeSystemClass(TRAPS) { |
957 klassOop k = SystemDictionary::resolve_or_fail(vmSymbolHandles::java_lang_System(), true, CHECK); | 957 klassOop k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK); |
958 instanceKlassHandle klass (THREAD, k); | 958 instanceKlassHandle klass (THREAD, k); |
959 | 959 |
960 JavaValue result(T_VOID); | 960 JavaValue result(T_VOID); |
961 JavaCalls::call_static(&result, klass, vmSymbolHandles::initializeSystemClass_name(), | 961 JavaCalls::call_static(&result, klass, vmSymbols::initializeSystemClass_name(), |
962 vmSymbolHandles::void_method_signature(), CHECK); | 962 vmSymbols::void_method_signature(), CHECK); |
963 } | 963 } |
964 | 964 |
965 #ifdef KERNEL | 965 #ifdef KERNEL |
966 static void set_jkernel_boot_classloader_hook(TRAPS) { | 966 static void set_jkernel_boot_classloader_hook(TRAPS) { |
967 klassOop k = SystemDictionary::sun_jkernel_DownloadManager_klass(); | 967 klassOop k = SystemDictionary::sun_jkernel_DownloadManager_klass(); |
971 // sun.jkernel.DownloadManager may not present in the JDK; just return | 971 // sun.jkernel.DownloadManager may not present in the JDK; just return |
972 return; | 972 return; |
973 } | 973 } |
974 | 974 |
975 JavaValue result(T_VOID); | 975 JavaValue result(T_VOID); |
976 JavaCalls::call_static(&result, klass, vmSymbolHandles::setBootClassLoaderHook_name(), | 976 JavaCalls::call_static(&result, klass, vmSymbols::setBootClassLoaderHook_name(), |
977 vmSymbolHandles::void_method_signature(), CHECK); | 977 vmSymbols::void_method_signature(), CHECK); |
978 } | 978 } |
979 #endif // KERNEL | 979 #endif // KERNEL |
980 | 980 |
981 // General purpose hook into Java code, run once when the VM is initialized. | 981 // General purpose hook into Java code, run once when the VM is initialized. |
982 // The Java library method itself may be changed independently from the VM. | 982 // The Java library method itself may be changed independently from the VM. |
983 static void call_postVMInitHook(TRAPS) { | 983 static void call_postVMInitHook(TRAPS) { |
984 klassOop k = SystemDictionary::sun_misc_PostVMInitHook_klass(); | 984 klassOop k = SystemDictionary::sun_misc_PostVMInitHook_klass(); |
985 instanceKlassHandle klass (THREAD, k); | 985 instanceKlassHandle klass (THREAD, k); |
986 if (klass.not_null()) { | 986 if (klass.not_null()) { |
987 JavaValue result(T_VOID); | 987 JavaValue result(T_VOID); |
988 JavaCalls::call_static(&result, klass, vmSymbolHandles::run_method_name(), | 988 JavaCalls::call_static(&result, klass, vmSymbols::run_method_name(), |
989 vmSymbolHandles::void_method_signature(), | 989 vmSymbols::void_method_signature(), |
990 CHECK); | 990 CHECK); |
991 } | 991 } |
992 } | 992 } |
993 | 993 |
994 static void reset_vm_info_property(TRAPS) { | 994 static void reset_vm_info_property(TRAPS) { |
995 // the vm info string | 995 // the vm info string |
996 ResourceMark rm(THREAD); | 996 ResourceMark rm(THREAD); |
997 const char *vm_info = VM_Version::vm_info_string(); | 997 const char *vm_info = VM_Version::vm_info_string(); |
998 | 998 |
999 // java.lang.System class | 999 // java.lang.System class |
1000 klassOop k = SystemDictionary::resolve_or_fail(vmSymbolHandles::java_lang_System(), true, CHECK); | 1000 klassOop k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK); |
1001 instanceKlassHandle klass (THREAD, k); | 1001 instanceKlassHandle klass (THREAD, k); |
1002 | 1002 |
1003 // setProperty arguments | 1003 // setProperty arguments |
1004 Handle key_str = java_lang_String::create_from_str("java.vm.info", CHECK); | 1004 Handle key_str = java_lang_String::create_from_str("java.vm.info", CHECK); |
1005 Handle value_str = java_lang_String::create_from_str(vm_info, CHECK); | 1005 Handle value_str = java_lang_String::create_from_str(vm_info, CHECK); |
1008 JavaValue r(T_OBJECT); | 1008 JavaValue r(T_OBJECT); |
1009 | 1009 |
1010 // public static String setProperty(String key, String value); | 1010 // public static String setProperty(String key, String value); |
1011 JavaCalls::call_static(&r, | 1011 JavaCalls::call_static(&r, |
1012 klass, | 1012 klass, |
1013 vmSymbolHandles::setProperty_name(), | 1013 vmSymbols::setProperty_name(), |
1014 vmSymbolHandles::string_string_string_signature(), | 1014 vmSymbols::string_string_string_signature(), |
1015 key_str, | 1015 key_str, |
1016 value_str, | 1016 value_str, |
1017 CHECK); | 1017 CHECK); |
1018 } | 1018 } |
1019 | 1019 |
1020 | 1020 |
1021 void JavaThread::allocate_threadObj(Handle thread_group, char* thread_name, bool daemon, TRAPS) { | 1021 void JavaThread::allocate_threadObj(Handle thread_group, char* thread_name, bool daemon, TRAPS) { |
1022 assert(thread_group.not_null(), "thread group should be specified"); | 1022 assert(thread_group.not_null(), "thread group should be specified"); |
1023 assert(threadObj() == NULL, "should only create Java thread object once"); | 1023 assert(threadObj() == NULL, "should only create Java thread object once"); |
1024 | 1024 |
1025 klassOop k = SystemDictionary::resolve_or_fail(vmSymbolHandles::java_lang_Thread(), true, CHECK); | 1025 klassOop k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK); |
1026 instanceKlassHandle klass (THREAD, k); | 1026 instanceKlassHandle klass (THREAD, k); |
1027 instanceHandle thread_oop = klass->allocate_instance_handle(CHECK); | 1027 instanceHandle thread_oop = klass->allocate_instance_handle(CHECK); |
1028 | 1028 |
1029 java_lang_Thread::set_thread(thread_oop(), this); | 1029 java_lang_Thread::set_thread(thread_oop(), this); |
1030 java_lang_Thread::set_priority(thread_oop(), NormPriority); | 1030 java_lang_Thread::set_priority(thread_oop(), NormPriority); |
1035 Handle name = java_lang_String::create_from_str(thread_name, CHECK); | 1035 Handle name = java_lang_String::create_from_str(thread_name, CHECK); |
1036 // Thread gets assigned specified name and null target | 1036 // Thread gets assigned specified name and null target |
1037 JavaCalls::call_special(&result, | 1037 JavaCalls::call_special(&result, |
1038 thread_oop, | 1038 thread_oop, |
1039 klass, | 1039 klass, |
1040 vmSymbolHandles::object_initializer_name(), | 1040 vmSymbols::object_initializer_name(), |
1041 vmSymbolHandles::threadgroup_string_void_signature(), | 1041 vmSymbols::threadgroup_string_void_signature(), |
1042 thread_group, // Argument 1 | 1042 thread_group, // Argument 1 |
1043 name, // Argument 2 | 1043 name, // Argument 2 |
1044 THREAD); | 1044 THREAD); |
1045 } else { | 1045 } else { |
1046 // Thread gets assigned name "Thread-nnn" and null target | 1046 // Thread gets assigned name "Thread-nnn" and null target |
1047 // (java.lang.Thread doesn't have a constructor taking only a ThreadGroup argument) | 1047 // (java.lang.Thread doesn't have a constructor taking only a ThreadGroup argument) |
1048 JavaCalls::call_special(&result, | 1048 JavaCalls::call_special(&result, |
1049 thread_oop, | 1049 thread_oop, |
1050 klass, | 1050 klass, |
1051 vmSymbolHandles::object_initializer_name(), | 1051 vmSymbols::object_initializer_name(), |
1052 vmSymbolHandles::threadgroup_runnable_void_signature(), | 1052 vmSymbols::threadgroup_runnable_void_signature(), |
1053 thread_group, // Argument 1 | 1053 thread_group, // Argument 1 |
1054 Handle(), // Argument 2 | 1054 Handle(), // Argument 2 |
1055 THREAD); | 1055 THREAD); |
1056 } | 1056 } |
1057 | 1057 |
1068 Handle threadObj(this, this->threadObj()); | 1068 Handle threadObj(this, this->threadObj()); |
1069 | 1069 |
1070 JavaCalls::call_special(&result, | 1070 JavaCalls::call_special(&result, |
1071 thread_group, | 1071 thread_group, |
1072 group, | 1072 group, |
1073 vmSymbolHandles::add_method_name(), | 1073 vmSymbols::add_method_name(), |
1074 vmSymbolHandles::thread_void_signature(), | 1074 vmSymbols::thread_void_signature(), |
1075 threadObj, // Arg 1 | 1075 threadObj, // Arg 1 |
1076 THREAD); | 1076 THREAD); |
1077 | 1077 |
1078 | 1078 |
1079 } | 1079 } |
1585 // so call ThreadGroup.uncaughtException() | 1585 // so call ThreadGroup.uncaughtException() |
1586 KlassHandle recvrKlass(THREAD, threadObj->klass()); | 1586 KlassHandle recvrKlass(THREAD, threadObj->klass()); |
1587 CallInfo callinfo; | 1587 CallInfo callinfo; |
1588 KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass()); | 1588 KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass()); |
1589 LinkResolver::resolve_virtual_call(callinfo, threadObj, recvrKlass, thread_klass, | 1589 LinkResolver::resolve_virtual_call(callinfo, threadObj, recvrKlass, thread_klass, |
1590 vmSymbolHandles::dispatchUncaughtException_name(), | 1590 vmSymbols::dispatchUncaughtException_name(), |
1591 vmSymbolHandles::throwable_void_signature(), | 1591 vmSymbols::throwable_void_signature(), |
1592 KlassHandle(), false, false, THREAD); | 1592 KlassHandle(), false, false, THREAD); |
1593 CLEAR_PENDING_EXCEPTION; | 1593 CLEAR_PENDING_EXCEPTION; |
1594 methodHandle method = callinfo.selected_method(); | 1594 methodHandle method = callinfo.selected_method(); |
1595 if (method.not_null()) { | 1595 if (method.not_null()) { |
1596 JavaValue result(T_VOID); | 1596 JavaValue result(T_VOID); |
1597 JavaCalls::call_virtual(&result, | 1597 JavaCalls::call_virtual(&result, |
1598 threadObj, thread_klass, | 1598 threadObj, thread_klass, |
1599 vmSymbolHandles::dispatchUncaughtException_name(), | 1599 vmSymbols::dispatchUncaughtException_name(), |
1600 vmSymbolHandles::throwable_void_signature(), | 1600 vmSymbols::throwable_void_signature(), |
1601 uncaught_exception, | 1601 uncaught_exception, |
1602 THREAD); | 1602 THREAD); |
1603 } else { | 1603 } else { |
1604 KlassHandle thread_group(THREAD, SystemDictionary::ThreadGroup_klass()); | 1604 KlassHandle thread_group(THREAD, SystemDictionary::ThreadGroup_klass()); |
1605 JavaValue result(T_VOID); | 1605 JavaValue result(T_VOID); |
1606 JavaCalls::call_virtual(&result, | 1606 JavaCalls::call_virtual(&result, |
1607 group, thread_group, | 1607 group, thread_group, |
1608 vmSymbolHandles::uncaughtException_name(), | 1608 vmSymbols::uncaughtException_name(), |
1609 vmSymbolHandles::thread_throwable_void_signature(), | 1609 vmSymbols::thread_throwable_void_signature(), |
1610 threadObj, // Arg 1 | 1610 threadObj, // Arg 1 |
1611 uncaught_exception, // Arg 2 | 1611 uncaught_exception, // Arg 2 |
1612 THREAD); | 1612 THREAD); |
1613 } | 1613 } |
1614 CLEAR_PENDING_EXCEPTION; | 1614 CLEAR_PENDING_EXCEPTION; |
1623 EXCEPTION_MARK; | 1623 EXCEPTION_MARK; |
1624 JavaValue result(T_VOID); | 1624 JavaValue result(T_VOID); |
1625 KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass()); | 1625 KlassHandle thread_klass(THREAD, SystemDictionary::Thread_klass()); |
1626 JavaCalls::call_virtual(&result, | 1626 JavaCalls::call_virtual(&result, |
1627 threadObj, thread_klass, | 1627 threadObj, thread_klass, |
1628 vmSymbolHandles::exit_method_name(), | 1628 vmSymbols::exit_method_name(), |
1629 vmSymbolHandles::void_method_signature(), | 1629 vmSymbols::void_method_signature(), |
1630 THREAD); | 1630 THREAD); |
1631 CLEAR_PENDING_EXCEPTION; | 1631 CLEAR_PENDING_EXCEPTION; |
1632 } | 1632 } |
1633 } | 1633 } |
1634 | 1634 |
3151 if (EagerXrunInit && Arguments::init_libraries_at_startup()) { | 3151 if (EagerXrunInit && Arguments::init_libraries_at_startup()) { |
3152 create_vm_init_libraries(); | 3152 create_vm_init_libraries(); |
3153 } | 3153 } |
3154 | 3154 |
3155 if (InitializeJavaLangString) { | 3155 if (InitializeJavaLangString) { |
3156 initialize_class(vmSymbolHandles::java_lang_String(), CHECK_0); | 3156 initialize_class(vmSymbols::java_lang_String(), CHECK_0); |
3157 } else { | 3157 } else { |
3158 warning("java.lang.String not initialized"); | 3158 warning("java.lang.String not initialized"); |
3159 } | 3159 } |
3160 | 3160 |
3161 if (AggressiveOpts) { | 3161 if (AggressiveOpts) { |
3162 { | 3162 { |
3163 // Forcibly initialize java/util/HashMap and mutate the private | 3163 // Forcibly initialize java/util/HashMap and mutate the private |
3164 // static final "frontCacheEnabled" field before we start creating instances | 3164 // static final "frontCacheEnabled" field before we start creating instances |
3165 #ifdef ASSERT | 3165 #ifdef ASSERT |
3166 klassOop tmp_k = SystemDictionary::find(vmSymbolHandles::java_util_HashMap(), Handle(), Handle(), CHECK_0); | 3166 klassOop tmp_k = SystemDictionary::find(vmSymbols::java_util_HashMap(), Handle(), Handle(), CHECK_0); |
3167 assert(tmp_k == NULL, "java/util/HashMap should not be loaded yet"); | 3167 assert(tmp_k == NULL, "java/util/HashMap should not be loaded yet"); |
3168 #endif | 3168 #endif |
3169 klassOop k_o = SystemDictionary::resolve_or_null(vmSymbolHandles::java_util_HashMap(), Handle(), Handle(), CHECK_0); | 3169 klassOop k_o = SystemDictionary::resolve_or_null(vmSymbols::java_util_HashMap(), Handle(), Handle(), CHECK_0); |
3170 KlassHandle k = KlassHandle(THREAD, k_o); | 3170 KlassHandle k = KlassHandle(THREAD, k_o); |
3171 guarantee(k.not_null(), "Must find java/util/HashMap"); | 3171 guarantee(k.not_null(), "Must find java/util/HashMap"); |
3172 instanceKlassHandle ik = instanceKlassHandle(THREAD, k()); | 3172 instanceKlassHandle ik = instanceKlassHandle(THREAD, k()); |
3173 ik->initialize(CHECK_0); | 3173 ik->initialize(CHECK_0); |
3174 fieldDescriptor fd; | 3174 fieldDescriptor fd; |
3179 } | 3179 } |
3180 | 3180 |
3181 if (UseStringCache) { | 3181 if (UseStringCache) { |
3182 // Forcibly initialize java/lang/StringValue and mutate the private | 3182 // Forcibly initialize java/lang/StringValue and mutate the private |
3183 // static final "stringCacheEnabled" field before we start creating instances | 3183 // static final "stringCacheEnabled" field before we start creating instances |
3184 klassOop k_o = SystemDictionary::resolve_or_null(vmSymbolHandles::java_lang_StringValue(), Handle(), Handle(), CHECK_0); | 3184 klassOop k_o = SystemDictionary::resolve_or_null(vmSymbols::java_lang_StringValue(), Handle(), Handle(), CHECK_0); |
3185 // Possible that StringValue isn't present: if so, silently don't break | 3185 // Possible that StringValue isn't present: if so, silently don't break |
3186 if (k_o != NULL) { | 3186 if (k_o != NULL) { |
3187 KlassHandle k = KlassHandle(THREAD, k_o); | 3187 KlassHandle k = KlassHandle(THREAD, k_o); |
3188 instanceKlassHandle ik = instanceKlassHandle(THREAD, k()); | 3188 instanceKlassHandle ik = instanceKlassHandle(THREAD, k()); |
3189 ik->initialize(CHECK_0); | 3189 ik->initialize(CHECK_0); |
3196 } | 3196 } |
3197 } | 3197 } |
3198 | 3198 |
3199 // Initialize java_lang.System (needed before creating the thread) | 3199 // Initialize java_lang.System (needed before creating the thread) |
3200 if (InitializeJavaLangSystem) { | 3200 if (InitializeJavaLangSystem) { |
3201 initialize_class(vmSymbolHandles::java_lang_System(), CHECK_0); | 3201 initialize_class(vmSymbols::java_lang_System(), CHECK_0); |
3202 initialize_class(vmSymbolHandles::java_lang_ThreadGroup(), CHECK_0); | 3202 initialize_class(vmSymbols::java_lang_ThreadGroup(), CHECK_0); |
3203 Handle thread_group = create_initial_thread_group(CHECK_0); | 3203 Handle thread_group = create_initial_thread_group(CHECK_0); |
3204 Universe::set_main_thread_group(thread_group()); | 3204 Universe::set_main_thread_group(thread_group()); |
3205 initialize_class(vmSymbolHandles::java_lang_Thread(), CHECK_0); | 3205 initialize_class(vmSymbols::java_lang_Thread(), CHECK_0); |
3206 oop thread_object = create_initial_thread(thread_group, main_thread, CHECK_0); | 3206 oop thread_object = create_initial_thread(thread_group, main_thread, CHECK_0); |
3207 main_thread->set_threadObj(thread_object); | 3207 main_thread->set_threadObj(thread_object); |
3208 // Set thread status to running since main thread has | 3208 // Set thread status to running since main thread has |
3209 // been started and running. | 3209 // been started and running. |
3210 java_lang_Thread::set_thread_status(thread_object, | 3210 java_lang_Thread::set_thread_status(thread_object, |
3211 java_lang_Thread::RUNNABLE); | 3211 java_lang_Thread::RUNNABLE); |
3212 | 3212 |
3213 // The VM preresolve methods to these classes. Make sure that get initialized | 3213 // The VM preresolve methods to these classes. Make sure that get initialized |
3214 initialize_class(vmSymbolHandles::java_lang_reflect_Method(), CHECK_0); | 3214 initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK_0); |
3215 initialize_class(vmSymbolHandles::java_lang_ref_Finalizer(), CHECK_0); | 3215 initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK_0); |
3216 // The VM creates & returns objects of this class. Make sure it's initialized. | 3216 // The VM creates & returns objects of this class. Make sure it's initialized. |
3217 initialize_class(vmSymbolHandles::java_lang_Class(), CHECK_0); | 3217 initialize_class(vmSymbols::java_lang_Class(), CHECK_0); |
3218 call_initializeSystemClass(CHECK_0); | 3218 call_initializeSystemClass(CHECK_0); |
3219 } else { | 3219 } else { |
3220 warning("java.lang.System not initialized"); | 3220 warning("java.lang.System not initialized"); |
3221 } | 3221 } |
3222 | 3222 |
3223 // an instance of OutOfMemory exception has been allocated earlier | 3223 // an instance of OutOfMemory exception has been allocated earlier |
3224 if (InitializeJavaLangExceptionsErrors) { | 3224 if (InitializeJavaLangExceptionsErrors) { |
3225 initialize_class(vmSymbolHandles::java_lang_OutOfMemoryError(), CHECK_0); | 3225 initialize_class(vmSymbols::java_lang_OutOfMemoryError(), CHECK_0); |
3226 initialize_class(vmSymbolHandles::java_lang_NullPointerException(), CHECK_0); | 3226 initialize_class(vmSymbols::java_lang_NullPointerException(), CHECK_0); |
3227 initialize_class(vmSymbolHandles::java_lang_ClassCastException(), CHECK_0); | 3227 initialize_class(vmSymbols::java_lang_ClassCastException(), CHECK_0); |
3228 initialize_class(vmSymbolHandles::java_lang_ArrayStoreException(), CHECK_0); | 3228 initialize_class(vmSymbols::java_lang_ArrayStoreException(), CHECK_0); |
3229 initialize_class(vmSymbolHandles::java_lang_ArithmeticException(), CHECK_0); | 3229 initialize_class(vmSymbols::java_lang_ArithmeticException(), CHECK_0); |
3230 initialize_class(vmSymbolHandles::java_lang_StackOverflowError(), CHECK_0); | 3230 initialize_class(vmSymbols::java_lang_StackOverflowError(), CHECK_0); |
3231 initialize_class(vmSymbolHandles::java_lang_IllegalMonitorStateException(), CHECK_0); | 3231 initialize_class(vmSymbols::java_lang_IllegalMonitorStateException(), CHECK_0); |
3232 } else { | 3232 } else { |
3233 warning("java.lang.OutOfMemoryError has not been initialized"); | 3233 warning("java.lang.OutOfMemoryError has not been initialized"); |
3234 warning("java.lang.NullPointerException has not been initialized"); | 3234 warning("java.lang.NullPointerException has not been initialized"); |
3235 warning("java.lang.ClassCastException has not been initialized"); | 3235 warning("java.lang.ClassCastException has not been initialized"); |
3236 warning("java.lang.ArrayStoreException has not been initialized"); | 3236 warning("java.lang.ArrayStoreException has not been initialized"); |
3252 // Currently even the AWT code has calls to methods in java.lang.Compiler. | 3252 // Currently even the AWT code has calls to methods in java.lang.Compiler. |
3253 // On the classic VM, java.lang.Compiler is loaded very early to load the JIT. | 3253 // On the classic VM, java.lang.Compiler is loaded very early to load the JIT. |
3254 // Future Fix : the best fix is to grant everyone permissions to read "java.compiler" and | 3254 // Future Fix : the best fix is to grant everyone permissions to read "java.compiler" and |
3255 // read and write"java.vm.info" in the default policy file. See bugid 4211383 | 3255 // read and write"java.vm.info" in the default policy file. See bugid 4211383 |
3256 // Once that is done, we should remove this hack. | 3256 // Once that is done, we should remove this hack. |
3257 initialize_class(vmSymbolHandles::java_lang_Compiler(), CHECK_0); | 3257 initialize_class(vmSymbols::java_lang_Compiler(), CHECK_0); |
3258 | 3258 |
3259 // More hackery - the static initializer of java.lang.Compiler adds the string "nojit" to | 3259 // More hackery - the static initializer of java.lang.Compiler adds the string "nojit" to |
3260 // the java.vm.info property if no jit gets loaded through java.lang.Compiler (the hotspot | 3260 // the java.vm.info property if no jit gets loaded through java.lang.Compiler (the hotspot |
3261 // compiler does not get loaded through java.lang.Compiler). "java -version" with the | 3261 // compiler does not get loaded through java.lang.Compiler). "java -version" with the |
3262 // hotspot vm says "nojit" all the time which is confusing. So, we reset it here. | 3262 // hotspot vm says "nojit" all the time which is confusing. So, we reset it here. |
3578 this->clear_pending_exception(); | 3578 this->clear_pending_exception(); |
3579 } | 3579 } |
3580 | 3580 |
3581 EXCEPTION_MARK; | 3581 EXCEPTION_MARK; |
3582 klassOop k = | 3582 klassOop k = |
3583 SystemDictionary::resolve_or_null(vmSymbolHandles::java_lang_Shutdown(), | 3583 SystemDictionary::resolve_or_null(vmSymbols::java_lang_Shutdown(), |
3584 THREAD); | 3584 THREAD); |
3585 if (k != NULL) { | 3585 if (k != NULL) { |
3586 // SystemDictionary::resolve_or_null will return null if there was | 3586 // SystemDictionary::resolve_or_null will return null if there was |
3587 // an exception. If we cannot load the Shutdown class, just don't | 3587 // an exception. If we cannot load the Shutdown class, just don't |
3588 // call Shutdown.shutdown() at all. This will mean the shutdown hooks | 3588 // call Shutdown.shutdown() at all. This will mean the shutdown hooks |
3592 // (Runtime.addShutdownHook and runFinalizersOnExit will load it). | 3592 // (Runtime.addShutdownHook and runFinalizersOnExit will load it). |
3593 instanceKlassHandle shutdown_klass (THREAD, k); | 3593 instanceKlassHandle shutdown_klass (THREAD, k); |
3594 JavaValue result(T_VOID); | 3594 JavaValue result(T_VOID); |
3595 JavaCalls::call_static(&result, | 3595 JavaCalls::call_static(&result, |
3596 shutdown_klass, | 3596 shutdown_klass, |
3597 vmSymbolHandles::shutdown_method_name(), | 3597 vmSymbols::shutdown_method_name(), |
3598 vmSymbolHandles::void_method_signature(), | 3598 vmSymbols::void_method_signature(), |
3599 THREAD); | 3599 THREAD); |
3600 } | 3600 } |
3601 CLEAR_PENDING_EXCEPTION; | 3601 CLEAR_PENDING_EXCEPTION; |
3602 } | 3602 } |
3603 | 3603 |