src/hotspot/share/gc/shared/genCollectedHeap.cpp
changeset 59053 ba6c248cae19
parent 58015 dd84de796f2c
child 59153 1152339c298a
equal deleted inserted replaced
59051:f0312c7d5b37 59053:ba6c248cae19
   416                                 " size=" SIZE_FORMAT " %s", try_count, size, is_tlab ? "(TLAB)" : "");
   416                                 " size=" SIZE_FORMAT " %s", try_count, size, is_tlab ? "(TLAB)" : "");
   417     }
   417     }
   418   }
   418   }
   419 }
   419 }
   420 
   420 
   421 #ifndef PRODUCT
       
   422 // Override of memory state checking method in CollectedHeap:
       
   423 // Some collectors (CMS for example) can't have badHeapWordVal written
       
   424 // in the first two words of an object. (For instance , in the case of
       
   425 // CMS these words hold state used to synchronize between certain
       
   426 // (concurrent) GC steps and direct allocating mutators.)
       
   427 // The skip_header_HeapWords() method below, allows us to skip
       
   428 // over the requisite number of HeapWord's. Note that (for
       
   429 // generational collectors) this means that those many words are
       
   430 // skipped in each object, irrespective of the generation in which
       
   431 // that object lives. The resultant loss of precision seems to be
       
   432 // harmless and the pain of avoiding that imprecision appears somewhat
       
   433 // higher than we are prepared to pay for such rudimentary debugging
       
   434 // support.
       
   435 void GenCollectedHeap::check_for_non_bad_heap_word_value(HeapWord* addr,
       
   436                                                          size_t size) {
       
   437   if (CheckMemoryInitialization && ZapUnusedHeapArea) {
       
   438     // We are asked to check a size in HeapWords,
       
   439     // but the memory is mangled in juint words.
       
   440     juint* start = (juint*) (addr + skip_header_HeapWords());
       
   441     juint* end   = (juint*) (addr + size);
       
   442     for (juint* slot = start; slot < end; slot += 1) {
       
   443       assert(*slot == badHeapWordVal,
       
   444              "Found non badHeapWordValue in pre-allocation check");
       
   445     }
       
   446   }
       
   447 }
       
   448 #endif
       
   449 
       
   450 HeapWord* GenCollectedHeap::attempt_allocation(size_t size,
   421 HeapWord* GenCollectedHeap::attempt_allocation(size_t size,
   451                                                bool is_tlab,
   422                                                bool is_tlab,
   452                                                bool first_only) {
   423                                                bool first_only) {
   453   HeapWord* res = NULL;
   424   HeapWord* res = NULL;
   454 
   425 
  1227 }
  1198 }
  1228 
  1199 
  1229 GenCollectedHeap* GenCollectedHeap::heap() {
  1200 GenCollectedHeap* GenCollectedHeap::heap() {
  1230   CollectedHeap* heap = Universe::heap();
  1201   CollectedHeap* heap = Universe::heap();
  1231   assert(heap != NULL, "Uninitialized access to GenCollectedHeap::heap()");
  1202   assert(heap != NULL, "Uninitialized access to GenCollectedHeap::heap()");
  1232   assert(heap->kind() == CollectedHeap::Serial ||
  1203   assert(heap->kind() == CollectedHeap::Serial, "Invalid name");
  1233          heap->kind() == CollectedHeap::CMS, "Invalid name");
       
  1234   return (GenCollectedHeap*) heap;
  1204   return (GenCollectedHeap*) heap;
  1235 }
  1205 }
  1236 
  1206 
  1237 #if INCLUDE_SERIALGC
  1207 #if INCLUDE_SERIALGC
  1238 void GenCollectedHeap::prepare_for_compaction() {
  1208 void GenCollectedHeap::prepare_for_compaction() {