< prev index next >

src/share/vm/memory/universe.cpp

Print this page




 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 
 139 // These variables are guarded by FullGCALot_lock.
 140 debug_only(objArrayOop Universe::_fullgc_alot_dummy_array = NULL;)
 141 debug_only(int Universe::_fullgc_alot_dummy_next      = 0;)
 142 
 143 // Heap
 144 int             Universe::_verify_count = 0;
 145 




 146 int             Universe::_base_vtable_size = 0;
 147 bool            Universe::_bootstrapping = false;
 148 bool            Universe::_fully_initialized = false;
 149 
 150 size_t          Universe::_heap_capacity_at_last_gc;
 151 size_t          Universe::_heap_used_at_last_gc = 0;
 152 
 153 CollectedHeap*  Universe::_collectedHeap = NULL;
 154 
 155 NarrowPtrStruct Universe::_narrow_oop = { NULL, 0, true };
 156 NarrowPtrStruct Universe::_narrow_klass = { NULL, 0, true };
 157 address Universe::_narrow_ptrs_base;
 158 
 159 void Universe::basic_type_classes_do(void f(Klass*)) {
 160   f(boolArrayKlassObj());
 161   f(byteArrayKlassObj());
 162   f(charArrayKlassObj());
 163   f(intArrayKlassObj());
 164   f(shortArrayKlassObj());
 165   f(longArrayKlassObj());


1154   }
1155   if (!silent) gclog_or_tty->print("dict ");
1156   SystemDictionary::verify();
1157 #ifndef PRODUCT
1158   if (!silent) gclog_or_tty->print("cldg ");
1159   ClassLoaderDataGraph::verify();
1160 #endif
1161   if (!silent) gclog_or_tty->print("metaspace chunks ");
1162   MetaspaceAux::verify_free_chunks();
1163   if (!silent) gclog_or_tty->print("hand ");
1164   JNIHandles::verify();
1165   if (!silent) gclog_or_tty->print("C-heap ");
1166   os::check_heap();
1167   if (!silent) gclog_or_tty->print("code cache ");
1168   CodeCache::verify_oops();
1169   if (!silent) gclog_or_tty->print_cr("]");
1170 
1171   _verify_in_progress = false;
1172 }
1173 
1174 // Oop verification (see MacroAssembler::verify_oop)
1175 
1176 static uintptr_t _verify_oop_data[2]   = {0, (uintptr_t)-1};
1177 static uintptr_t _verify_klass_data[2] = {0, (uintptr_t)-1};
1178 
1179 
1180 #ifndef PRODUCT
1181 
1182 static void calculate_verify_data(uintptr_t verify_data[2],
1183                                   HeapWord* low_boundary,
1184                                   HeapWord* high_boundary) {
1185   assert(low_boundary < high_boundary, "bad interval");
1186 
1187   // decide which low-order bits we require to be clear:
1188   size_t alignSize = MinObjAlignmentInBytes;
1189   size_t min_object_size = CollectedHeap::min_fill_size();
1190 
1191   // make an inclusive limit:
1192   uintptr_t max = (uintptr_t)high_boundary - min_object_size*wordSize;
1193   uintptr_t min = (uintptr_t)low_boundary;
1194   assert(min < max, "bad interval");
1195   uintptr_t diff = max ^ min;
1196 
1197   // throw away enough low-order bits to make the diff vanish
1198   uintptr_t mask = (uintptr_t)(-1);
1199   while ((mask & diff) != 0)
1200     mask <<= 1;
1201   uintptr_t bits = (min & mask);
1202   assert(bits == (max & mask), "correct mask");
1203   // check an intermediate value between min and max, just to make sure:
1204   assert(bits == ((min + (max-min)/2) & mask), "correct mask");
1205 
1206   // require address alignment, too:
1207   mask |= (alignSize - 1);
1208 
1209   if (!(verify_data[0] == 0 && verify_data[1] == (uintptr_t)-1)) {
1210     assert(verify_data[0] == mask && verify_data[1] == bits, "mask stability");
1211   }
1212   verify_data[0] = mask;
1213   verify_data[1] = bits;
1214 }
1215 
1216 // Oop verification (see MacroAssembler::verify_oop)
1217 
1218 uintptr_t Universe::verify_oop_mask() {
1219   MemRegion m = heap()->reserved_region();
1220   calculate_verify_data(_verify_oop_data,
1221                         m.start(),
1222                         m.end());
1223   return _verify_oop_data[0];
1224 }
1225 
1226 
1227 
1228 uintptr_t Universe::verify_oop_bits() {
1229   verify_oop_mask();
1230   return _verify_oop_data[1];

1231 }
1232 
1233 uintptr_t Universe::verify_mark_mask() {
1234   return markOopDesc::lock_mask_in_place;
1235 }
1236 
1237 uintptr_t Universe::verify_mark_bits() {
1238   intptr_t mask = verify_mark_mask();
1239   intptr_t bits = (intptr_t)markOopDesc::prototype();
1240   assert((bits & ~mask) == 0, "no stray header bits");
1241   return bits;
1242 }
1243 #endif // PRODUCT
1244 
1245 
1246 void Universe::compute_verify_oop_data() {
1247   verify_oop_mask();
1248   verify_oop_bits();
1249   verify_mark_mask();
1250   verify_mark_bits();




 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 
 139 // These variables are guarded by FullGCALot_lock.
 140 debug_only(objArrayOop Universe::_fullgc_alot_dummy_array = NULL;)
 141 debug_only(int Universe::_fullgc_alot_dummy_next      = 0;)
 142 
 143 // Heap
 144 int             Universe::_verify_count = 0;
 145 
 146 // Oop verification (see MacroAssembler::verify_oop)
 147 uintptr_t       Universe::_verify_oop_mask = 0;
 148 uintptr_t       Universe::_verify_oop_bits = (uintptr_t) -1;
 149 
 150 int             Universe::_base_vtable_size = 0;
 151 bool            Universe::_bootstrapping = false;
 152 bool            Universe::_fully_initialized = false;
 153 
 154 size_t          Universe::_heap_capacity_at_last_gc;
 155 size_t          Universe::_heap_used_at_last_gc = 0;
 156 
 157 CollectedHeap*  Universe::_collectedHeap = NULL;
 158 
 159 NarrowPtrStruct Universe::_narrow_oop = { NULL, 0, true };
 160 NarrowPtrStruct Universe::_narrow_klass = { NULL, 0, true };
 161 address Universe::_narrow_ptrs_base;
 162 
 163 void Universe::basic_type_classes_do(void f(Klass*)) {
 164   f(boolArrayKlassObj());
 165   f(byteArrayKlassObj());
 166   f(charArrayKlassObj());
 167   f(intArrayKlassObj());
 168   f(shortArrayKlassObj());
 169   f(longArrayKlassObj());


1158   }
1159   if (!silent) gclog_or_tty->print("dict ");
1160   SystemDictionary::verify();
1161 #ifndef PRODUCT
1162   if (!silent) gclog_or_tty->print("cldg ");
1163   ClassLoaderDataGraph::verify();
1164 #endif
1165   if (!silent) gclog_or_tty->print("metaspace chunks ");
1166   MetaspaceAux::verify_free_chunks();
1167   if (!silent) gclog_or_tty->print("hand ");
1168   JNIHandles::verify();
1169   if (!silent) gclog_or_tty->print("C-heap ");
1170   os::check_heap();
1171   if (!silent) gclog_or_tty->print("code cache ");
1172   CodeCache::verify_oops();
1173   if (!silent) gclog_or_tty->print_cr("]");
1174 
1175   _verify_in_progress = false;
1176 }
1177 





