< prev index next >

src/share/vm/gc_implementation/g1/concurrentMark.cpp

Print this page
rev 8331 : 8079579: Add SuspendibleThreadSetLeaver and make SuspendibleThreadSet::joint()/leave() private
Reviewed-by:

*** 191,207 **** public: ParClearNextMarkBitmapTask(ClearBitmapHRClosure *cl, uint n_workers, bool suspendible) : _cl(cl), _suspendible(suspendible), AbstractGangTask("Parallel Clear Bitmap Task"), _hrclaimer(n_workers) {} void work(uint worker_id) { ! if (_suspendible) { ! SuspendibleThreadSet::join(); ! } G1CollectedHeap::heap()->heap_region_par_iterate(_cl, worker_id, &_hrclaimer, true); - if (_suspendible) { - SuspendibleThreadSet::leave(); - } } }; void CMBitMap::clearAll() { G1CollectedHeap* g1h = G1CollectedHeap::heap(); --- 191,202 ---- public: ParClearNextMarkBitmapTask(ClearBitmapHRClosure *cl, uint n_workers, bool suspendible) : _cl(cl), _suspendible(suspendible), AbstractGangTask("Parallel Clear Bitmap Task"), _hrclaimer(n_workers) {} void work(uint worker_id) { ! SuspendibleThreadSetJoiner sts_join(_suspendible); G1CollectedHeap::heap()->heap_region_par_iterate(_cl, worker_id, &_hrclaimer, true); } }; void CMBitMap::clearAll() { G1CollectedHeap* g1h = G1CollectedHeap::heap();
*** 1004,1026 **** * barrier is one of the last things do_marking_step() does, and it * doesn't manipulate any data structures afterwards. */ void ConcurrentMark::enter_first_sync_barrier(uint worker_id) { if (verbose_low()) { gclog_or_tty->print_cr("[%u] entering first barrier", worker_id); } ! if (concurrent()) { ! SuspendibleThreadSet::leave(); } - bool barrier_aborted = !_first_overflow_barrier_sync.enter(); - - if (concurrent()) { - SuspendibleThreadSet::join(); - } // at this point everyone should have synced up and not be doing any // more work if (verbose_low()) { if (barrier_aborted) { --- 999,1019 ---- * barrier is one of the last things do_marking_step() does, and it * doesn't manipulate any data structures afterwards. */ void ConcurrentMark::enter_first_sync_barrier(uint worker_id) { + bool barrier_aborted; + if (verbose_low()) { gclog_or_tty->print_cr("[%u] entering first barrier", worker_id); } ! { ! SuspendibleThreadSetLeaver sts_leave(concurrent()); ! barrier_aborted = !_first_overflow_barrier_sync.enter(); } // at this point everyone should have synced up and not be doing any // more work if (verbose_low()) { if (barrier_aborted) {
*** 1063,1085 **** // after this, each task should reset its own data structures then // then go into the second barrier } void ConcurrentMark::enter_second_sync_barrier(uint worker_id) { if (verbose_low()) { gclog_or_tty->print_cr("[%u] entering second barrier", worker_id); } ! if (concurrent()) { ! SuspendibleThreadSet::leave(); } - bool barrier_aborted = !_second_overflow_barrier_sync.enter(); - - if (concurrent()) { - SuspendibleThreadSet::join(); - } // at this point everything should be re-initialized and ready to go if (verbose_low()) { if (barrier_aborted) { gclog_or_tty->print_cr("[%u] aborted second barrier", worker_id); --- 1056,1076 ---- // after this, each task should reset its own data structures then // then go into the second barrier } void ConcurrentMark::enter_second_sync_barrier(uint worker_id) { + bool barrier_aborted; + if (verbose_low()) { gclog_or_tty->print_cr("[%u] entering second barrier", worker_id); } ! { ! SuspendibleThreadSetLeaver sts_leave(concurrent()); ! barrier_aborted = !_second_overflow_barrier_sync.enter(); } // at this point everything should be re-initialized and ready to go if (verbose_low()) { if (barrier_aborted) { gclog_or_tty->print_cr("[%u] aborted second barrier", worker_id);
*** 1126,1136 **** "this should only be done by a conc GC thread"); ResourceMark rm; double start_vtime = os::elapsedVTime(); ! SuspendibleThreadSet::join(); assert(worker_id < _cm->active_tasks(), "invariant"); CMTask* the_task = _cm->task(worker_id); the_task->record_start_time(); if (!_cm->has_aborted()) { --- 1117,1128 ---- "this should only be done by a conc GC thread"); ResourceMark rm; double start_vtime = os::elapsedVTime(); ! { ! SuspendibleThreadSetJoiner sts_join; assert(worker_id < _cm->active_tasks(), "invariant"); CMTask* the_task = _cm->task(worker_id); the_task->record_start_time(); if (!_cm->has_aborted()) {
*** 1150,1169 **** jlong sleep_time_ms; if (!_cm->has_aborted() && the_task->has_aborted()) { sleep_time_ms = (jlong) (elapsed_vtime_sec * _cm->sleep_factor() * 1000.0); ! SuspendibleThreadSet::leave(); os::sleep(Thread::current(), sleep_time_ms, false); ! SuspendibleThreadSet::join(); } } while (!_cm->has_aborted() && the_task->has_aborted()); } the_task->record_end_time(); guarantee(!the_task->has_aborted() || _cm->has_aborted(), "invariant"); ! ! SuspendibleThreadSet::leave(); double end_vtime = os::elapsedVTime(); _cm->update_accum_task_vtime(worker_id, end_vtime - start_vtime); } --- 1142,1161 ---- jlong sleep_time_ms; if (!_cm->has_aborted() && the_task->has_aborted()) { sleep_time_ms = (jlong) (elapsed_vtime_sec * _cm->sleep_factor() * 1000.0); ! { ! SuspendibleThreadSetLeaver sts_leave; os::sleep(Thread::current(), sleep_time_ms, false); ! } } } while (!_cm->has_aborted() && the_task->has_aborted()); } the_task->record_end_time(); guarantee(!the_task->has_aborted() || _cm->has_aborted(), "invariant"); ! } double end_vtime = os::elapsedVTime(); _cm->update_accum_task_vtime(worker_id, end_vtime - start_vtime); }
< prev index next >