equal
deleted
inserted
replaced
88 G1MMUTracker *mmu_tracker = g1_policy->mmu_tracker(); |
88 G1MMUTracker *mmu_tracker = g1_policy->mmu_tracker(); |
89 jlong sleep_time_ms = mmu_tracker->when_ms(now, prediction_ms); |
89 jlong sleep_time_ms = mmu_tracker->when_ms(now, prediction_ms); |
90 os::sleep(this, sleep_time_ms, false); |
90 os::sleep(this, sleep_time_ms, false); |
91 } |
91 } |
92 } |
92 } |
|
93 |
|
94 class GCConcPhaseTimer : StackObj { |
|
95 ConcurrentMark* _cm; |
|
96 |
|
97 public: |
|
98 GCConcPhaseTimer(ConcurrentMark* cm, const char* title) : _cm(cm) { |
|
99 _cm->register_concurrent_phase_start(title); |
|
100 } |
|
101 |
|
102 ~GCConcPhaseTimer() { |
|
103 _cm->register_concurrent_phase_end(); |
|
104 } |
|
105 }; |
|
106 |
93 void ConcurrentMarkThread::run() { |
107 void ConcurrentMarkThread::run() { |
94 initialize_in_thread(); |
108 initialize_in_thread(); |
95 wait_for_universe_init(); |
109 wait_for_universe_init(); |
96 |
110 |
97 run_service(); |
111 run_service(); |
125 // subsequent GC could block us from joining the STS and proceed |
139 // subsequent GC could block us from joining the STS and proceed |
126 // without the root regions have been scanned which would be a |
140 // without the root regions have been scanned which would be a |
127 // correctness issue. |
141 // correctness issue. |
128 |
142 |
129 if (!cm()->has_aborted()) { |
143 if (!cm()->has_aborted()) { |
|
144 GCConcPhaseTimer(_cm, "Concurrent Root Region Scanning"); |
130 _cm->scanRootRegions(); |
145 _cm->scanRootRegions(); |
131 } |
146 } |
132 |
147 |
133 // It would be nice to use the GCTraceConcTime class here but |
148 // It would be nice to use the GCTraceConcTime class here but |
134 // the "end" logging is inside the loop and not at the end of |
149 // the "end" logging is inside the loop and not at the end of |
138 |
153 |
139 int iter = 0; |
154 int iter = 0; |
140 do { |
155 do { |
141 iter++; |
156 iter++; |
142 if (!cm()->has_aborted()) { |
157 if (!cm()->has_aborted()) { |
|
158 GCConcPhaseTimer(_cm, "Concurrent Mark"); |
143 _cm->markFromRoots(); |
159 _cm->markFromRoots(); |
144 } |
160 } |
145 |
161 |
146 double mark_end_time = os::elapsedVTime(); |
162 double mark_end_time = os::elapsedVTime(); |
147 jlong mark_end = os::elapsed_counter(); |
163 jlong mark_end = os::elapsed_counter(); |
192 // case they are needed by the pause. If a Full GC takes |
208 // case they are needed by the pause. If a Full GC takes |
193 // place, it would wait for us to process the regions |
209 // place, it would wait for us to process the regions |
194 // reclaimed by cleanup. |
210 // reclaimed by cleanup. |
195 |
211 |
196 GCTraceConcTime(Info, gc) tt("Concurrent Cleanup"); |
212 GCTraceConcTime(Info, gc) tt("Concurrent Cleanup"); |
|
213 GCConcPhaseTimer(_cm, "Concurrent Cleanup"); |
197 |
214 |
198 // Now do the concurrent cleanup operation. |
215 // Now do the concurrent cleanup operation. |
199 _cm->completeCleanup(); |
216 _cm->completeCleanup(); |
200 |
217 |
201 // Notify anyone who's waiting that there are no more free |
218 // Notify anyone who's waiting that there are no more free |
248 // We now want to allow clearing of the marking bitmap to be |
265 // We now want to allow clearing of the marking bitmap to be |
249 // suspended by a collection pause. |
266 // suspended by a collection pause. |
250 // We may have aborted just before the remark. Do not bother clearing the |
267 // We may have aborted just before the remark. Do not bother clearing the |
251 // bitmap then, as it has been done during mark abort. |
268 // bitmap then, as it has been done during mark abort. |
252 if (!cm()->has_aborted()) { |
269 if (!cm()->has_aborted()) { |
|
270 GCConcPhaseTimer(_cm, "Concurrent Bitmap Clearing"); |
253 _cm->clearNextBitmap(); |
271 _cm->clearNextBitmap(); |
254 } else { |
272 } else { |
255 assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear"); |
273 assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear"); |
256 } |
274 } |
257 } |
275 } |