comparison src/share/vm/gc_implementation/g1/concurrentMarkThread.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 035d2e036a9b
children c18cbe5936b8
comparison
equal deleted inserted replaced
1358:72f725c5a7be 1359:23b1b27ac76c
40 public: 40 public:
41 virtual void run(); 41 virtual void run();
42 42
43 private: 43 private:
44 ConcurrentMark* _cm; 44 ConcurrentMark* _cm;
45 bool _started; 45 volatile bool _started;
46 bool _in_progress; 46 volatile bool _in_progress;
47 47
48 void sleepBeforeNextCycle(); 48 void sleepBeforeNextCycle();
49 49
50 static SurrogateLockerThread* _slt; 50 static SurrogateLockerThread* _slt;
51 51
65 // Marking virtual time so far 65 // Marking virtual time so far
66 double vtime_mark_accum(); 66 double vtime_mark_accum();
67 // Counting virtual time so far. 67 // Counting virtual time so far.
68 double vtime_count_accum() { return _vtime_count_accum; } 68 double vtime_count_accum() { return _vtime_count_accum; }
69 69
70 ConcurrentMark* cm() { return _cm; } 70 ConcurrentMark* cm() { return _cm; }
71 71
72 void set_started() { _started = true; } 72 void set_started() { _started = true; }
73 void clear_started() { _started = false; } 73 void clear_started() { _started = false; }
74 bool started() { return _started; } 74 bool started() { return _started; }
75 75
76 void set_in_progress() { _in_progress = true; } 76 void set_in_progress() { _in_progress = true; }
77 void clear_in_progress() { _in_progress = false; } 77 void clear_in_progress() { _in_progress = false; }
78 bool in_progress() { return _in_progress; } 78 bool in_progress() { return _in_progress; }
79
80 // This flag returns true from the moment a marking cycle is
81 // initiated (during the initial-mark pause when started() is set)
82 // to the moment when the cycle completes (just after the next
83 // marking bitmap has been cleared and in_progress() is
84 // cleared). While this flag is true we will not start another cycle
85 // so that cycles do not overlap. We cannot use just in_progress()
86 // as the CM thread might take some time to wake up before noticing
87 // that started() is set and set in_progress().
88 bool during_cycle() { return started() || in_progress(); }
79 89
80 // Yield for GC 90 // Yield for GC
81 void yield(); 91 void yield();
82 92
83 // shutdown 93 // shutdown