< prev index next >
src/share/vm/gc/shared/workgroup.cpp
Print this page
*** 58,77 ****
set_thread(worker_id, new_worker);
return new_worker;
}
void AbstractWorkGang::add_workers(bool initializing) {
os::ThreadType worker_type;
if (are_ConcurrentGC_threads()) {
worker_type = os::cgc_thread;
} else {
worker_type = os::pgc_thread;
}
_created_workers = WorkerManager::add_workers(this,
! _active_workers,
_total_workers,
_created_workers,
worker_type,
initializing);
_active_workers = MIN2(_created_workers, _active_workers);
--- 58,81 ----
set_thread(worker_id, new_worker);
return new_worker;
}
void AbstractWorkGang::add_workers(bool initializing) {
+ add_workers(_active_workers, initializing);
+ }
+
+ void AbstractWorkGang::add_workers(uint active_workers, bool initializing) {
os::ThreadType worker_type;
if (are_ConcurrentGC_threads()) {
worker_type = os::cgc_thread;
} else {
worker_type = os::pgc_thread;
}
_created_workers = WorkerManager::add_workers(this,
! active_workers,
_total_workers,
_created_workers,
worker_type,
initializing);
_active_workers = MIN2(_created_workers, _active_workers);
*** 266,279 ****
void WorkGang::run_task(AbstractGangTask* task) {
run_task(task, active_workers());
}
void WorkGang::run_task(AbstractGangTask* task, uint num_workers) {
! guarantee(num_workers <= active_workers(),
! "Trying to execute task %s with %u workers which is more than the amount of active workers %u.",
! task->name(), num_workers, active_workers());
guarantee(num_workers > 0, "Trying to execute task %s with zero workers", task->name());
_dispatcher->coordinator_execute_on_workers(task, num_workers);
}
AbstractGangWorker::AbstractGangWorker(AbstractWorkGang* gang, uint id) {
_gang = gang;
--- 270,284 ----
void WorkGang::run_task(AbstractGangTask* task) {
run_task(task, active_workers());
}
void WorkGang::run_task(AbstractGangTask* task, uint num_workers) {
! guarantee(num_workers <= total_workers(),
! "Trying to execute task %s with %u workers which is more than the amount of total workers %u.",
! task->name(), num_workers, total_workers());
guarantee(num_workers > 0, "Trying to execute task %s with zero workers", task->name());
+ add_workers(num_workers, false);
_dispatcher->coordinator_execute_on_workers(task, num_workers);
}
AbstractGangWorker::AbstractGangWorker(AbstractWorkGang* gang, uint id) {
_gang = gang;
< prev index next >