98 oop Universe::_int_mirror = NULL;
99 oop Universe::_float_mirror = NULL;
100 oop Universe::_double_mirror = NULL;
101 oop Universe::_byte_mirror = NULL;
102 oop Universe::_bool_mirror = NULL;
103 oop Universe::_char_mirror = NULL;
104 oop Universe::_long_mirror = NULL;
105 oop Universe::_short_mirror = NULL;
106 oop Universe::_void_mirror = NULL;
107 oop Universe::_mirrors[T_VOID+1] = { NULL /*, NULL...*/ };
108 oop Universe::_main_thread_group = NULL;
109 oop Universe::_system_thread_group = NULL;
110 objArrayOop Universe::_the_empty_class_klass_array = NULL;
111 Array<Klass*>* Universe::_the_array_interfaces_array = NULL;
112 oop Universe::_the_null_string = NULL;
113 oop Universe::_the_min_jint_string = NULL;
114 LatestMethodCache* Universe::_finalizer_register_cache = NULL;
115 LatestMethodCache* Universe::_loader_addClass_cache = NULL;
116 LatestMethodCache* Universe::_pd_implies_cache = NULL;
117 LatestMethodCache* Universe::_throw_illegal_access_error_cache = NULL;
118 LatestMethodCache* Universe::_do_stack_walk_cache = NULL;
119 oop Universe::_out_of_memory_error_java_heap = NULL;
120 oop Universe::_out_of_memory_error_metaspace = NULL;
121 oop Universe::_out_of_memory_error_class_metaspace = NULL;
122 oop Universe::_out_of_memory_error_array_size = NULL;
123 oop Universe::_out_of_memory_error_gc_overhead_limit = NULL;
124 oop Universe::_out_of_memory_error_realloc_objects = NULL;
125 objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL;
126 volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0;
127 bool Universe::_verify_in_progress = false;
128 oop Universe::_null_ptr_exception_instance = NULL;
129 oop Universe::_arithmetic_exception_instance = NULL;
130 oop Universe::_virtual_machine_error_instance = NULL;
131 oop Universe::_vm_exception = NULL;
132 oop Universe::_allocation_context_notification_obj = NULL;
133
134 Array<int>* Universe::_the_empty_int_array = NULL;
135 Array<u2>* Universe::_the_empty_short_array = NULL;
136 Array<Klass*>* Universe::_the_empty_klass_array = NULL;
137 Array<Method*>* Universe::_the_empty_method_array = NULL;
138
224 {
225 for (int i = 0; i < T_VOID+1; i++) {
226 if (_typeArrayKlassObjs[i] != NULL) {
227 assert(i >= T_BOOLEAN, "checking");
228 f->do_ptr((void**)&_typeArrayKlassObjs[i]);
229 } else if (do_all) {
230 f->do_ptr((void**)&_typeArrayKlassObjs[i]);
231 }
232 }
233 }
234
235 f->do_ptr((void**)&_the_array_interfaces_array);
236 f->do_ptr((void**)&_the_empty_int_array);
237 f->do_ptr((void**)&_the_empty_short_array);
238 f->do_ptr((void**)&_the_empty_method_array);
239 f->do_ptr((void**)&_the_empty_klass_array);
240 _finalizer_register_cache->serialize(f);
241 _loader_addClass_cache->serialize(f);
242 _pd_implies_cache->serialize(f);
243 _throw_illegal_access_error_cache->serialize(f);
244 _do_stack_walk_cache->serialize(f);
245 }
246
247 void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
248 if (size < alignment || size % alignment != 0) {
249 vm_exit_during_initialization(
250 err_msg("Size of %s (" UINTX_FORMAT " bytes) must be aligned to " UINTX_FORMAT " bytes", name, size, alignment));
251 }
252 }
253
254 void initialize_basic_type_klass(Klass* k, TRAPS) {
255 Klass* ok = SystemDictionary::Object_klass();
256 if (UseSharedSpaces) {
257 ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
258 assert(k->super() == ok, "u3");
259 k->restore_unshareable_info(loader_data, Handle(), CHECK);
260 } else {
261 k->initialize_supers(ok, CHECK);
262 }
263 k->append_to_sibling_list();
264 }
659 return status;
660 }
661
662 Metaspace::global_initialize();
663
664 // Checks 'AfterMemoryInit' constraints.
665 if (!CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::AfterMemoryInit)) {
666 return JNI_EINVAL;
667 }
668
669 // Create memory for metadata. Must be after initializing heap for
670 // DumpSharedSpaces.
671 ClassLoaderData::init_null_class_loader_data();
672
673 // We have a heap so create the Method* caches before
674 // Metaspace::initialize_shared_spaces() tries to populate them.
675 Universe::_finalizer_register_cache = new LatestMethodCache();
676 Universe::_loader_addClass_cache = new LatestMethodCache();
677 Universe::_pd_implies_cache = new LatestMethodCache();
678 Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
679 Universe::_do_stack_walk_cache = new LatestMethodCache();
680
681 if (UseSharedSpaces) {
682 // Read the data structures supporting the shared spaces (shared
683 // system dictionary, symbol table, etc.). After that, access to
684 // the file (other than the mapped regions) is no longer needed, and
685 // the file is closed. Closing the file does not affect the
686 // currently mapped regions.
687 MetaspaceShared::initialize_shared_spaces();
688 StringTable::create_table();
689 } else {
690 SymbolTable::create_table();
691 StringTable::create_table();
692 ClassLoader::create_package_info_table();
693
694 if (DumpSharedSpaces) {
695 MetaspaceShared::prepare_for_dumping();
696 }
697 }
698
699 return JNI_OK;
1032 return false; // initialization failed (cannot throw exception yet)
1033 }
1034 Universe::_loader_addClass_cache->init(
1035 SystemDictionary::ClassLoader_klass(), m);
1036
1037 // Setup method for checking protection domain
1038 SystemDictionary::ProtectionDomain_klass()->link_class(CHECK_false);
1039 m = SystemDictionary::ProtectionDomain_klass()->
1040 find_method(vmSymbols::impliesCreateAccessControlContext_name(),
1041 vmSymbols::void_boolean_signature());
1042 // Allow NULL which should only happen with bootstrapping.
1043 if (m != NULL) {
1044 if (m->is_static()) {
1045 // NoSuchMethodException doesn't actually work because it tries to run the
1046 // <init> function before java_lang_Class is linked. Print error and exit.
1047 tty->print_cr("ProtectionDomain.impliesCreateAccessControlContext() has the wrong linkage");
1048 return false; // initialization failed
1049 }
1050 Universe::_pd_implies_cache->init(
1051 SystemDictionary::ProtectionDomain_klass(), m);
1052 }
1053
1054 // Setup method for stack walking
1055 InstanceKlass::cast(SystemDictionary::AbstractStackWalker_klass())->link_class(CHECK_false);
1056 m = InstanceKlass::cast(SystemDictionary::AbstractStackWalker_klass())->
1057 find_method(vmSymbols::doStackWalk_name(),
1058 vmSymbols::doStackWalk_signature());
1059 // Allow NULL which should only happen with bootstrapping.
1060 if (m != NULL) {
1061 Universe::_do_stack_walk_cache->init(
1062 SystemDictionary::AbstractStackWalker_klass(), m);
1063 }
1064
1065 // This needs to be done before the first scavenge/gc, since
1066 // it's an input to soft ref clearing policy.
1067 {
1068 MutexLocker x(Heap_lock);
1069 Universe::update_heap_info_at_gc();
1070 }
1071
1072 // ("weak") refs processing infrastructure initialization
1073 Universe::heap()->post_initialize();
1074
1075 // Initialize performance counters for metaspaces
1076 MetaspaceCounters::initialize_performance_counters();
1077 CompressedClassSpaceCounters::initialize_performance_counters();
1078
1079 MemoryService::add_metaspace_memory_pools();
1080
1081 MemoryService::set_universe_heap(Universe::heap());
1082 #if INCLUDE_CDS
|
98 oop Universe::_int_mirror = NULL;
99 oop Universe::_float_mirror = NULL;
100 oop Universe::_double_mirror = NULL;
101 oop Universe::_byte_mirror = NULL;
102 oop Universe::_bool_mirror = NULL;
103 oop Universe::_char_mirror = NULL;
104 oop Universe::_long_mirror = NULL;
105 oop Universe::_short_mirror = NULL;
106 oop Universe::_void_mirror = NULL;
107 oop Universe::_mirrors[T_VOID+1] = { NULL /*, NULL...*/ };
108 oop Universe::_main_thread_group = NULL;
109 oop Universe::_system_thread_group = NULL;
110 objArrayOop Universe::_the_empty_class_klass_array = NULL;
111 Array<Klass*>* Universe::_the_array_interfaces_array = NULL;
112 oop Universe::_the_null_string = NULL;
113 oop Universe::_the_min_jint_string = NULL;
114 LatestMethodCache* Universe::_finalizer_register_cache = NULL;
115 LatestMethodCache* Universe::_loader_addClass_cache = NULL;
116 LatestMethodCache* Universe::_pd_implies_cache = NULL;
117 LatestMethodCache* Universe::_throw_illegal_access_error_cache = NULL;
118 oop Universe::_out_of_memory_error_java_heap = NULL;
119 oop Universe::_out_of_memory_error_metaspace = NULL;
120 oop Universe::_out_of_memory_error_class_metaspace = NULL;
121 oop Universe::_out_of_memory_error_array_size = NULL;
122 oop Universe::_out_of_memory_error_gc_overhead_limit = NULL;
123 oop Universe::_out_of_memory_error_realloc_objects = NULL;
124 objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL;
125 volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0;
126 bool Universe::_verify_in_progress = false;
127 oop Universe::_null_ptr_exception_instance = NULL;
128 oop Universe::_arithmetic_exception_instance = NULL;
129 oop Universe::_virtual_machine_error_instance = NULL;
130 oop Universe::_vm_exception = NULL;
131 oop Universe::_allocation_context_notification_obj = NULL;
132
133 Array<int>* Universe::_the_empty_int_array = NULL;
134 Array<u2>* Universe::_the_empty_short_array = NULL;
135 Array<Klass*>* Universe::_the_empty_klass_array = NULL;
136 Array<Method*>* Universe::_the_empty_method_array = NULL;
137
223 {
224 for (int i = 0; i < T_VOID+1; i++) {
225 if (_typeArrayKlassObjs[i] != NULL) {
226 assert(i >= T_BOOLEAN, "checking");
227 f->do_ptr((void**)&_typeArrayKlassObjs[i]);
228 } else if (do_all) {
229 f->do_ptr((void**)&_typeArrayKlassObjs[i]);
230 }
231 }
232 }
233
234 f->do_ptr((void**)&_the_array_interfaces_array);
235 f->do_ptr((void**)&_the_empty_int_array);
236 f->do_ptr((void**)&_the_empty_short_array);
237 f->do_ptr((void**)&_the_empty_method_array);
238 f->do_ptr((void**)&_the_empty_klass_array);
239 _finalizer_register_cache->serialize(f);
240 _loader_addClass_cache->serialize(f);
241 _pd_implies_cache->serialize(f);
242 _throw_illegal_access_error_cache->serialize(f);
243 }
244
245 void Universe::check_alignment(uintx size, uintx alignment, const char* name) {
246 if (size < alignment || size % alignment != 0) {
247 vm_exit_during_initialization(
248 err_msg("Size of %s (" UINTX_FORMAT " bytes) must be aligned to " UINTX_FORMAT " bytes", name, size, alignment));
249 }
250 }
251
252 void initialize_basic_type_klass(Klass* k, TRAPS) {
253 Klass* ok = SystemDictionary::Object_klass();
254 if (UseSharedSpaces) {
255 ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
256 assert(k->super() == ok, "u3");
257 k->restore_unshareable_info(loader_data, Handle(), CHECK);
258 } else {
259 k->initialize_supers(ok, CHECK);
260 }
261 k->append_to_sibling_list();
262 }
657 return status;
658 }
659
660 Metaspace::global_initialize();
661
662 // Checks 'AfterMemoryInit' constraints.
663 if (!CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::AfterMemoryInit)) {
664 return JNI_EINVAL;
665 }
666
667 // Create memory for metadata. Must be after initializing heap for
668 // DumpSharedSpaces.
669 ClassLoaderData::init_null_class_loader_data();
670
671 // We have a heap so create the Method* caches before
672 // Metaspace::initialize_shared_spaces() tries to populate them.
673 Universe::_finalizer_register_cache = new LatestMethodCache();
674 Universe::_loader_addClass_cache = new LatestMethodCache();
675 Universe::_pd_implies_cache = new LatestMethodCache();
676 Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
677
678 if (UseSharedSpaces) {
679 // Read the data structures supporting the shared spaces (shared
680 // system dictionary, symbol table, etc.). After that, access to
681 // the file (other than the mapped regions) is no longer needed, and
682 // the file is closed. Closing the file does not affect the
683 // currently mapped regions.
684 MetaspaceShared::initialize_shared_spaces();
685 StringTable::create_table();
686 } else {
687 SymbolTable::create_table();
688 StringTable::create_table();
689 ClassLoader::create_package_info_table();
690
691 if (DumpSharedSpaces) {
692 MetaspaceShared::prepare_for_dumping();
693 }
694 }
695
696 return JNI_OK;
1029 return false; // initialization failed (cannot throw exception yet)
1030 }
1031 Universe::_loader_addClass_cache->init(
1032 SystemDictionary::ClassLoader_klass(), m);
1033
1034 // Setup method for checking protection domain
1035 SystemDictionary::ProtectionDomain_klass()->link_class(CHECK_false);
1036 m = SystemDictionary::ProtectionDomain_klass()->
1037 find_method(vmSymbols::impliesCreateAccessControlContext_name(),
1038 vmSymbols::void_boolean_signature());
1039 // Allow NULL which should only happen with bootstrapping.
1040 if (m != NULL) {
1041 if (m->is_static()) {
1042 // NoSuchMethodException doesn't actually work because it tries to run the
1043 // <init> function before java_lang_Class is linked. Print error and exit.
1044 tty->print_cr("ProtectionDomain.impliesCreateAccessControlContext() has the wrong linkage");
1045 return false; // initialization failed
1046 }
1047 Universe::_pd_implies_cache->init(
1048 SystemDictionary::ProtectionDomain_klass(), m);
1049 }
1050
1051 // This needs to be done before the first scavenge/gc, since
1052 // it's an input to soft ref clearing policy.
1053 {
1054 MutexLocker x(Heap_lock);
1055 Universe::update_heap_info_at_gc();
1056 }
1057
1058 // ("weak") refs processing infrastructure initialization
1059 Universe::heap()->post_initialize();
1060
1061 // Initialize performance counters for metaspaces
1062 MetaspaceCounters::initialize_performance_counters();
1063 CompressedClassSpaceCounters::initialize_performance_counters();
1064
1065 MemoryService::add_metaspace_memory_pools();
1066
1067 MemoryService::set_universe_heap(Universe::heap());
1068 #if INCLUDE_CDS
|