--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp Fri May 22 10:57:53 2015 +0200
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp Fri May 22 10:58:04 2015 +0200
@@ -5072,14 +5072,9 @@
FlexibleWorkGang* workers = gch->workers();
assert(workers != NULL, "Need parallel worker threads.");
// Choose to use the number of GC workers most recently set
- // into "active_workers". If active_workers is not set, set it
- // to ParallelGCThreads.
+ // into "active_workers".
uint n_workers = workers->active_workers();
- if (n_workers == 0) {
- assert(n_workers > 0, "Should have been set during scavenge");
- n_workers = ParallelGCThreads;
- workers->set_active_workers(n_workers);
- }
+
CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace();
StrongRootsScope srs(n_workers);
--- a/hotspot/src/share/vm/gc/g1/concurrentMark.cpp Fri May 22 10:57:53 2015 +0200
+++ b/hotspot/src/share/vm/gc/g1/concurrentMark.cpp Fri May 22 10:58:04 2015 +0200
@@ -1218,15 +1218,13 @@
"Maximum number of marking threads exceeded");
uint active_workers = MAX2(1U, parallel_marking_threads());
+ assert(active_workers > 0, "Should have been set");
// Parallel task terminator is set in "set_concurrency_and_phase()"
set_concurrency_and_phase(active_workers, true /* concurrent */);
CMConcurrentMarkingTask markingTask(this, cmThread());
_parallel_workers->set_active_workers(active_workers);
- // Don't set _n_par_threads because it affects MT in process_roots()
- // and the decisions on that MT processing is made elsewhere.
- assert(_parallel_workers->active_workers() > 0, "Should have been set");
_parallel_workers->run_task(&markingTask);
print_stats();
}
@@ -2593,11 +2591,6 @@
// this is remark, so we'll use up all active threads
uint active_workers = g1h->workers()->active_workers();
- if (active_workers == 0) {
- assert(active_workers > 0, "Should have been set earlier");
- active_workers = (uint) ParallelGCThreads;
- g1h->workers()->set_active_workers(active_workers);
- }
set_concurrency_and_phase(active_workers, false /* concurrent */);
// Leave _parallel_marking_threads at it's
// value originally calculated in the ConcurrentMark
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp Fri May 22 10:57:53 2015 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp Fri May 22 10:58:04 2015 +0200
@@ -1326,15 +1326,9 @@
AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
workers()->active_workers(),
Threads::number_of_non_daemon_threads());
- assert(UseDynamicNumberOfGCThreads ||
- n_workers == workers()->total_workers(),
- "If not dynamic should be using all the workers");
workers()->set_active_workers(n_workers);
ParRebuildRSTask rebuild_rs_task(this);
- assert(UseDynamicNumberOfGCThreads ||
- workers()->active_workers() == workers()->total_workers(),
- "Unless dynamic should use total workers");
workers()->run_task(&rebuild_rs_task);
// Rebuild the strong code root lists for each region
@@ -2530,9 +2524,6 @@
result = g1_policy()->collection_set();
uint cs_size = g1_policy()->cset_region_length();
uint active_workers = workers()->active_workers();
- assert(UseDynamicNumberOfGCThreads ||
- active_workers == workers()->total_workers(),
- "Unless dynamic should use total workers");
uint end_ind = (cs_size * worker_i) / active_workers;
uint start_ind = 0;
@@ -3031,9 +3022,6 @@
if (GCParallelVerificationEnabled && ParallelGCThreads > 1) {
G1ParVerifyTask task(this, vo);
- assert(UseDynamicNumberOfGCThreads ||
- workers()->active_workers() == workers()->total_workers(),
- "If not dynamic should be using all the workers");
workers()->run_task(&task);
if (task.failures()) {
failures = true;
@@ -3682,9 +3670,6 @@
uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
workers()->active_workers(),
Threads::number_of_non_daemon_threads());
- assert(UseDynamicNumberOfGCThreads ||
- active_workers == workers()->total_workers(),
- "If not dynamic should be using all the workers");
workers()->set_active_workers(active_workers);
double pause_start_sec = os::elapsedTime();
@@ -5189,7 +5174,7 @@
};
// Weak Reference processing during an evacuation pause (part 1).
-void G1CollectedHeap::process_discovered_references(uint no_of_gc_workers) {
+void G1CollectedHeap::process_discovered_references() {
double ref_proc_start = os::elapsedTime();
ReferenceProcessor* rp = _ref_processor_stw;
@@ -5216,7 +5201,7 @@
// referents points to another object which is also referenced by an
// object discovered by the STW ref processor.
- assert(no_of_gc_workers == workers()->active_workers(), "Need to reset active GC workers");
+ uint no_of_gc_workers = workers()->active_workers();
G1ParPreserveCMReferentsTask keep_cm_referents(this,
no_of_gc_workers,
@@ -5297,7 +5282,7 @@
}
// Weak Reference processing during an evacuation pause (part 2).
-void G1CollectedHeap::enqueue_discovered_references(uint no_of_gc_workers) {
+void G1CollectedHeap::enqueue_discovered_references() {
double ref_enq_start = os::elapsedTime();
ReferenceProcessor* rp = _ref_processor_stw;
@@ -5311,12 +5296,12 @@
} else {
// Parallel reference enqueueing
- assert(no_of_gc_workers == workers()->active_workers(),
- "Need to reset active workers");
- assert(rp->num_q() == no_of_gc_workers, "sanity");
- assert(no_of_gc_workers <= rp->max_num_q(), "sanity");
-
- G1STWRefProcTaskExecutor par_task_executor(this, workers(), _task_queues, no_of_gc_workers);
+ uint n_workers = workers()->active_workers();
+
+ assert(rp->num_q() == n_workers, "sanity");
+ assert(n_workers <= rp->max_num_q(), "sanity");
+
+ G1STWRefProcTaskExecutor par_task_executor(this, workers(), _task_queues, n_workers);
rp->enqueue_discovered_references(&par_task_executor);
}
@@ -5347,9 +5332,6 @@
hot_card_cache->set_use_cache(false);
const uint n_workers = workers()->active_workers();
- assert(UseDynamicNumberOfGCThreads ||
- n_workers == workers()->total_workers(),
- "If not dynamic should be using all the workers");
init_for_evac_failure(NULL);
@@ -5365,12 +5347,9 @@
ClassLoaderDataGraph::clear_claimed_marks();
}
- // The individual threads will set their evac-failure closures.
- if (PrintTerminationStats) G1ParScanThreadState::print_termination_stats_hdr();
- // These tasks use ShareHeap::_process_strong_tasks
- assert(UseDynamicNumberOfGCThreads ||
- workers()->active_workers() == workers()->total_workers(),
- "If not dynamic should be using all the workers");
+ // The individual threads will set their evac-failure closures.
+ if (PrintTerminationStats) G1ParScanThreadState::print_termination_stats_hdr();
+
workers()->run_task(&g1_par_task);
end_par_time_sec = os::elapsedTime();
@@ -5395,7 +5374,7 @@
// as we may have to copy some 'reachable' referent
// objects (and their reachable sub-graphs) that were
// not copied during the pause.
- process_discovered_references(n_workers);
+ process_discovered_references();
if (G1StringDedup::is_enabled()) {
double fixup_start = os::elapsedTime();
@@ -5437,7 +5416,7 @@
// will log these updates (and dirty their associated
// cards). We need these updates logged to update any
// RSets.
- enqueue_discovered_references(n_workers);
+ enqueue_discovered_references();
redirty_logged_cards();
COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp Fri May 22 10:57:53 2015 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.hpp Fri May 22 10:58:04 2015 +0200
@@ -606,11 +606,11 @@
// Process any reference objects discovered during
// an incremental evacuation pause.
- void process_discovered_references(uint no_of_gc_workers);
+ void process_discovered_references();
// Enqueue any remaining discovered references
// after processing.
- void enqueue_discovered_references(uint no_of_gc_workers);
+ void enqueue_discovered_references();
public:
FlexibleWorkGang* workers() const { return _workers; }
--- a/hotspot/src/share/vm/gc/shared/workgroup.hpp Fri May 22 10:57:53 2015 +0200
+++ b/hotspot/src/share/vm/gc/shared/workgroup.hpp Fri May 22 10:58:04 2015 +0200
@@ -322,7 +322,13 @@
_active_workers(UseDynamicNumberOfGCThreads ? 1U : workers) {}
// Accessors for fields.
- virtual uint active_workers() const { return _active_workers; }
+ virtual uint active_workers() const {
+ assert(_active_workers <= _total_workers,
+ err_msg("_active_workers: %u > _total_workers: %u", _active_workers, _total_workers));
+ assert(UseDynamicNumberOfGCThreads || _active_workers == _total_workers,
+ "Unless dynamic should use total workers");
+ return _active_workers;
+ }
void set_active_workers(uint v) {
assert(v <= _total_workers,
"Trying to set more workers active than there are");