diff -r 37f75ba502b1 -r 289339903fcf hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Oct 03 20:31:41 2012 +0200 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Oct 04 10:04:13 2012 -0700 @@ -4151,7 +4151,7 @@ } } -void G1CollectedHeap::release_gc_alloc_regions() { +void G1CollectedHeap::release_gc_alloc_regions(uint no_of_gc_workers) { _survivor_gc_alloc_region.release(); // If we have an old GC alloc region to release, we'll save it in // _retained_old_gc_alloc_region. If we don't @@ -4161,8 +4161,8 @@ _retained_old_gc_alloc_region = _old_gc_alloc_region.release(); if (ResizePLAB) { - _survivor_plab_stats.adjust_desired_plab_sz(); - _old_plab_stats.adjust_desired_plab_sz(); + _survivor_plab_stats.adjust_desired_plab_sz(no_of_gc_workers); + _old_plab_stats.adjust_desired_plab_sz(no_of_gc_workers); } } @@ -5427,7 +5427,7 @@ }; // Weak Reference processing during an evacuation pause (part 1). -void G1CollectedHeap::process_discovered_references() { +void G1CollectedHeap::process_discovered_references(uint no_of_gc_workers) { double ref_proc_start = os::elapsedTime(); ReferenceProcessor* rp = _ref_processor_stw; @@ -5454,15 +5454,14 @@ // referents points to another object which is also referenced by an // object discovered by the STW ref processor. - uint active_workers = (G1CollectedHeap::use_parallel_gc_threads() ? - workers()->active_workers() : 1); - assert(!G1CollectedHeap::use_parallel_gc_threads() || - active_workers == workers()->active_workers(), - "Need to reset active_workers"); - - set_par_threads(active_workers); - G1ParPreserveCMReferentsTask keep_cm_referents(this, active_workers, _task_queues); + no_of_gc_workers == workers()->active_workers(), + "Need to reset active GC workers"); + + set_par_threads(no_of_gc_workers); + G1ParPreserveCMReferentsTask keep_cm_referents(this, + no_of_gc_workers, + _task_queues); if (G1CollectedHeap::use_parallel_gc_threads()) { workers()->run_task(&keep_cm_referents); @@ -5528,10 +5527,10 @@ NULL); } else { // Parallel reference processing - assert(rp->num_q() == active_workers, "sanity"); - assert(active_workers <= rp->max_num_q(), "sanity"); - - G1STWRefProcTaskExecutor par_task_executor(this, workers(), _task_queues, 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); rp->process_discovered_references(&is_alive, &keep_alive, &drain_queue, &par_task_executor); } @@ -5546,7 +5545,7 @@ } // Weak Reference processing during an evacuation pause (part 2). -void G1CollectedHeap::enqueue_discovered_references() { +void G1CollectedHeap::enqueue_discovered_references(uint no_of_gc_workers) { double ref_enq_start = os::elapsedTime(); ReferenceProcessor* rp = _ref_processor_stw; @@ -5560,13 +5559,12 @@ } else { // Parallel reference enqueuing - uint active_workers = (ParallelGCThreads > 0 ? workers()->active_workers() : 1); - assert(active_workers == workers()->active_workers(), - "Need to reset active_workers"); - assert(rp->num_q() == active_workers, "sanity"); - assert(active_workers <= rp->max_num_q(), "sanity"); - - G1STWRefProcTaskExecutor par_task_executor(this, workers(), _task_queues, active_workers); + 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); rp->enqueue_discovered_references(&par_task_executor); } @@ -5658,7 +5656,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(); + process_discovered_references(n_workers); // Weak root processing. // Note: when JSR 292 is enabled and code blobs can contain @@ -5670,7 +5668,7 @@ JNIHandles::weak_oops_do(&is_alive, &keep_alive); } - release_gc_alloc_regions(); + release_gc_alloc_regions(n_workers); g1_rem_set()->cleanup_after_oops_into_collection_set_do(); concurrent_g1_refine()->clear_hot_cache(); @@ -5694,7 +5692,7 @@ // will log these updates (and dirty their associated // cards). We need these updates logged to update any // RSets. - enqueue_discovered_references(); + enqueue_discovered_references(n_workers); if (G1DeferredRSUpdate) { RedirtyLoggedCardTableEntryFastClosure redirty;