1972 _used += r->used();
1973 return false;
1974 }
1975 size_t result() { return _used; }
1976 };
1977
1978 size_t G1CollectedHeap::recalculate_used() const {
1979 double recalculate_used_start = os::elapsedTime();
1980
1981 SumUsedClosure blk;
1982 heap_region_iterate(&blk);
1983
1984 g1_policy()->phase_times()->record_evac_fail_recalc_used_time((os::elapsedTime() - recalculate_used_start) * 1000.0);
1985 return blk.result();
1986 }
1987
1988 bool G1CollectedHeap::is_user_requested_concurrent_full_gc(GCCause::Cause cause) {
1989 switch (cause) {
1990 case GCCause::_java_lang_system_gc: return ExplicitGCInvokesConcurrent;
1991 case GCCause::_dcmd_gc_run: return ExplicitGCInvokesConcurrent;
1992 case GCCause::_update_allocation_context_stats_inc: return true;
1993 case GCCause::_wb_conc_mark: return true;
1994 default : return false;
1995 }
1996 }
1997
1998 bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
1999 switch (cause) {
2000 case GCCause::_gc_locker: return GCLockerInvokesConcurrent;
2001 case GCCause::_g1_humongous_allocation: return true;
2002 default: return is_user_requested_concurrent_full_gc(cause);
2003 }
2004 }
2005
2006 #ifndef PRODUCT
2007 void G1CollectedHeap::allocate_dummy_regions() {
2008 // Let's fill up most of the region
2009 size_t word_size = HeapRegion::GrainWords - 1024;
2010 // And as a result the region we'll allocate will be humongous.
2011 guarantee(is_humongous(word_size), "sanity");
2012
2524 // Update common counters.
2525 if (full) {
2526 // Update the number of full collections that have been completed.
2527 increment_old_marking_cycles_completed(false /* concurrent */);
2528 }
2529
2530 // We are at the end of the GC. Total collections has already been increased.
2531 g1_rem_set()->print_periodic_summary_info("After GC RS summary", total_collections() - 1);
2532
2533 // FIXME: what is this about?
2534 // I'm ignoring the "fill_newgen()" call if "alloc_event_enabled"
2535 // is set.
2536 #if COMPILER2_OR_JVMCI
2537 assert(DerivedPointerTable::is_empty(), "derived pointer present");
2538 #endif
2539 // always_do_update_barrier = true;
2540
2541 double start = os::elapsedTime();
2542 resize_all_tlabs();
2543 g1_policy()->phase_times()->record_resize_tlab_time_ms((os::elapsedTime() - start) * 1000.0);
2544
2545 allocation_context_stats().update(full);
2546
2547 MemoryService::track_memory_usage();
2548 // We have just completed a GC. Update the soft reference
2549 // policy with the new heap occupancy
2550 Universe::update_heap_info_at_gc();
2551 }
2552
2553 HeapWord* G1CollectedHeap::do_collection_pause(size_t word_size,
2554 uint gc_count_before,
2555 bool* succeeded,
2556 GCCause::Cause gc_cause) {
2557 assert_heap_not_locked_and_not_at_safepoint();
2558 VM_G1CollectForAllocation op(word_size,
2559 gc_count_before,
2560 gc_cause,
2561 false, /* should_initiate_conc_mark */
2562 g1_policy()->max_pause_time_ms(),
2563 AllocationContext::current());
2564 VMThread::execute(&op);
2565
|
1972 _used += r->used();
1973 return false;
1974 }
1975 size_t result() { return _used; }
1976 };
1977
1978 size_t G1CollectedHeap::recalculate_used() const {
1979 double recalculate_used_start = os::elapsedTime();
1980
1981 SumUsedClosure blk;
1982 heap_region_iterate(&blk);
1983
1984 g1_policy()->phase_times()->record_evac_fail_recalc_used_time((os::elapsedTime() - recalculate_used_start) * 1000.0);
1985 return blk.result();
1986 }
1987
1988 bool G1CollectedHeap::is_user_requested_concurrent_full_gc(GCCause::Cause cause) {
1989 switch (cause) {
1990 case GCCause::_java_lang_system_gc: return ExplicitGCInvokesConcurrent;
1991 case GCCause::_dcmd_gc_run: return ExplicitGCInvokesConcurrent;
1992 case GCCause::_wb_conc_mark: return true;
1993 default : return false;
1994 }
1995 }
1996
1997 bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
1998 switch (cause) {
1999 case GCCause::_gc_locker: return GCLockerInvokesConcurrent;
2000 case GCCause::_g1_humongous_allocation: return true;
2001 default: return is_user_requested_concurrent_full_gc(cause);
2002 }
2003 }
2004
2005 #ifndef PRODUCT
2006 void G1CollectedHeap::allocate_dummy_regions() {
2007 // Let's fill up most of the region
2008 size_t word_size = HeapRegion::GrainWords - 1024;
2009 // And as a result the region we'll allocate will be humongous.
2010 guarantee(is_humongous(word_size), "sanity");
2011
2523 // Update common counters.
2524 if (full) {
2525 // Update the number of full collections that have been completed.
2526 increment_old_marking_cycles_completed(false /* concurrent */);
2527 }
2528
2529 // We are at the end of the GC. Total collections has already been increased.
2530 g1_rem_set()->print_periodic_summary_info("After GC RS summary", total_collections() - 1);
2531
2532 // FIXME: what is this about?
2533 // I'm ignoring the "fill_newgen()" call if "alloc_event_enabled"
2534 // is set.
2535 #if COMPILER2_OR_JVMCI
2536 assert(DerivedPointerTable::is_empty(), "derived pointer present");
2537 #endif
2538 // always_do_update_barrier = true;
2539
2540 double start = os::elapsedTime();
2541 resize_all_tlabs();
2542 g1_policy()->phase_times()->record_resize_tlab_time_ms((os::elapsedTime() - start) * 1000.0);
2543
2544 MemoryService::track_memory_usage();
2545 // We have just completed a GC. Update the soft reference
2546 // policy with the new heap occupancy
2547 Universe::update_heap_info_at_gc();
2548 }
2549
2550 HeapWord* G1CollectedHeap::do_collection_pause(size_t word_size,
2551 uint gc_count_before,
2552 bool* succeeded,
2553 GCCause::Cause gc_cause) {
2554 assert_heap_not_locked_and_not_at_safepoint();
2555 VM_G1CollectForAllocation op(word_size,
2556 gc_count_before,
2557 gc_cause,
2558 false, /* should_initiate_conc_mark */
2559 g1_policy()->max_pause_time_ms(),
2560 AllocationContext::current());
2561 VMThread::execute(&op);
2562
|