556 assert(SafepointSynchronize::is_at_safepoint() || 557 !is_init_completed(), 558 "should only accumulate statistics on tlabs at safepoint"); 559 560 ThreadLocalAllocBuffer::accumulate_statistics_before_gc(); 561 } 562 } 563 564 void CollectedHeap::resize_all_tlabs() { 565 if (UseTLAB) { 566 assert(SafepointSynchronize::is_at_safepoint() || 567 !is_init_completed(), 568 "should only resize tlabs at safepoint"); 569 570 ThreadLocalAllocBuffer::resize_all_tlabs(); 571 } 572 } 573 574 void CollectedHeap::pre_full_gc_dump(GCTimer* timer) { 575 if (HeapDumpBeforeFullGC) { 576 GCTraceTime tt("Heap Dump (before full gc): ", PrintGCDetails, false, timer, GCId::create()); 577 // We are doing a full collection and a heap dump before 578 // full collection has been requested. 579 HeapDumper::dump_heap(); 580 } 581 if (PrintClassHistogramBeforeFullGC) { 582 GCTraceTime tt("Class Histogram (before full gc): ", PrintGCDetails, true, timer, GCId::create()); 583 VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */); 584 inspector.doit(); 585 } 586 } 587 588 void CollectedHeap::post_full_gc_dump(GCTimer* timer) { 589 if (HeapDumpAfterFullGC) { 590 GCTraceTime tt("Heap Dump (after full gc): ", PrintGCDetails, false, timer, GCId::create()); 591 HeapDumper::dump_heap(); 592 } 593 if (PrintClassHistogramAfterFullGC) { 594 GCTraceTime tt("Class Histogram (after full gc): ", PrintGCDetails, true, timer, GCId::create()); 595 VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */); 596 inspector.doit(); 597 } 598 } 599 600 void CollectedHeap::initialize_reserved_region(HeapWord *start, HeapWord *end) { 601 // It is important to do this in a way such that concurrent readers can't 602 // temporarily think something is in the heap. (Seen this happen in asserts.) 603 _reserved.set_word_size(0); 604 _reserved.set_start(start); 605 _reserved.set_end(end); 606 } 607 608 /////////////// Unit tests /////////////// 609 610 #ifndef PRODUCT 611 void CollectedHeap::test_is_in() { 612 CollectedHeap* heap = Universe::heap(); 613 614 uintptr_t epsilon = (uintptr_t) MinObjAlignment; | 556 assert(SafepointSynchronize::is_at_safepoint() || 557 !is_init_completed(), 558 "should only accumulate statistics on tlabs at safepoint"); 559 560 ThreadLocalAllocBuffer::accumulate_statistics_before_gc(); 561 } 562 } 563 564 void CollectedHeap::resize_all_tlabs() { 565 if (UseTLAB) { 566 assert(SafepointSynchronize::is_at_safepoint() || 567 !is_init_completed(), 568 "should only resize tlabs at safepoint"); 569 570 ThreadLocalAllocBuffer::resize_all_tlabs(); 571 } 572 } 573 574 void CollectedHeap::pre_full_gc_dump(GCTimer* timer) { 575 if (HeapDumpBeforeFullGC) { 576 GCTraceTime tt("Heap Dump (before full gc): ", PrintGCDetails, false, timer); 577 // We are doing a full collection and a heap dump before 578 // full collection has been requested. 579 HeapDumper::dump_heap(); 580 } 581 if (PrintClassHistogramBeforeFullGC) { 582 GCTraceTime tt("Class Histogram (before full gc): ", PrintGCDetails, true, timer); 583 VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */); 584 inspector.doit(); 585 } 586 } 587 588 void CollectedHeap::post_full_gc_dump(GCTimer* timer) { 589 if (HeapDumpAfterFullGC) { 590 GCTraceTime tt("Heap Dump (after full gc): ", PrintGCDetails, false, timer); 591 HeapDumper::dump_heap(); 592 } 593 if (PrintClassHistogramAfterFullGC) { 594 GCTraceTime tt("Class Histogram (after full gc): ", PrintGCDetails, true, timer); 595 VM_GC_HeapInspection inspector(gclog_or_tty, false /* ! full gc */); 596 inspector.doit(); 597 } 598 } 599 600 void CollectedHeap::initialize_reserved_region(HeapWord *start, HeapWord *end) { 601 // It is important to do this in a way such that concurrent readers can't 602 // temporarily think something is in the heap. (Seen this happen in asserts.) 603 _reserved.set_word_size(0); 604 _reserved.set_start(start); 605 _reserved.set_end(end); 606 } 607 608 /////////////// Unit tests /////////////// 609 610 #ifndef PRODUCT 611 void CollectedHeap::test_is_in() { 612 CollectedHeap* heap = Universe::heap(); 613 614 uintptr_t epsilon = (uintptr_t) MinObjAlignment; |