comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @ 1359:23b1b27ac76c

6909756: G1: guarantee(G1CollectedHeap::heap()->mark_in_progress(),"Precondition.") Summary: Make sure that two marking cycles do not overlap, i.e., a new one can only start after the concurrent marking thread finishes all its work. In the fix I piggy-back a couple of minor extra fixes: some general code reformatting for consistency (only around the code I modified), the removal of a field (G1CollectorPolicy::_should_initiate_conc_mark) which doesn't seem to be used at all (it's only set but never read), as well as moving the "is GC locker active" test earlier into the G1 pause / Full GC and using a more appropriate method for it. Reviewed-by: johnc, jmasa, jcoomes, ysr
author tonyp
date Tue, 06 Apr 2010 10:59:45 -0400
parents 56507bcd639e
children 1316cec51b4d
comparison
equal deleted inserted replaced
1358:72f725c5a7be 1359:23b1b27ac76c
722 // Number of pauses between concurrent marking. 722 // Number of pauses between concurrent marking.
723 size_t _pauses_btwn_concurrent_mark; 723 size_t _pauses_btwn_concurrent_mark;
724 724
725 size_t _n_marks_since_last_pause; 725 size_t _n_marks_since_last_pause;
726 726
727 // True iff CM has been initiated. 727 // At the end of a pause we check the heap occupancy and we decide
728 bool _conc_mark_initiated; 728 // whether we will start a marking cycle during the next pause. If
729 729 // we decide that we want to do that, we will set this parameter to
730 // True iff CM should be initiated 730 // true. So, this parameter will stay true between the end of a
731 bool _should_initiate_conc_mark; 731 // pause and the beginning of a subsequent pause (not necessarily
732 // the next one, see the comments on the next field) when we decide
733 // that we will indeed start a marking cycle and do the initial-mark
734 // work.
735 volatile bool _initiate_conc_mark_if_possible;
736
737 // If initiate_conc_mark_if_possible() is set at the beginning of a
738 // pause, it is a suggestion that the pause should start a marking
739 // cycle by doing the initial-mark work. However, it is possible
740 // that the concurrent marking thread is still finishing up the
741 // previous marking cycle (e.g., clearing the next marking
742 // bitmap). If that is the case we cannot start a new cycle and
743 // we'll have to wait for the concurrent marking thread to finish
744 // what it is doing. In this case we will postpone the marking cycle
745 // initiation decision for the next pause. When we eventually decide
746 // to start a cycle, we will set _during_initial_mark_pause which
747 // will stay true until the end of the initial-mark pause and it's
748 // the condition that indicates that a pause is doing the
749 // initial-mark work.
750 volatile bool _during_initial_mark_pause;
751
732 bool _should_revert_to_full_young_gcs; 752 bool _should_revert_to_full_young_gcs;
733 bool _last_full_young_gc; 753 bool _last_full_young_gc;
734 754
735 // This set of variables tracks the collector efficiency, in order to 755 // This set of variables tracks the collector efficiency, in order to
736 // determine whether we should initiate a new marking. 756 // determine whether we should initiate a new marking.
979 size_t collection_set_size() { return _collection_set_size; } 999 size_t collection_set_size() { return _collection_set_size; }
980 1000
981 // Add "hr" to the CS. 1001 // Add "hr" to the CS.
982 void add_to_collection_set(HeapRegion* hr); 1002 void add_to_collection_set(HeapRegion* hr);
983 1003
984 bool should_initiate_conc_mark() { return _should_initiate_conc_mark; } 1004 bool initiate_conc_mark_if_possible() { return _initiate_conc_mark_if_possible; }
985 void set_should_initiate_conc_mark() { _should_initiate_conc_mark = true; } 1005 void set_initiate_conc_mark_if_possible() { _initiate_conc_mark_if_possible = true; }
986 void unset_should_initiate_conc_mark(){ _should_initiate_conc_mark = false; } 1006 void clear_initiate_conc_mark_if_possible() { _initiate_conc_mark_if_possible = false; }
1007
1008 bool during_initial_mark_pause() { return _during_initial_mark_pause; }
1009 void set_during_initial_mark_pause() { _during_initial_mark_pause = true; }
1010 void clear_during_initial_mark_pause(){ _during_initial_mark_pause = false; }
1011
1012 // This is called at the very beginning of an evacuation pause (it
1013 // has to be the first thing that the pause does). If
1014 // initiate_conc_mark_if_possible() is true, and the concurrent
1015 // marking thread has completed its work during the previous cycle,
1016 // it will set during_initial_mark_pause() to so that the pause does
1017 // the initial-mark work and start a marking cycle.
1018 void decide_on_conc_mark_initiation();
987 1019
988 // If an expansion would be appropriate, because recent GC overhead had 1020 // If an expansion would be appropriate, because recent GC overhead had
989 // exceeded the desired limit, return an amount to expand by. 1021 // exceeded the desired limit, return an amount to expand by.
990 virtual size_t expansion_amount(); 1022 virtual size_t expansion_amount();
991 1023