8005875: G1: Kitchensink fails with ParallelGCThreads=0
Summary: Check that the concurrent marking worker gang exists in ConcurrentMark::print_worker_threads_on(). Changes were also reviewed by Vitaly Davidovich <vitalyd@gmail.com>.
Reviewed-by: brutisso
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Fri Feb 01 17:21:53 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Thu Jan 31 10:45:09 2013 -0800
@@ -1190,7 +1190,7 @@
uint active_workers = MAX2(1U, parallel_marking_threads());
CMRootRegionScanTask task(this);
- if (parallel_marking_threads() > 0) {
+ if (use_parallel_marking_threads()) {
_parallel_workers->set_active_workers((int) active_workers);
_parallel_workers->run_task(&task);
} else {
@@ -1226,7 +1226,7 @@
set_phase(active_workers, true /* concurrent */);
CMConcurrentMarkingTask markingTask(this, cmThread());
- if (parallel_marking_threads() > 0) {
+ if (use_parallel_marking_threads()) {
_parallel_workers->set_active_workers((int)active_workers);
// Don't set _n_par_threads because it affects MT in proceess_strong_roots()
// and the decisions on that MT processing is made elsewhere.
@@ -3242,7 +3242,9 @@
}
void ConcurrentMark::print_worker_threads_on(outputStream* st) const {
- _parallel_workers->print_worker_threads_on(st);
+ if (use_parallel_marking_threads()) {
+ _parallel_workers->print_worker_threads_on(st);
+ }
}
// We take a break if someone is trying to stop the world.
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp Fri Feb 01 17:21:53 2013 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp Thu Jan 31 10:45:09 2013 -0800
@@ -499,17 +499,26 @@
}
// accessor methods
- uint parallel_marking_threads() { return _parallel_marking_threads; }
- uint max_parallel_marking_threads() { return _max_parallel_marking_threads;}
- double sleep_factor() { return _sleep_factor; }
- double marking_task_overhead() { return _marking_task_overhead;}
- double cleanup_sleep_factor() { return _cleanup_sleep_factor; }
- double cleanup_task_overhead() { return _cleanup_task_overhead;}
+ uint parallel_marking_threads() const { return _parallel_marking_threads; }
+ uint max_parallel_marking_threads() const { return _max_parallel_marking_threads;}
+ double sleep_factor() { return _sleep_factor; }
+ double marking_task_overhead() { return _marking_task_overhead;}
+ double cleanup_sleep_factor() { return _cleanup_sleep_factor; }
+ double cleanup_task_overhead() { return _cleanup_task_overhead;}
- HeapWord* finger() { return _finger; }
- bool concurrent() { return _concurrent; }
- uint active_tasks() { return _active_tasks; }
- ParallelTaskTerminator* terminator() { return &_terminator; }
+ bool use_parallel_marking_threads() const {
+ assert(parallel_marking_threads() <=
+ max_parallel_marking_threads(), "sanity");
+ assert((_parallel_workers == NULL && parallel_marking_threads() == 0) ||
+ parallel_marking_threads() > 0,
+ "parallel workers not set up correctly");
+ return _parallel_workers != NULL;
+ }
+
+ HeapWord* finger() { return _finger; }
+ bool concurrent() { return _concurrent; }
+ uint active_tasks() { return _active_tasks; }
+ ParallelTaskTerminator* terminator() { return &_terminator; }
// It claims the next available region to be scanned by a marking
// task/thread. It might return NULL if the next region is empty or