1178 
1179 #ifndef PRODUCT
1180 void Universe::calculate_verify_data(HeapWord* low_boundary, HeapWord* high_boundary) {



1181   assert(low_boundary < high_boundary, "bad interval");
1182 
1183   // decide which low-order bits we require to be clear:
1184   size_t alignSize = MinObjAlignmentInBytes;
1185   size_t min_object_size = CollectedHeap::min_fill_size();
1186 
1187   // make an inclusive limit:
1188   uintptr_t max = (uintptr_t)high_boundary - min_object_size*wordSize;
1189   uintptr_t min = (uintptr_t)low_boundary;
1190   assert(min < max, "bad interval");
1191   uintptr_t diff = max ^ min;
1192 
1193   // throw away enough low-order bits to make the diff vanish
1194   uintptr_t mask = (uintptr_t)(-1);
1195   while ((mask & diff) != 0)
1196     mask <<= 1;
1197   uintptr_t bits = (min & mask);
1198   assert(bits == (max & mask), "correct mask");
1199   // check an intermediate value between min and max, just to make sure:
1200   assert(bits == ((min + (max-min)/2) & mask), "correct mask");
1201 
1202   // require address alignment, too:
1203   mask |= (alignSize - 1);
1204 
1205   if (!(_verify_oop_mask == 0 && _verify_oop_bits == (uintptr_t)-1)) {
1206     assert(_verify_oop_mask == mask && _verify_oop_bits == bits, "mask stability");
1207   }
1208   _verify_oop_mask = mask;
1209   _verify_oop_bits = bits;
1210 }
1211 
1212 // Oop verification (see MacroAssembler::verify_oop)
1213 
1214 uintptr_t Universe::verify_oop_mask() {
1215   MemRegion m = heap()->reserved_region();
1216   calculate_verify_data(m.start(), m.end());
1217   return _verify_oop_mask;


1218 }
1219 


1220 uintptr_t Universe::verify_oop_bits() {
1221   MemRegion m = heap()->reserved_region();
1222   calculate_verify_data(m.start(), m.end());
1223   return _verify_oop_bits;
1224 }
1225 
1226 uintptr_t Universe::verify_mark_mask() {
1227   return markOopDesc::lock_mask_in_place;
1228 }
1229 
1230 uintptr_t Universe::verify_mark_bits() {
1231   intptr_t mask = verify_mark_mask();
1232   intptr_t bits = (intptr_t)markOopDesc::prototype();
1233   assert((bits & ~mask) == 0, "no stray header bits");
1234   return bits;
1235 }
1236 #endif // PRODUCT
1237 
1238 
1239 void Universe::compute_verify_oop_data() {
1240   verify_oop_mask();
1241   verify_oop_bits();
1242   verify_mark_mask();
1243   verify_mark_bits();


< prev index next >