< prev index next >

src/hotspot/share/gc/g1/g1Allocator.cpp

Print this page
rev 53774 : imported patch 8219096-merge-termination-stats-logging


 304   }
 305   return result;
 306 }
 307 
 308 void G1PLABAllocator::undo_allocation(InCSetState dest, HeapWord* obj, size_t word_sz) {
 309   alloc_buffer(dest)->undo_allocation(obj, word_sz);
 310 }
 311 
 312 void G1PLABAllocator::flush_and_retire_stats() {
 313   for (uint state = 0; state < InCSetState::Num; state++) {
 314     PLAB* const buf = _alloc_buffers[state];
 315     if (buf != NULL) {
 316       G1EvacStats* stats = _g1h->alloc_buffer_stats(state);
 317       buf->flush_and_retire_stats(stats);
 318       stats->add_direct_allocated(_direct_allocated[state]);
 319       _direct_allocated[state] = 0;
 320     }
 321   }
 322 }
 323 
 324 void G1PLABAllocator::waste(size_t& wasted, size_t& undo_wasted) {
 325   wasted = 0;
 326   undo_wasted = 0;
 327   for (uint state = 0; state < InCSetState::Num; state++) {
 328     PLAB * const buf = _alloc_buffers[state];
 329     if (buf != NULL) {
 330       wasted += buf->waste();
 331       undo_wasted += buf->undo_waste();
 332     }
 333   }












 334 }
 335 
 336 bool G1ArchiveAllocator::_archive_check_enabled = false;
 337 G1ArchiveRegionMap G1ArchiveAllocator::_closed_archive_region_map;
 338 G1ArchiveRegionMap G1ArchiveAllocator::_open_archive_region_map;
 339 
 340 G1ArchiveAllocator* G1ArchiveAllocator::create_allocator(G1CollectedHeap* g1h, bool open) {
 341   // Create the archive allocator, and also enable archive object checking
 342   // in mark-sweep, since we will be creating archive regions.
 343   G1ArchiveAllocator* result =  new G1ArchiveAllocator(g1h, open);
 344   enable_archive_object_check();
 345   return result;
 346 }
 347 
 348 bool G1ArchiveAllocator::alloc_new_region() {
 349   // Allocate the highest free region in the reserved heap,
 350   // and add it to our list of allocated regions. It is marked
 351   // archive and added to the old set.
 352   HeapRegion* hr = _g1h->alloc_highest_free_region();
 353   if (hr == NULL) {




 304   }
 305   return result;
 306 }
 307 
 308 void G1PLABAllocator::undo_allocation(InCSetState dest, HeapWord* obj, size_t word_sz) {
 309   alloc_buffer(dest)->undo_allocation(obj, word_sz);
 310 }
 311 
 312 void G1PLABAllocator::flush_and_retire_stats() {
 313   for (uint state = 0; state < InCSetState::Num; state++) {
 314     PLAB* const buf = _alloc_buffers[state];
 315     if (buf != NULL) {
 316       G1EvacStats* stats = _g1h->alloc_buffer_stats(state);
 317       buf->flush_and_retire_stats(stats);
 318       stats->add_direct_allocated(_direct_allocated[state]);
 319       _direct_allocated[state] = 0;
 320     }
 321   }
 322 }
 323 
 324 size_t G1PLABAllocator::waste() const {
 325   size_t result = 0;

 326   for (uint state = 0; state < InCSetState::Num; state++) {
 327     PLAB * const buf = _alloc_buffers[state];
 328     if (buf != NULL) {
 329       result += buf->waste();

 330     }
 331   }
 332   return result;
 333 }
 334 
 335 size_t G1PLABAllocator::undo_waste() const {
 336   size_t result = 0;
 337   for (uint state = 0; state < InCSetState::Num; state++) {
 338     PLAB * const buf = _alloc_buffers[state];
 339     if (buf != NULL) {
 340       result += buf->undo_waste();
 341     }
 342   }
 343   return result;   
 344 }
 345 
 346 bool G1ArchiveAllocator::_archive_check_enabled = false;
 347 G1ArchiveRegionMap G1ArchiveAllocator::_closed_archive_region_map;
 348 G1ArchiveRegionMap G1ArchiveAllocator::_open_archive_region_map;
 349 
 350 G1ArchiveAllocator* G1ArchiveAllocator::create_allocator(G1CollectedHeap* g1h, bool open) {
 351   // Create the archive allocator, and also enable archive object checking
 352   // in mark-sweep, since we will be creating archive regions.
 353   G1ArchiveAllocator* result =  new G1ArchiveAllocator(g1h, open);
 354   enable_archive_object_check();
 355   return result;
 356 }
 357 
 358 bool G1ArchiveAllocator::alloc_new_region() {
 359   // Allocate the highest free region in the reserved heap,
 360   // and add it to our list of allocated regions. It is marked
 361   // archive and added to the old set.
 362   HeapRegion* hr = _g1h->alloc_highest_free_region();
 363   if (hr == NULL) {


< prev index next >