3986 _worker_id, _cm->mark_stack_size());
3987 }
3988 }
3989 }
3990
3991 // SATB Queue has several assumptions on whether to call the par or
3992 // non-par versions of the methods. this is why some of the code is
3993 // replicated. We should really get rid of the single-threaded version
3994 // of the code to simplify things.
3995 void CMTask::drain_satb_buffers() {
3996 if (has_aborted()) return;
3997
3998 // We set this so that the regular clock knows that we're in the
3999 // middle of draining buffers and doesn't set the abort flag when it
4000 // notices that SATB buffers are available for draining. It'd be
4001 // very counter productive if it did that. :-)
4002 _draining_satb_buffers = true;
4003
4004 CMObjectClosure oc(this);
4005 SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
4006 if (G1CollectedHeap::use_parallel_gc_threads()) {
4007 satb_mq_set.set_par_closure(_worker_id, &oc);
4008 } else {
4009 satb_mq_set.set_closure(&oc);
4010 }
4011
4012 // This keeps claiming and applying the closure to completed buffers
4013 // until we run out of buffers or we need to abort.
4014 if (G1CollectedHeap::use_parallel_gc_threads()) {
4015 while (!has_aborted() &&
4016 satb_mq_set.par_apply_closure_to_completed_buffer(_worker_id)) {
4017 if (_cm->verbose_medium()) {
4018 gclog_or_tty->print_cr("[%u] processed an SATB buffer", _worker_id);
4019 }
4020 statsOnly( ++_satb_buffers_processed );
4021 regular_clock_call();
4022 }
4023 } else {
4024 while (!has_aborted() &&
4025 satb_mq_set.apply_closure_to_completed_buffer()) {
4026 if (_cm->verbose_medium()) {
4027 gclog_or_tty->print_cr("[%u] processed an SATB buffer", _worker_id);
4028 }
4029 statsOnly( ++_satb_buffers_processed );
4030 regular_clock_call();
4031 }
4032 }
4033
4034 _draining_satb_buffers = false;
4035
4036 assert(has_aborted() ||
4037 concurrent() ||
4038 satb_mq_set.completed_buffers_num() == 0, "invariant");
4039
4040 if (G1CollectedHeap::use_parallel_gc_threads()) {
4041 satb_mq_set.set_par_closure(_worker_id, NULL);
4042 } else {
4043 satb_mq_set.set_closure(NULL);
4044 }
4045
4046 // again, this was a potentially expensive operation, decrease the
4047 // limits to get the regular clock call early
4048 decrease_limits();
4049 }
4050
4051 void CMTask::print_stats() {
4052 gclog_or_tty->print_cr("Marking Stats, task = %u, calls = %d",
4053 _worker_id, _calls);
4054 gclog_or_tty->print_cr(" Elapsed time = %1.2lfms, Termination time = %1.2lfms",
4055 _elapsed_time_ms, _termination_time_ms);
4056 gclog_or_tty->print_cr(" Step Times (cum): num = %d, avg = %1.2lfms, sd = %1.2lfms",
4057 _step_times_ms.num(), _step_times_ms.avg(),
4058 _step_times_ms.sd());
4059 gclog_or_tty->print_cr(" max = %1.2lfms, total = %1.2lfms",
4060 _step_times_ms.maximum(), _step_times_ms.sum());
4061
4062 #if _MARKING_STATS_
4063 gclog_or_tty->print_cr(" Clock Intervals (cum): num = %d, avg = %1.2lfms, sd = %1.2lfms",
4064 _all_clock_intervals_ms.num(), _all_clock_intervals_ms.avg(),
|
3986 _worker_id, _cm->mark_stack_size());
3987 }
3988 }
3989 }
3990
3991 // SATB Queue has several assumptions on whether to call the par or
3992 // non-par versions of the methods. this is why some of the code is
3993 // replicated. We should really get rid of the single-threaded version
3994 // of the code to simplify things.
3995 void CMTask::drain_satb_buffers() {
3996 if (has_aborted()) return;
3997
3998 // We set this so that the regular clock knows that we're in the
3999 // middle of draining buffers and doesn't set the abort flag when it
4000 // notices that SATB buffers are available for draining. It'd be
4001 // very counter productive if it did that. :-)
4002 _draining_satb_buffers = true;
4003
4004 CMObjectClosure oc(this);
4005 SATBMarkQueueSet& satb_mq_set = JavaThread::satb_mark_queue_set();
4006
4007 // This keeps claiming and applying the closure to completed buffers
4008 // until we run out of buffers or we need to abort.
4009 while (!has_aborted() &&
4010 satb_mq_set.apply_closure_to_completed_buffer(&oc)) {
4011 if (_cm->verbose_medium()) {
4012 gclog_or_tty->print_cr("[%u] processed an SATB buffer", _worker_id);
4013 }
4014 statsOnly( ++_satb_buffers_processed );
4015 regular_clock_call();
4016 }
4017
4018 _draining_satb_buffers = false;
4019
4020 assert(has_aborted() ||
4021 concurrent() ||
4022 satb_mq_set.completed_buffers_num() == 0, "invariant");
4023
4024 // again, this was a potentially expensive operation, decrease the
4025 // limits to get the regular clock call early
4026 decrease_limits();
4027 }
4028
4029 void CMTask::print_stats() {
4030 gclog_or_tty->print_cr("Marking Stats, task = %u, calls = %d",
4031 _worker_id, _calls);
4032 gclog_or_tty->print_cr(" Elapsed time = %1.2lfms, Termination time = %1.2lfms",
4033 _elapsed_time_ms, _termination_time_ms);
4034 gclog_or_tty->print_cr(" Step Times (cum): num = %d, avg = %1.2lfms, sd = %1.2lfms",
4035 _step_times_ms.num(), _step_times_ms.avg(),
4036 _step_times_ms.sd());
4037 gclog_or_tty->print_cr(" max = %1.2lfms, total = %1.2lfms",
4038 _step_times_ms.maximum(), _step_times_ms.sum());
4039
4040 #if _MARKING_STATS_
4041 gclog_or_tty->print_cr(" Clock Intervals (cum): num = %d, avg = %1.2lfms, sd = %1.2lfms",
4042 _all_clock_intervals_ms.num(), _all_clock_intervals_ms.avg(),
|