changeset 8448:2752e41d4828

8080876: Replace unnecessary MAX2(ParallelGCThreads, 1) calls with ParallelGCThreads Reviewed-by: kbarrett, mgerdin
author stefank
date Fri, 22 May 2015 10:58:16 +0200
parents 5d337610d914
children 14932754dcd5 72b225f8872c
files src/share/vm/gc/cms/parNewGeneration.cpp src/share/vm/gc/g1/concurrentG1Refine.cpp src/share/vm/gc/g1/concurrentMark.cpp src/share/vm/gc/g1/g1CollectedHeap.cpp src/share/vm/gc/g1/g1OopClosures.cpp src/share/vm/gc/g1/g1StringDedupQueue.cpp src/share/vm/gc/g1/g1StringDedupTable.cpp src/share/vm/gc/parallel/psParallelCompact.cpp src/share/vm/gc/parallel/psScavenge.cpp src/share/vm/gc/shared/adaptiveSizePolicy.cpp src/share/vm/runtime/arguments.cpp
diffstat 11 files changed, 21 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/gc/cms/parNewGeneration.cpp	Fri May 22 10:58:04 2015 +0200
+++ b/src/share/vm/gc/cms/parNewGeneration.cpp	Fri May 22 10:58:16 2015 +0200
@@ -1475,9 +1475,9 @@
     _ref_processor =
       new ReferenceProcessor(_reserved,                  // span
                              ParallelRefProcEnabled && (ParallelGCThreads > 1), // mt processing
-                             (int) ParallelGCThreads,    // mt processing degree
+                             (uint) ParallelGCThreads,   // mt processing degree
                              refs_discovery_is_mt(),     // mt discovery
-                             (int) ParallelGCThreads,    // mt discovery degree
+                             (uint) ParallelGCThreads,   // mt discovery degree
                              refs_discovery_is_atomic(), // atomic_discovery
                              NULL);                      // is_alive_non_header
   }
