comparison src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp @ 20192:581e70386ec9

8039147: Cleanup SuspendibleThreadSet Reviewed-by: brutisso, tschatzl, mgerdin
author pliden
date Fri, 11 Apr 2014 12:29:24 +0200
parents 0982ec23da03
children 7df07d855c8e
comparison
equal deleted inserted replaced
20191:fd81a5764900 20192:581e70386ec9
188 VM_CGC_Operation op(&cl_cl, "GC cleanup", false /* needs_pll */); 188 VM_CGC_Operation op(&cl_cl, "GC cleanup", false /* needs_pll */);
189 VMThread::execute(&op); 189 VMThread::execute(&op);
190 } else { 190 } else {
191 // We don't want to update the marking status if a GC pause 191 // We don't want to update the marking status if a GC pause
192 // is already underway. 192 // is already underway.
193 _sts.join(); 193 SuspendibleThreadSetJoiner sts;
194 g1h->set_marking_complete(); 194 g1h->set_marking_complete();
195 _sts.leave();
196 } 195 }
197 196
198 // Check if cleanup set the free_regions_coming flag. If it 197 // Check if cleanup set the free_regions_coming flag. If it
199 // hasn't, we can just skip the next step. 198 // hasn't, we can just skip the next step.
200 if (g1h->free_regions_coming()) { 199 if (g1h->free_regions_coming()) {
258 // abort() will have completed and has_aborted() will return 257 // abort() will have completed and has_aborted() will return
259 // true to prevent us from calling 258 // true to prevent us from calling
260 // record_concurrent_mark_cleanup_completed() (and, in fact, it's 259 // record_concurrent_mark_cleanup_completed() (and, in fact, it's
261 // not needed any more as the concurrent mark state has been 260 // not needed any more as the concurrent mark state has been
262 // already reset). 261 // already reset).
263 _sts.join(); 262 {
264 if (!cm()->has_aborted()) { 263 SuspendibleThreadSetJoiner sts;
265 g1_policy->record_concurrent_mark_cleanup_completed(); 264 if (!cm()->has_aborted()) {
266 } 265 g1_policy->record_concurrent_mark_cleanup_completed();
267 _sts.leave(); 266 }
267 }
268 268
269 if (cm()->has_aborted()) { 269 if (cm()->has_aborted()) {
270 if (G1Log::fine()) { 270 if (G1Log::fine()) {
271 gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id()); 271 gclog_or_tty->gclog_stamp(cm()->concurrent_gc_id());
272 gclog_or_tty->print_cr("[GC concurrent-mark-abort]"); 272 gclog_or_tty->print_cr("[GC concurrent-mark-abort]");
273 } 273 }
274 } 274 }
275 275
276 // We now want to allow clearing of the marking bitmap to be 276 // We now want to allow clearing of the marking bitmap to be
277 // suspended by a collection pause. 277 // suspended by a collection pause.
278 _sts.join(); 278 {
279 _cm->clearNextBitmap(); 279 SuspendibleThreadSetJoiner sts;
280 _sts.leave(); 280 _cm->clearNextBitmap();
281 }
281 } 282 }
282 283
283 // Update the number of full collections that have been 284 // Update the number of full collections that have been
284 // completed. This will also notify the FullGCCount_lock in case a 285 // completed. This will also notify the FullGCCount_lock in case a
285 // Java thread is waiting for a full GC to happen (e.g., it 286 // Java thread is waiting for a full GC to happen (e.g., it
286 // called System.gc() with +ExplicitGCInvokesConcurrent). 287 // called System.gc() with +ExplicitGCInvokesConcurrent).
287 _sts.join(); 288 {
288 g1h->increment_old_marking_cycles_completed(true /* concurrent */); 289 SuspendibleThreadSetJoiner sts;
289 g1h->register_concurrent_cycle_end(); 290 g1h->increment_old_marking_cycles_completed(true /* concurrent */);
290 _sts.leave(); 291 g1h->register_concurrent_cycle_end();
292 }
291 } 293 }
292 assert(_should_terminate, "just checking"); 294 assert(_should_terminate, "just checking");
293 295
294 terminate(); 296 terminate();
295 }
296
297
298 void ConcurrentMarkThread::yield() {
299 _sts.yield("Concurrent Mark");
300 } 297 }
301 298
302 void ConcurrentMarkThread::stop() { 299 void ConcurrentMarkThread::stop() {
303 { 300 {
304 MutexLockerEx ml(Terminator_lock); 301 MutexLockerEx ml(Terminator_lock);