8157620: Guarantee in run_task(task, num_workers) fails
Reviewed-by: tschatzl, drwhite
This commit is contained in:
parent
d019f34077
commit
c3d0e73480
@ -60,6 +60,10 @@ AbstractGangWorker* AbstractWorkGang::install_worker(uint worker_id) {
|
||||
}
|
||||
|
||||
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()) {
|
||||
@ -69,7 +73,7 @@ void AbstractWorkGang::add_workers(bool initializing) {
|
||||
}
|
||||
|
||||
_created_workers = WorkerManager::add_workers(this,
|
||||
_active_workers,
|
||||
active_workers,
|
||||
_total_workers,
|
||||
_created_workers,
|
||||
worker_type,
|
||||
@ -268,10 +272,11 @@ void WorkGang::run_task(AbstractGangTask* task) {
|
||||
}
|
||||
|
||||
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 <= 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);
|
||||
}
|
||||
|
||||
|
@ -170,6 +170,9 @@ class AbstractWorkGang : public CHeapObj<mtInternal> {
|
||||
// Add GC workers as needed.
|
||||
void add_workers(bool initializing);
|
||||
|
||||
// Add GC workers as needed to reach the specified number of workers.
|
||||
void add_workers(uint active_workers, bool initializing);
|
||||
|
||||
// Return the Ith worker.
|
||||
AbstractGangWorker* worker(uint i) const;
|
||||
|
||||
@ -214,7 +217,8 @@ public:
|
||||
virtual void run_task(AbstractGangTask* task);
|
||||
// Run a task with the given number of workers, returns
|
||||
// when the task is done. The number of workers must be at most the number of
|
||||
// active workers.
|
||||
// active workers. Additional workers may be created if an insufficient
|
||||
// number currently exists.
|
||||
void run_task(AbstractGangTask* task, uint num_workers);
|
||||
|
||||
protected:
|
||||
|
@ -32,6 +32,7 @@
|
||||
* @run main/othervm -Xmx384M -XX:+UseParallelGC -XX:-UseParallelOldGC TestGCOld 50 1 20 10 10000
|
||||
* @run main/othervm -Xmx384M -XX:+UseConcMarkSweepGC TestGCOld 50 1 20 10 10000
|
||||
* @run main/othervm -Xmx384M -XX:+UseG1GC TestGCOld 50 1 20 10 10000
|
||||
* @run main/othervm -Xms64m -Xmx128m -XX:+UseG1GC -XX:+UseDynamicNumberOfGCThreads -Xlog:gc,gc+task=trace TestGCOld 50 5 20 1 5000
|
||||
*/
|
||||
|
||||
import java.text.*;
|
||||
|
Loading…
x
Reference in New Issue
Block a user