< prev index next >
src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp
Print this page
rev 47675 : [mq]: 8149127-rename-concurrentrefine-a
rev 47676 : imported patch 8149127-rename-concurrentrefine-b
rev 47677 : [mq]: 8149127-rename-concurrentrefine-b-stefanj-review
*** 21,51 ****
* questions.
*
*/
#include "precompiled.hpp"
! #include "gc/g1/concurrentG1Refine.hpp"
! #include "gc/g1/concurrentG1RefineThread.hpp"
#include "gc/g1/g1CollectedHeap.inline.hpp"
#include "gc/g1/g1RemSet.hpp"
#include "gc/shared/suspendibleThreadSet.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/mutexLocker.hpp"
! ConcurrentG1RefineThread::
! ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread *next,
! uint worker_id_offset, uint worker_id,
! size_t activate, size_t deactivate) :
ConcurrentGCThread(),
_worker_id_offset(worker_id_offset),
_worker_id(worker_id),
_active(false),
_next(next),
_monitor(NULL),
! _cg1r(cg1r),
_vtime_accum(0.0),
_activation_threshold(activate),
_deactivation_threshold(deactivate)
{
--- 21,53 ----
* questions.
*
*/
#include "precompiled.hpp"
! #include "gc/g1/g1ConcurrentRefine.hpp"
! #include "gc/g1/g1ConcurrentRefineThread.hpp"
#include "gc/g1/g1CollectedHeap.inline.hpp"
#include "gc/g1/g1RemSet.hpp"
#include "gc/shared/suspendibleThreadSet.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/mutexLocker.hpp"
! G1ConcurrentRefineThread::G1ConcurrentRefineThread(G1ConcurrentRefine* cr,
! G1ConcurrentRefineThread *next,
! uint worker_id_offset,
! uint worker_id,
! size_t activate,
! size_t deactivate) :
ConcurrentGCThread(),
_worker_id_offset(worker_id_offset),
_worker_id(worker_id),
_active(false),
_next(next),
_monitor(NULL),
! _cr(cr),
_vtime_accum(0.0),
_activation_threshold(activate),
_deactivation_threshold(deactivate)
{
*** 63,113 ****
// set name
set_name("G1 Refine#%d", worker_id);
create_and_start();
}
! void ConcurrentG1RefineThread::update_thresholds(size_t activate,
size_t deactivate) {
assert(deactivate < activate, "precondition");
_activation_threshold = activate;
_deactivation_threshold = deactivate;
}
! void ConcurrentG1RefineThread::wait_for_completed_buffers() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
while (!should_terminate() && !is_active()) {
_monitor->wait(Mutex::_no_safepoint_check_flag);
}
}
! bool ConcurrentG1RefineThread::is_active() {
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
return is_primary() ? dcqs.process_completed_buffers() : _active;
}
! void ConcurrentG1RefineThread::activate() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
if (!is_primary()) {
set_active(true);
} else {
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
dcqs.set_process_completed(true);
}
_monitor->notify();
}
! void ConcurrentG1RefineThread::deactivate() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
if (!is_primary()) {
set_active(false);
} else {
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
dcqs.set_process_completed(false);
}
}
! void ConcurrentG1RefineThread::run_service() {
_vtime_start = os::elapsedVTime();
while (!should_terminate()) {
// Wait for work
wait_for_completed_buffers();
--- 65,115 ----
// set name
set_name("G1 Refine#%d", worker_id);
create_and_start();
}
! void G1ConcurrentRefineThread::update_thresholds(size_t activate,
size_t deactivate) {
assert(deactivate < activate, "precondition");
_activation_threshold = activate;
_deactivation_threshold = deactivate;
}
! void G1ConcurrentRefineThread::wait_for_completed_buffers() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
while (!should_terminate() && !is_active()) {
_monitor->wait(Mutex::_no_safepoint_check_flag);
}
}
! bool G1ConcurrentRefineThread::is_active() {
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
return is_primary() ? dcqs.process_completed_buffers() : _active;
}
! void G1ConcurrentRefineThread::activate() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
if (!is_primary()) {
set_active(true);
} else {
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
dcqs.set_process_completed(true);
}
_monitor->notify();
}
! void G1ConcurrentRefineThread::deactivate() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
if (!is_primary()) {
set_active(false);
} else {
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
dcqs.set_process_completed(false);
}
}
! void G1ConcurrentRefineThread::run_service() {
_vtime_start = os::elapsedVTime();
while (!should_terminate()) {
// Wait for work
wait_for_completed_buffers();
*** 130,140 ****
}
size_t curr_buffer_num = dcqs.completed_buffers_num();
// If the number of the buffers falls down into the yellow zone,
// that means that the transition period after the evacuation pause has ended.
! if (dcqs.completed_queue_padding() > 0 && curr_buffer_num <= cg1r()->yellow_zone()) {
dcqs.set_completed_queue_padding(0);
}
// Check if we need to activate the next thread.
if ((_next != NULL) &&
--- 132,142 ----
}
size_t curr_buffer_num = dcqs.completed_buffers_num();
// If the number of the buffers falls down into the yellow zone,
// that means that the transition period after the evacuation pause has ended.
! if (dcqs.completed_queue_padding() > 0 && curr_buffer_num <= cr()->yellow_zone()) {
dcqs.set_completed_queue_padding(0);
}
// Check if we need to activate the next thread.
if ((_next != NULL) &&
*** 166,174 ****
}
log_debug(gc, refine)("Stopping %d", _worker_id);
}
! void ConcurrentG1RefineThread::stop_service() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
_monitor->notify();
}
--- 168,176 ----
}
log_debug(gc, refine)("Stopping %d", _worker_id);
}
! void G1ConcurrentRefineThread::stop_service() {
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
_monitor->notify();
}
< prev index next >