--- a/src/share/vm/gc/g1/concurrentG1Refine.cpp	Fri May 22 10:58:04 2015 +0200
+++ b/src/share/vm/gc/g1/concurrentG1Refine.cpp	Fri May 22 10:58:16 2015 +0200
@@ -35,7 +35,7 @@
 {
   // Ergonomically select initial concurrent refinement parameters
   if (FLAG_IS_DEFAULT(G1ConcRefinementGreenZone)) {
-    FLAG_SET_DEFAULT(G1ConcRefinementGreenZone, MAX2<int>(ParallelGCThreads, 1));
+    FLAG_SET_DEFAULT(G1ConcRefinementGreenZone, (intx)ParallelGCThreads);
   }
   set_green_zone(G1ConcRefinementGreenZone);
 
--- a/src/share/vm/gc/g1/concurrentMark.cpp	Fri May 22 10:58:04 2015 +0200
+++ b/src/share/vm/gc/g1/concurrentMark.cpp	Fri May 22 10:58:16 2015 +0200
@@ -518,7 +518,7 @@
   _markStack(this),
   // _finger set in set_non_marking_state
 
-  _max_worker_id(MAX2((uint)ParallelGCThreads, 1U)),
+  _max_worker_id((uint)ParallelGCThreads),
   // _active_tasks set in set_non_marking_state
   // _tasks set inside the constructor
   _task_queues(new CMTaskQueueSet((int) _max_worker_id)),
--- a/src/share/vm/gc/g1/g1CollectedHeap.cpp	Fri May 22 10:58:04 2015 +0200
+++ b/src/share/vm/gc/g1/g1CollectedHeap.cpp	Fri May 22 10:58:16 2015 +0200
@@ -1752,7 +1752,7 @@
   _allocator = G1Allocator::create_allocator(this);
   _humongous_object_threshold_in_words = HeapRegion::GrainWords / 2;
 
-  int n_queues = MAX2((int)ParallelGCThreads, 1);
+  int n_queues = (int)ParallelGCThreads;
   _task_queues = new RefToScanQueueSet(n_queues);
 
   uint n_rem_sets = HeapRegionRemSet::num_par_rem_sets();
@@ -2064,11 +2064,11 @@
     new ReferenceProcessor(mr,    // span
                            ParallelRefProcEnabled && (ParallelGCThreads > 1),
                                 // mt processing
-                           (int) ParallelGCThreads,
+                           (uint) ParallelGCThreads,
                                 // degree of mt processing
                            (ParallelGCThreads > 1) || (ConcGCThreads > 1),
                                 // mt discovery
-                           (int) MAX2(ParallelGCThreads, ConcGCThreads),
+                           (uint) MAX2(ParallelGCThreads, ConcGCThreads),
                                 // degree of mt discovery
                            false,
                                 // Reference discovery is not atomic
@@ -2081,11 +2081,11 @@
     new ReferenceProcessor(mr,    // span
                            ParallelRefProcEnabled && (ParallelGCThreads > 1),
                                 // mt processing
-                           MAX2((int)ParallelGCThreads, 1),
+                           (uint) ParallelGCThreads,
                                 // degree of mt processing
                            (ParallelGCThreads > 1),
                                 // mt discovery
-                           MAX2((int)ParallelGCThreads, 1),
+                           (uint) ParallelGCThreads,
                                 // degree of mt discovery
                            true,
                                 // Reference discovery is atomic
@@ -2485,8 +2485,7 @@
   assert(_worker_cset_start_region != NULL, "sanity");
   assert(_worker_cset_start_region_time_stamp != NULL, "sanity");
 
-  int n_queues = MAX2((int)ParallelGCThreads, 1);
-  for (int i = 0; i < n_queues; i++) {
+  for (uint i = 0; i < ParallelGCThreads; i++) {
     _worker_cset_start_region[i] = NULL;
     _worker_cset_start_region_time_stamp[i] = 0;
   }
@@ -3844,8 +3843,7 @@
 
         if (evacuation_failed()) {
           _allocator->set_used(recalculate_used());
-          uint n_queues = MAX2((int)ParallelGCThreads, 1);
-          for (uint i = 0; i < n_queues; i++) {
+          for (uint i = 0; i < ParallelGCThreads; i++) {
             if (_evacuation_failed_info_array[i].has_failed()) {
               _gc_tracer_stw->report_evacuation_failed(_evacuation_failed_info_array[i]);
             }
--- a/src/share/vm/gc/g1/g1OopClosures.cpp	Fri May 22 10:58:04 2015 +0200
+++ b/src/share/vm/gc/g1/g1OopClosures.cpp	Fri May 22 10:58:16 2015 +0200
@@ -50,8 +50,8 @@
   _par_scan_state = par_scan_state;
   _worker_id = par_scan_state->queue_num();
 
-  assert(_worker_id < MAX2((uint)ParallelGCThreads, 1u),
-         err_msg("The given worker id %u must be less than the number of threads %u", _worker_id, MAX2((uint)ParallelGCThreads, 1u)));
+  assert(_worker_id < ParallelGCThreads,
+         err_msg("The given worker id %u must be less than the number of threads " UINTX_FORMAT, _worker_id, ParallelGCThreads));
 }
 
 // Generate G1 specialized oop_oop_iterate functions.
--- a/src/share/vm/gc/g1/g1StringDedupQueue.cpp	Fri May 22 10:58:04 2015 +0200
+++ b/src/share/vm/gc/g1/g1StringDedupQueue.cpp	Fri May 22 10:58:16 2015 +0200
@@ -42,7 +42,7 @@
   _cancel(false),
   _empty(true),
   _dropped(0) {
-  _nqueues = MAX2(ParallelGCThreads, (size_t)1);
+  _nqueues = ParallelGCThreads;
   _queues = NEW_C_HEAP_ARRAY(G1StringDedupWorkerQueue, _nqueues, mtGC);
   for (size_t i = 0; i < _nqueues; i++) {
     new (_queues + i) G1StringDedupWorkerQueue(G1StringDedupWorkerQueue::default_segment_size(), _max_cache_size, _max_size);
--- a/src/share/vm/gc/g1/g1StringDedupTable.cpp	Fri May 22 10:58:04 2015 +0200
+++ b/src/share/vm/gc/g1/g1StringDedupTable.cpp	Fri May 22 10:58:16 2015 +0200
@@ -112,7 +112,7 @@
 };
 
 G1StringDedupEntryCache::G1StringDedupEntryCache() {
-  _nlists = MAX2(ParallelGCThreads, (size_t)1);
+  _nlists = ParallelGCThreads;
   _lists = PaddedArray<G1StringDedupEntryFreeList, mtGC>::create_unfreeable((uint)_nlists);
 }
 
--- a/src/share/vm/gc/parallel/psParallelCompact.cpp	Fri May 22 10:58:04 2015 +0200
+++ b/src/share/vm/gc/parallel/psParallelCompact.cpp	Fri May 22 10:58:16 2015 +0200
@@ -832,9 +832,9 @@
   _ref_processor =
     new ReferenceProcessor(mr,            // span
                            ParallelRefProcEnabled && (ParallelGCThreads > 1), // mt processing
-                           (int) ParallelGCThreads, // mt processing degree
+                           (uint) ParallelGCThreads, // mt processing degree
                            true,          // mt discovery
-                           (int) ParallelGCThreads, // mt discovery degree
+                           (uint) ParallelGCThreads, // mt discovery degree
                            true,          // atomic_discovery
                            &_is_alive_closure); // non-header is alive closure
   _counters = new CollectorCounters("PSParallelCompact", 1);
--- a/src/share/vm/gc/parallel/psScavenge.cpp	Fri May 22 10:58:04 2015 +0200
+++ b/src/share/vm/gc/parallel/psScavenge.cpp	Fri May 22 10:58:16 2015 +0200
@@ -845,9 +845,9 @@
   _ref_processor =
     new ReferenceProcessor(mr,                         // span
                            ParallelRefProcEnabled && (ParallelGCThreads > 1), // mt processing
-                           (int) ParallelGCThreads,    // mt processing degree
+                           (uint) ParallelGCThreads,   // mt processing degree
                            true,                       // mt discovery
-                           (int) ParallelGCThreads,    // mt discovery degree
+                           (uint) ParallelGCThreads,   // mt discovery degree
                            true,                       // atomic_discovery
                            NULL);                      // header provides liveness info
 
--- a/src/share/vm/gc/shared/adaptiveSizePolicy.cpp	Fri May 22 10:58:04 2015 +0200
+++ b/src/share/vm/gc/shared/adaptiveSizePolicy.cpp	Fri May 22 10:58:16 2015 +0200
@@ -161,7 +161,7 @@
       }
       _debug_perturbation = !_debug_perturbation;
     }
-    assert((new_active_workers <= (uintx) ParallelGCThreads) &&
+    assert((new_active_workers <= ParallelGCThreads) &&
            (new_active_workers >= min_workers),
       "Jiggled active workers too much");
   }
--- a/src/share/vm/runtime/arguments.cpp	Fri May 22 10:58:04 2015 +0200
+++ b/src/share/vm/runtime/arguments.cpp	Fri May 22 10:58:16 2015 +0200
@@ -1278,10 +1278,8 @@
 
   // Preferred young gen size for "short" pauses:
   // upper bound depends on # of threads and NewRatio.
-  const uintx parallel_gc_threads =
-    (ParallelGCThreads == 0 ? 1 : ParallelGCThreads);
   const size_t preferred_max_new_size_unaligned =
-    MIN2(max_heap/(NewRatio+1), ScaleForWordSize(young_gen_per_worker * parallel_gc_threads));
+    MIN2(max_heap/(NewRatio+1), ScaleForWordSize(young_gen_per_worker * ParallelGCThreads));
   size_t preferred_max_new_size =
     align_size_up(preferred_max_new_size_unaligned, os::vm_page_size());