comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp @ 6120:37552638d24a

7172388: G1: _total_full_collections should not be incremented for concurrent cycles Reviewed-by: azeemj, jmasa
author brutisso
date Tue, 05 Jun 2012 22:30:24 +0200
parents 720b6a76dd9d
children d2a62e0f25eb
comparison
equal deleted inserted replaced
6119:a297b0e14605 6120:37552638d24a
357 // (a) cause == _gc_locker and +GCLockerInvokesConcurrent, or 357 // (a) cause == _gc_locker and +GCLockerInvokesConcurrent, or
358 // (b) cause == _java_lang_system_gc and +ExplicitGCInvokesConcurrent. 358 // (b) cause == _java_lang_system_gc and +ExplicitGCInvokesConcurrent.
359 // (c) cause == _g1_humongous_allocation 359 // (c) cause == _g1_humongous_allocation
360 bool should_do_concurrent_full_gc(GCCause::Cause cause); 360 bool should_do_concurrent_full_gc(GCCause::Cause cause);
361 361
362 // Keeps track of how many "full collections" (i.e., Full GCs or 362 // Keeps track of how many "old marking cycles" (i.e., Full GCs or
363 // concurrent cycles) we have completed. The number of them we have 363 // concurrent cycles) we have started.
364 // started is maintained in _total_full_collections in CollectedHeap. 364 volatile unsigned int _old_marking_cycles_started;
365 volatile unsigned int _full_collections_completed; 365
366 // Keeps track of how many "old marking cycles" (i.e., Full GCs or
367 // concurrent cycles) we have completed.
368 volatile unsigned int _old_marking_cycles_completed;
366 369
367 // This is a non-product method that is helpful for testing. It is 370 // This is a non-product method that is helpful for testing. It is
368 // called at the end of a GC and artificially expands the heap by 371 // called at the end of a GC and artificially expands the heap by
369 // allocating a number of dead regions. This way we can induce very 372 // allocating a number of dead regions. This way we can induce very
370 // frequent marking cycles and stress the cleanup / concurrent 373 // frequent marking cycles and stress the cleanup / concurrent
671 assert(_in_cset_fast_test_base != NULL, "sanity"); 674 assert(_in_cset_fast_test_base != NULL, "sanity");
672 memset(_in_cset_fast_test_base, false, 675 memset(_in_cset_fast_test_base, false,
673 (size_t) _in_cset_fast_test_length * sizeof(bool)); 676 (size_t) _in_cset_fast_test_length * sizeof(bool));
674 } 677 }
675 678
679 // This is called at the start of either a concurrent cycle or a Full
680 // GC to update the number of old marking cycles started.
681 void increment_old_marking_cycles_started();
682
676 // This is called at the end of either a concurrent cycle or a Full 683 // This is called at the end of either a concurrent cycle or a Full
677 // GC to update the number of full collections completed. Those two 684 // GC to update the number of old marking cycles completed. Those two
678 // can happen in a nested fashion, i.e., we start a concurrent 685 // can happen in a nested fashion, i.e., we start a concurrent
679 // cycle, a Full GC happens half-way through it which ends first, 686 // cycle, a Full GC happens half-way through it which ends first,
680 // and then the cycle notices that a Full GC happened and ends 687 // and then the cycle notices that a Full GC happened and ends
681 // too. The concurrent parameter is a boolean to help us do a bit 688 // too. The concurrent parameter is a boolean to help us do a bit
682 // tighter consistency checking in the method. If concurrent is 689 // tighter consistency checking in the method. If concurrent is
683 // false, the caller is the inner caller in the nesting (i.e., the 690 // false, the caller is the inner caller in the nesting (i.e., the
684 // Full GC). If concurrent is true, the caller is the outer caller 691 // Full GC). If concurrent is true, the caller is the outer caller
685 // in this nesting (i.e., the concurrent cycle). Further nesting is 692 // in this nesting (i.e., the concurrent cycle). Further nesting is
686 // not currently supported. The end of the this call also notifies 693 // not currently supported. The end of this call also notifies
687 // the FullGCCount_lock in case a Java thread is waiting for a full 694 // the FullGCCount_lock in case a Java thread is waiting for a full
688 // GC to happen (e.g., it called System.gc() with 695 // GC to happen (e.g., it called System.gc() with
689 // +ExplicitGCInvokesConcurrent). 696 // +ExplicitGCInvokesConcurrent).
690 void increment_full_collections_completed(bool concurrent); 697 void increment_old_marking_cycles_completed(bool concurrent);
691 698
692 unsigned int full_collections_completed() { 699 unsigned int old_marking_cycles_completed() {
693 return _full_collections_completed; 700 return _old_marking_cycles_completed;
694 } 701 }
695 702
696 G1HRPrinter* hr_printer() { return &_hr_printer; } 703 G1HRPrinter* hr_printer() { return &_hr_printer; }
697 704
698 protected: 705 protected: