2504 stats->regions_filled(), stats->direct_allocated(), 2505 stats->failure_used(), stats->failure_waste()); 2506 } 2507 2508 void G1CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) { 2509 const G1HeapSummary& heap_summary = create_g1_heap_summary(); 2510 gc_tracer->report_gc_heap_summary(when, heap_summary); 2511 2512 const MetaspaceSummary& metaspace_summary = create_metaspace_summary(); 2513 gc_tracer->report_metaspace_summary(when, metaspace_summary); 2514 } 2515 2516 G1CollectedHeap* G1CollectedHeap::heap() { 2517 CollectedHeap* heap = Universe::heap(); 2518 assert(heap != NULL, "Uninitialized access to G1CollectedHeap::heap()"); 2519 assert(heap->kind() == CollectedHeap::G1, "Invalid name"); 2520 return (G1CollectedHeap*)heap; 2521 } 2522 2523 void G1CollectedHeap::gc_prologue(bool full) { 2524 // always_do_update_barrier = false; 2525 assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer"); 2526 2527 // This summary needs to be printed before incrementing total collections. 2528 rem_set()->print_periodic_summary_info("Before GC RS summary", total_collections()); 2529 2530 // Update common counters. 2531 increment_total_collections(full /* full gc */); 2532 if (full || collector_state()->in_initial_mark_gc()) { 2533 increment_old_marking_cycles_started(); 2534 } 2535 2536 // Fill TLAB's and such 2537 double start = os::elapsedTime(); 2538 ensure_parsability(true); 2539 phase_times()->record_prepare_tlab_time_ms((os::elapsedTime() - start) * 1000.0); 2540 } 2541 2542 void G1CollectedHeap::gc_epilogue(bool full) { 2543 // Update common counters. 2544 if (full) { 2545 // Update the number of full collections that have been completed. 2546 increment_old_marking_cycles_completed(false /* concurrent */); 2547 } 2548 2549 // We are at the end of the GC. Total collections has already been increased. 2550 rem_set()->print_periodic_summary_info("After GC RS summary", total_collections() - 1); 2551 2552 // FIXME: what is this about? 2553 // I'm ignoring the "fill_newgen()" call if "alloc_event_enabled" 2554 // is set. 2555 #if COMPILER2_OR_JVMCI 2556 assert(DerivedPointerTable::is_empty(), "derived pointer present"); 2557 #endif 2558 // always_do_update_barrier = true; 2559 2560 double start = os::elapsedTime(); 2561 resize_all_tlabs(); 2562 phase_times()->record_resize_tlab_time_ms((os::elapsedTime() - start) * 1000.0); 2563 2564 MemoryService::track_memory_usage(); 2565 // We have just completed a GC. Update the soft reference 2566 // policy with the new heap occupancy 2567 Universe::update_heap_info_at_gc(); 2568 } 2569 2570 HeapWord* G1CollectedHeap::do_collection_pause(size_t word_size, 2571 uint gc_count_before, 2572 bool* succeeded, 2573 GCCause::Cause gc_cause) { 2574 assert_heap_not_locked_and_not_at_safepoint(); 2575 VM_G1CollectForAllocation op(word_size, 2576 gc_count_before, 2577 gc_cause, 2578 false, /* should_initiate_conc_mark */ | 2504 stats->regions_filled(), stats->direct_allocated(), 2505 stats->failure_used(), stats->failure_waste()); 2506 } 2507 2508 void G1CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) { 2509 const G1HeapSummary& heap_summary = create_g1_heap_summary(); 2510 gc_tracer->report_gc_heap_summary(when, heap_summary); 2511 2512 const MetaspaceSummary& metaspace_summary = create_metaspace_summary(); 2513 gc_tracer->report_metaspace_summary(when, metaspace_summary); 2514 } 2515 2516 G1CollectedHeap* G1CollectedHeap::heap() { 2517 CollectedHeap* heap = Universe::heap(); 2518 assert(heap != NULL, "Uninitialized access to G1CollectedHeap::heap()"); 2519 assert(heap->kind() == CollectedHeap::G1, "Invalid name"); 2520 return (G1CollectedHeap*)heap; 2521 } 2522 2523 void G1CollectedHeap::gc_prologue(bool full) { 2524 assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer"); 2525 2526 // This summary needs to be printed before incrementing total collections. 2527 rem_set()->print_periodic_summary_info("Before GC RS summary", total_collections()); 2528 2529 // Update common counters. 2530 increment_total_collections(full /* full gc */); 2531 if (full || collector_state()->in_initial_mark_gc()) { 2532 increment_old_marking_cycles_started(); 2533 } 2534 2535 // Fill TLAB's and such 2536 double start = os::elapsedTime(); 2537 ensure_parsability(true); 2538 phase_times()->record_prepare_tlab_time_ms((os::elapsedTime() - start) * 1000.0); 2539 } 2540 2541 void G1CollectedHeap::gc_epilogue(bool full) { 2542 // Update common counters. 2543 if (full) { 2544 // Update the number of full collections that have been completed. 2545 increment_old_marking_cycles_completed(false /* concurrent */); 2546 } 2547 2548 // We are at the end of the GC. Total collections has already been increased. 2549 rem_set()->print_periodic_summary_info("After GC RS summary", total_collections() - 1); 2550 2551 // FIXME: what is this about? 2552 // I'm ignoring the "fill_newgen()" call if "alloc_event_enabled" 2553 // is set. 2554 #if COMPILER2_OR_JVMCI 2555 assert(DerivedPointerTable::is_empty(), "derived pointer present"); 2556 #endif 2557 2558 double start = os::elapsedTime(); 2559 resize_all_tlabs(); 2560 phase_times()->record_resize_tlab_time_ms((os::elapsedTime() - start) * 1000.0); 2561 2562 MemoryService::track_memory_usage(); 2563 // We have just completed a GC. Update the soft reference 2564 // policy with the new heap occupancy 2565 Universe::update_heap_info_at_gc(); 2566 } 2567 2568 HeapWord* G1CollectedHeap::do_collection_pause(size_t word_size, 2569 uint gc_count_before, 2570 bool* succeeded, 2571 GCCause::Cause gc_cause) { 2572 assert_heap_not_locked_and_not_at_safepoint(); 2573 VM_G1CollectForAllocation op(word_size, 2574 gc_count_before, 2575 gc_cause, 2576 false, /* should_initiate_conc_mark */ |