comparison src/share/vm/memory/universe.cpp @ 20804:7848fc12602b

Merge with jdk8u40-b25
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Tue, 07 Apr 2015 14:58:49 +0200
parents 52b4284cb496 d3f3f7677537
children
comparison
equal deleted inserted replaced
20184:84105dcdb05b 20804:7848fc12602b
24 24
25 #include "precompiled.hpp" 25 #include "precompiled.hpp"
26 #include "classfile/classLoader.hpp" 26 #include "classfile/classLoader.hpp"
27 #include "classfile/classLoaderData.hpp" 27 #include "classfile/classLoaderData.hpp"
28 #include "classfile/javaClasses.hpp" 28 #include "classfile/javaClasses.hpp"
29 #if INCLUDE_CDS
30 #include "classfile/sharedClassUtil.hpp"
31 #endif
29 #include "classfile/symbolTable.hpp" 32 #include "classfile/symbolTable.hpp"
30 #include "classfile/systemDictionary.hpp" 33 #include "classfile/systemDictionary.hpp"
31 #include "classfile/vmSymbols.hpp" 34 #include "classfile/vmSymbols.hpp"
32 #include "code/codeCache.hpp" 35 #include "code/codeCache.hpp"
33 #include "code/dependencies.hpp" 36 #include "code/dependencies.hpp"
34 #include "gc_interface/collectedHeap.inline.hpp" 37 #include "gc_interface/collectedHeap.inline.hpp"
35 #include "interpreter/interpreter.hpp" 38 #include "interpreter/interpreter.hpp"
36 #include "memory/cardTableModRefBS.hpp" 39 #include "memory/cardTableModRefBS.hpp"
40 #include "memory/filemap.hpp"
37 #include "memory/gcLocker.inline.hpp" 41 #include "memory/gcLocker.inline.hpp"
38 #include "memory/genCollectedHeap.hpp" 42 #include "memory/genCollectedHeap.hpp"
39 #include "memory/genRemSet.hpp" 43 #include "memory/genRemSet.hpp"
40 #include "memory/generation.hpp" 44 #include "memory/generation.hpp"
41 #include "memory/metadataFactory.hpp" 45 #include "memory/metadataFactory.hpp"
72 #include "utilities/macros.hpp" 76 #include "utilities/macros.hpp"
73 #if INCLUDE_ALL_GCS 77 #if INCLUDE_ALL_GCS
74 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp" 78 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
75 #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp" 79 #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp"
76 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" 80 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
77 #include "gc_implementation/g1/g1CollectorPolicy.hpp" 81 #include "gc_implementation/g1/g1CollectorPolicy_ext.hpp"
78 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp" 82 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
79 #endif // INCLUDE_ALL_GCS 83 #endif // INCLUDE_ALL_GCS
80 84
81 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC 85 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
82 86
113 oop Universe::_out_of_memory_error_java_heap = NULL; 117 oop Universe::_out_of_memory_error_java_heap = NULL;
114 oop Universe::_out_of_memory_error_metaspace = NULL; 118 oop Universe::_out_of_memory_error_metaspace = NULL;
115 oop Universe::_out_of_memory_error_class_metaspace = NULL; 119 oop Universe::_out_of_memory_error_class_metaspace = NULL;
116 oop Universe::_out_of_memory_error_array_size = NULL; 120 oop Universe::_out_of_memory_error_array_size = NULL;
117 oop Universe::_out_of_memory_error_gc_overhead_limit = NULL; 121 oop Universe::_out_of_memory_error_gc_overhead_limit = NULL;
122 oop Universe::_out_of_memory_error_realloc_objects = NULL;
118 objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL; 123 objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL;
119 volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0; 124 volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0;
120 bool Universe::_verify_in_progress = false; 125 bool Universe::_verify_in_progress = false;
121 oop Universe::_null_ptr_exception_instance = NULL; 126 oop Universe::_null_ptr_exception_instance = NULL;
122 oop Universe::_arithmetic_exception_instance = NULL; 127 oop Universe::_arithmetic_exception_instance = NULL;
123 oop Universe::_virtual_machine_error_instance = NULL; 128 oop Universe::_virtual_machine_error_instance = NULL;
124 oop Universe::_vm_exception = NULL; 129 oop Universe::_vm_exception = NULL;
130 oop Universe::_allocation_context_notification_obj = NULL;
131
125 Method* Universe::_throw_illegal_access_error = NULL; 132 Method* Universe::_throw_illegal_access_error = NULL;
126 Array<int>* Universe::_the_empty_int_array = NULL; 133 Array<int>* Universe::_the_empty_int_array = NULL;
127 Array<u2>* Universe::_the_empty_short_array = NULL; 134 Array<u2>* Universe::_the_empty_short_array = NULL;
128 Array<Klass*>* Universe::_the_empty_klass_array = NULL; 135 Array<Klass*>* Universe::_the_empty_klass_array = NULL;
129 Array<Method*>* Universe::_the_empty_method_array = NULL; 136 Array<Method*>* Universe::_the_empty_method_array = NULL;
182 f->do_oop((oop*)&_out_of_memory_error_java_heap); 189 f->do_oop((oop*)&_out_of_memory_error_java_heap);
183 f->do_oop((oop*)&_out_of_memory_error_metaspace); 190 f->do_oop((oop*)&_out_of_memory_error_metaspace);
184 f->do_oop((oop*)&_out_of_memory_error_class_metaspace); 191 f->do_oop((oop*)&_out_of_memory_error_class_metaspace);
185 f->do_oop((oop*)&_out_of_memory_error_array_size); 192 f->do_oop((oop*)&_out_of_memory_error_array_size);
186 f->do_oop((oop*)&_out_of_memory_error_gc_overhead_limit); 193 f->do_oop((oop*)&_out_of_memory_error_gc_overhead_limit);
194 f->do_oop((oop*)&_out_of_memory_error_realloc_objects);
187 f->do_oop((oop*)&_preallocated_out_of_memory_error_array); 195 f->do_oop((oop*)&_preallocated_out_of_memory_error_array);
188 f->do_oop((oop*)&_null_ptr_exception_instance); 196 f->do_oop((oop*)&_null_ptr_exception_instance);
189 f->do_oop((oop*)&_arithmetic_exception_instance); 197 f->do_oop((oop*)&_arithmetic_exception_instance);
190 f->do_oop((oop*)&_virtual_machine_error_instance); 198 f->do_oop((oop*)&_virtual_machine_error_instance);
191 f->do_oop((oop*)&_main_thread_group); 199 f->do_oop((oop*)&_main_thread_group);
192 f->do_oop((oop*)&_system_thread_group); 200 f->do_oop((oop*)&_system_thread_group);
193 f->do_oop((oop*)&_vm_exception); 201 f->do_oop((oop*)&_vm_exception);
202 f->do_oop((oop*)&_allocation_context_notification_obj);
194 debug_only(f->do_oop((oop*)&_fullgc_alot_dummy_array);) 203 debug_only(f->do_oop((oop*)&_fullgc_alot_dummy_array);)
195 } 204 }
196 205
197 // Serialize metadata in and out of CDS archive, not oops. 206 // Serialize metadata in and out of CDS archive, not oops.
198 void Universe::serialize(SerializeClosure* f, bool do_all) { 207 void Universe::serialize(SerializeClosure* f, bool do_all) {
236 } 245 }
237 246
238 void initialize_basic_type_klass(Klass* k, TRAPS) { 247 void initialize_basic_type_klass(Klass* k, TRAPS) {
239 Klass* ok = SystemDictionary::Object_klass(); 248 Klass* ok = SystemDictionary::Object_klass();
240 if (UseSharedSpaces) { 249 if (UseSharedSpaces) {
250 ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
241 assert(k->super() == ok, "u3"); 251 assert(k->super() == ok, "u3");
242 k->restore_unshareable_info(CHECK); 252 k->restore_unshareable_info(loader_data, Handle(), CHECK);
243 } else { 253 } else {
244 k->initialize_supers(ok, CHECK); 254 k->initialize_supers(ok, CHECK);
245 } 255 }
246 k->append_to_sibling_list(); 256 k->append_to_sibling_list();
247 } 257 }
564 // to allocate the backtrace. 574 // to allocate the backtrace.
565 return ((throwable() != Universe::_out_of_memory_error_java_heap) && 575 return ((throwable() != Universe::_out_of_memory_error_java_heap) &&
566 (throwable() != Universe::_out_of_memory_error_metaspace) && 576 (throwable() != Universe::_out_of_memory_error_metaspace) &&
567 (throwable() != Universe::_out_of_memory_error_class_metaspace) && 577 (throwable() != Universe::_out_of_memory_error_class_metaspace) &&
568 (throwable() != Universe::_out_of_memory_error_array_size) && 578 (throwable() != Universe::_out_of_memory_error_array_size) &&
569 (throwable() != Universe::_out_of_memory_error_gc_overhead_limit)); 579 (throwable() != Universe::_out_of_memory_error_gc_overhead_limit) &&
580 (throwable() != Universe::_out_of_memory_error_realloc_objects));
570 } 581 }
571 582
572 583
573 oop Universe::gen_out_of_memory_error(oop default_err) { 584 oop Universe::gen_out_of_memory_error(oop default_err) {
574 // generate an out of memory error: 585 // generate an out of memory error:
663 StringTable::create_table(); 674 StringTable::create_table();
664 } else { 675 } else {
665 SymbolTable::create_table(); 676 SymbolTable::create_table();
666 StringTable::create_table(); 677 StringTable::create_table();
667 ClassLoader::create_package_info_table(); 678 ClassLoader::create_package_info_table();
679
680 if (DumpSharedSpaces) {
681 MetaspaceShared::prepare_for_dumping();
682 }
668 } 683 }
669 684
670 return JNI_OK; 685 return JNI_OK;
671 } 686 }
672 687
784 fatal("UseParallelGC not supported in this VM."); 799 fatal("UseParallelGC not supported in this VM.");
785 #endif // INCLUDE_ALL_GCS 800 #endif // INCLUDE_ALL_GCS
786 801
787 } else if (UseG1GC) { 802 } else if (UseG1GC) {
788 #if INCLUDE_ALL_GCS 803 #if INCLUDE_ALL_GCS
789 G1CollectorPolicy* g1p = new G1CollectorPolicy(); 804 G1CollectorPolicyExt* g1p = new G1CollectorPolicyExt();
790 g1p->initialize_all(); 805 g1p->initialize_all();
791 G1CollectedHeap* g1h = new G1CollectedHeap(g1p); 806 G1CollectedHeap* g1h = new G1CollectedHeap(g1p);
792 Universe::_collectedHeap = g1h; 807 Universe::_collectedHeap = g1h;
793 #else // INCLUDE_ALL_GCS 808 #else // INCLUDE_ALL_GCS
794 fatal("UseG1GC not supported in java kernel vm."); 809 fatal("UseG1GC not supported in java kernel vm.");
1030 Universe::_out_of_memory_error_metaspace = k_h->allocate_instance(CHECK_false); 1045 Universe::_out_of_memory_error_metaspace = k_h->allocate_instance(CHECK_false);
1031 Universe::_out_of_memory_error_class_metaspace = k_h->allocate_instance(CHECK_false); 1046 Universe::_out_of_memory_error_class_metaspace = k_h->allocate_instance(CHECK_false);
1032 Universe::_out_of_memory_error_array_size = k_h->allocate_instance(CHECK_false); 1047 Universe::_out_of_memory_error_array_size = k_h->allocate_instance(CHECK_false);
1033 Universe::_out_of_memory_error_gc_overhead_limit = 1048 Universe::_out_of_memory_error_gc_overhead_limit =
1034 k_h->allocate_instance(CHECK_false); 1049 k_h->allocate_instance(CHECK_false);
1050 Universe::_out_of_memory_error_realloc_objects = k_h->allocate_instance(CHECK_false);
1035 1051
1036 // Setup preallocated NullPointerException 1052 // Setup preallocated NullPointerException
1037 // (this is currently used for a cheap & dirty solution in compiler exception handling) 1053 // (this is currently used for a cheap & dirty solution in compiler exception handling)
1038 k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_NullPointerException(), true, CHECK_false); 1054 k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_NullPointerException(), true, CHECK_false);
1039 Universe::_null_ptr_exception_instance = InstanceKlass::cast(k)->allocate_instance(CHECK_false); 1055 Universe::_null_ptr_exception_instance = InstanceKlass::cast(k)->allocate_instance(CHECK_false);
1069 java_lang_Throwable::set_message(Universe::_out_of_memory_error_array_size, msg()); 1085 java_lang_Throwable::set_message(Universe::_out_of_memory_error_array_size, msg());
1070 1086
1071 msg = java_lang_String::create_from_str("GC overhead limit exceeded", CHECK_false); 1087 msg = java_lang_String::create_from_str("GC overhead limit exceeded", CHECK_false);
1072 java_lang_Throwable::set_message(Universe::_out_of_memory_error_gc_overhead_limit, msg()); 1088 java_lang_Throwable::set_message(Universe::_out_of_memory_error_gc_overhead_limit, msg());
1073 1089
1090 msg = java_lang_String::create_from_str("Java heap space: failed reallocation of scalar replaced objects", CHECK_false);
1091 java_lang_Throwable::set_message(Universe::_out_of_memory_error_realloc_objects, msg());
1092
1074 msg = java_lang_String::create_from_str("/ by zero", CHECK_false); 1093 msg = java_lang_String::create_from_str("/ by zero", CHECK_false);
1075 java_lang_Throwable::set_message(Universe::_arithmetic_exception_instance, msg()); 1094 java_lang_Throwable::set_message(Universe::_arithmetic_exception_instance, msg());
1076 1095
1077 // Setup the array of errors that have preallocated backtrace 1096 // Setup the array of errors that have preallocated backtrace
1078 k = Universe::_out_of_memory_error_java_heap->klass(); 1097 k = Universe::_out_of_memory_error_java_heap->klass();
1164 CompressedClassSpaceCounters::initialize_performance_counters(); 1183 CompressedClassSpaceCounters::initialize_performance_counters();
1165 1184
1166 MemoryService::add_metaspace_memory_pools(); 1185 MemoryService::add_metaspace_memory_pools();
1167 1186
1168 MemoryService::set_universe_heap(Universe::_collectedHeap); 1187 MemoryService::set_universe_heap(Universe::_collectedHeap);
1188 #if INCLUDE_CDS
1189 if (UseSharedSpaces) {
1190 SharedClassUtil::initialize(CHECK_false);
1191 }
1192 #endif
1169 return true; 1193 return true;
1170 } 1194 }
1171 1195
1172 1196
1173 void Universe::compute_base_vtable_size() { 1197 void Universe::compute_base_vtable_size() {