Blame SOURCES/jdk8203030-zero_s390_31_bit_size_t_type_conflicts_in_shared_code.patch

3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
045ef6
@@ -2659,7 +2659,7 @@
045ef6
   if (ResizeOldPLAB && CMSOldPLABResizeQuicker) {
045ef6
     size_t multiple = _num_blocks[word_sz]/(CMSOldPLABToleranceFactor*CMSOldPLABNumRefills*n_blks);
045ef6
     n_blks +=  CMSOldPLABReactivityFactor*multiple*n_blks;
045ef6
-    n_blks = MIN2(n_blks, CMSOldPLABMax);
045ef6
+    n_blks = MIN2(n_blks, (size_t)CMSOldPLABMax);
045ef6
   }
045ef6
   assert(n_blks > 0, "Error");
045ef6
   _cfls->par_get_chunk_of_blocks(word_sz, n_blks, fl);
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
045ef6
@@ -957,7 +957,7 @@
045ef6
   if (free_percentage < desired_free_percentage) {
045ef6
     size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
045ef6
     assert(desired_capacity >= capacity(), "invalid expansion size");
045ef6
-    size_t expand_bytes = MAX2(desired_capacity - capacity(), MinHeapDeltaBytes);
045ef6
+    size_t expand_bytes = MAX2(desired_capacity - capacity(), (size_t)MinHeapDeltaBytes);
045ef6
     if (PrintGCDetails && Verbose) {
045ef6
       size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
045ef6
       gclog_or_tty->print_cr("\nFrom compute_new_size: ");
045ef6
@@ -6577,7 +6577,7 @@
045ef6
     HeapWord* curAddr = _markBitMap.startWord();
045ef6
     while (curAddr < _markBitMap.endWord()) {
045ef6
       size_t remaining  = pointer_delta(_markBitMap.endWord(), curAddr);
045ef6
-      MemRegion chunk(curAddr, MIN2(CMSBitMapYieldQuantum, remaining));
045ef6
+      MemRegion chunk(curAddr, MIN2((size_t)CMSBitMapYieldQuantum, remaining));
045ef6
       _markBitMap.clear_large_range(chunk);
045ef6
       if (ConcurrentMarkSweepThread::should_yield() &&
045ef6
           !foregroundGCIsActive() &&
045ef6
@@ -6875,7 +6875,7 @@
045ef6
     return;
045ef6
   }
045ef6
   // Double capacity if possible
045ef6
-  size_t new_capacity = MIN2(_capacity*2, MarkStackSizeMax);
045ef6
+  size_t new_capacity = MIN2(_capacity*2, (size_t)MarkStackSizeMax);
045ef6
   // Do not give up existing stack until we have managed to
045ef6
   // get the double capacity that we desired.
045ef6
   ReservedSpace rs(ReservedSpace::allocation_align_size_up(
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
3dea0a
@@ -3902,7 +3902,7 @@
045ef6
   // of things to do) or totally (at the very end).
045ef6
   size_t target_size;
045ef6
   if (partially) {
045ef6
-    target_size = MIN2((size_t)_task_queue->max_elems()/3, GCDrainStackTargetSize);
045ef6
+    target_size = MIN2((size_t)(_task_queue->max_elems()/3), (size_t) GCDrainStackTargetSize);
045ef6
   } else {
045ef6
     target_size = 0;
045ef6
   }
3dea0a
@@ -4706,7 +4706,7 @@
045ef6
   // The > 0 check is to deal with the prev and next live bytes which
045ef6
   // could be 0.
045ef6
   if (*hum_bytes > 0) {
045ef6
-    bytes = MIN2(HeapRegion::GrainBytes, *hum_bytes);
045ef6
+    bytes = MIN2(HeapRegion::GrainBytes, (size_t)*hum_bytes);
045ef6
     *hum_bytes -= bytes;
045ef6
   }
045ef6
   return bytes;
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
3dea0a
@@ -1729,7 +1729,7 @@
045ef6
 
045ef6
   verify_region_sets_optional();
045ef6
 
045ef6
-  size_t expand_bytes = MAX2(word_size * HeapWordSize, MinHeapDeltaBytes);
045ef6
+  size_t expand_bytes = MAX2(word_size * HeapWordSize, (size_t)MinHeapDeltaBytes);
045ef6
   ergo_verbose1(ErgoHeapSizing,
045ef6
                 "attempt heap expansion",
045ef6
                 ergo_format_reason("allocation request failed")
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.cpp
045ef6
@@ -117,7 +117,7 @@
045ef6
   return reserved_size() - committed_size();
045ef6
 }
045ef6
 
045ef6
-size_t G1PageBasedVirtualSpace::addr_to_page_index(char* addr) const {
045ef6
+uintptr_t G1PageBasedVirtualSpace::addr_to_page_index(char* addr) const {
045ef6
   return (addr - _low_boundary) / _page_size;
045ef6
 }
045ef6
 
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp
045ef6
@@ -38,7 +38,7 @@
045ef6
   _cancel(false),
045ef6
   _empty(true),
045ef6
   _dropped(0) {
045ef6
-  _nqueues = MAX2(ParallelGCThreads, (size_t)1);
045ef6
+  _nqueues = MAX2(ParallelGCThreads, (uintx)1);
045ef6
   _queues = NEW_C_HEAP_ARRAY(G1StringDedupWorkerQueue, _nqueues, mtGC);
045ef6
   for (size_t i = 0; i < _nqueues; i++) {
045ef6
     new (_queues + i) G1StringDedupWorkerQueue(G1StringDedupWorkerQueue::default_segment_size(), _max_cache_size, _max_size);
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
045ef6
@@ -120,7 +120,7 @@
045ef6
 };
045ef6
 
045ef6
 G1StringDedupEntryCache::G1StringDedupEntryCache(size_t max_size) :
045ef6
-  _nlists(MAX2(ParallelGCThreads, (size_t)1)),
045ef6
+  _nlists(MAX2(ParallelGCThreads, (uintx)1)),
045ef6
   _max_list_length(0),
045ef6
   _cached(PaddedArray<G1StringDedupEntryList, mtGC>::create_unfreeable((uint)_nlists)),
045ef6
   _overflowed(PaddedArray<G1StringDedupEntryList, mtGC>::create_unfreeable((uint)_nlists)) {
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
045ef6
@@ -109,7 +109,7 @@
045ef6
   if (FLAG_IS_DEFAULT(G1HeapRegionSize)) {
045ef6
     size_t average_heap_size = (initial_heap_size + max_heap_size) / 2;
045ef6
     region_size = MAX2(average_heap_size / HeapRegionBounds::target_number(),
045ef6
-                       (uintx) HeapRegionBounds::min_size());
045ef6
+                       HeapRegionBounds::min_size());
045ef6
   }
045ef6
 
045ef6
   int region_size_log = log2_long((jlong) region_size);
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp openjdk/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
045ef6
@@ -194,7 +194,7 @@
045ef6
   const size_t num_overflow_elems = of_stack->size();
045ef6
   const size_t space_available = queue->max_elems() - queue->size();
045ef6
   const size_t num_take_elems = MIN3(space_available / 4,
045ef6
-                                     ParGCDesiredObjsFromOverflowList,
045ef6
+                                     (size_t)ParGCDesiredObjsFromOverflowList,
045ef6
                                      num_overflow_elems);
045ef6
   // Transfer the most recent num_take_elems from the overflow
045ef6
   // stack to our work queue.
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
045ef6
@@ -910,8 +910,8 @@
045ef6
 void PSParallelCompact::initialize_dead_wood_limiter()
045ef6
 {
045ef6
   const size_t max = 100;
045ef6
-  _dwl_mean = double(MIN2(ParallelOldDeadWoodLimiterMean, max)) / 100.0;
045ef6
-  _dwl_std_dev = double(MIN2(ParallelOldDeadWoodLimiterStdDev, max)) / 100.0;
045ef6
+  _dwl_mean = double(MIN2((size_t)ParallelOldDeadWoodLimiterMean, max)) / 100.0;
045ef6
+  _dwl_std_dev = double(MIN2((size_t)ParallelOldDeadWoodLimiterStdDev, max)) / 100.0;
045ef6
   _dwl_first_term = 1.0 / (sqrt(2.0 * M_PI) * _dwl_std_dev);
045ef6
   DEBUG_ONLY(_dwl_initialized = true;)
045ef6
   _dwl_adjustment = normal_distribution(1.0);
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/memory/collectorPolicy.cpp openjdk/hotspot/src/share/vm/memory/collectorPolicy.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/memory/collectorPolicy.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/memory/collectorPolicy.cpp
045ef6
@@ -385,7 +385,7 @@
045ef6
       uintx calculated_size = NewSize + OldSize;
045ef6
       double shrink_factor = (double) MaxHeapSize / calculated_size;
045ef6
       uintx smaller_new_size = align_size_down((uintx)(NewSize * shrink_factor), _gen_alignment);
045ef6
-      FLAG_SET_ERGO(uintx, NewSize, MAX2(young_gen_size_lower_bound(), smaller_new_size));
045ef6
+      FLAG_SET_ERGO(uintx, NewSize, MAX2(young_gen_size_lower_bound(), (size_t)smaller_new_size));
045ef6
       _initial_gen0_size = NewSize;
045ef6
 
045ef6
       // OldSize is already aligned because above we aligned MaxHeapSize to
045ef6
@@ -433,7 +433,7 @@
045ef6
     // yield a size that is too small) and bound it by MaxNewSize above.
045ef6
     // Ergonomics plays here by previously calculating the desired
045ef6
     // NewSize and MaxNewSize.
045ef6
-    max_new_size = MIN2(MAX2(max_new_size, NewSize), MaxNewSize);
045ef6
+    max_new_size = MIN2(MAX2(max_new_size, (size_t)NewSize), (size_t)MaxNewSize);
045ef6
   }
045ef6
   assert(max_new_size > 0, "All paths should set max_new_size");
045ef6
 
045ef6
@@ -455,24 +455,23 @@
045ef6
       // lower limit.
045ef6
       _min_gen0_size = NewSize;
045ef6
       desired_new_size = NewSize;
045ef6
-      max_new_size = MAX2(max_new_size, NewSize);
045ef6
+      max_new_size = MAX2(max_new_size, (size_t)NewSize);
045ef6
     } else if (FLAG_IS_ERGO(NewSize)) {
045ef6
       // If NewSize is set ergonomically, we should use it as a lower
045ef6
       // limit, but use NewRatio to calculate the initial size.
045ef6
       _min_gen0_size = NewSize;
045ef6
       desired_new_size =
045ef6
-        MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize);
045ef6
-      max_new_size = MAX2(max_new_size, NewSize);
045ef6
+        MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), (size_t)NewSize);
045ef6
+      max_new_size = MAX2(max_new_size, (size_t)NewSize);
045ef6
     } else {
045ef6
       // For the case where NewSize is the default, use NewRatio
045ef6
       // to size the minimum and initial generation sizes.
045ef6
       // Use the default NewSize as the floor for these values.  If
045ef6
       // NewRatio is overly large, the resulting sizes can be too
045ef6
       // small.
045ef6
-      _min_gen0_size = MAX2(scale_by_NewRatio_aligned(_min_heap_byte_size), NewSize);
045ef6
+      _min_gen0_size = MAX2(scale_by_NewRatio_aligned(_min_heap_byte_size), (size_t)NewSize);
045ef6
       desired_new_size =
045ef6
-        MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize);
045ef6
-    }
045ef6
+        MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), (size_t)NewSize);    }
045ef6
 
045ef6
     assert(_min_gen0_size > 0, "Sanity check");
045ef6
     _initial_gen0_size = desired_new_size;
045ef6
@@ -573,7 +572,7 @@
045ef6
   } else {
045ef6
     // It's been explicitly set on the command line.  Use the
045ef6
     // OldSize and then determine the consequences.
045ef6
-    _min_gen1_size = MIN2(OldSize, _min_heap_byte_size - _min_gen0_size);
045ef6
+    _min_gen1_size = MIN2((size_t)OldSize, _min_heap_byte_size - _min_gen0_size);
045ef6
     _initial_gen1_size = OldSize;
045ef6
 
045ef6
     // If the user has explicitly set an OldSize that is inconsistent
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/memory/metaspace.cpp openjdk/hotspot/src/share/vm/memory/metaspace.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/memory/metaspace.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/memory/metaspace.cpp
3dea0a
@@ -1482,7 +1482,7 @@
045ef6
 
045ef6
 void MetaspaceGC::post_initialize() {
045ef6
   // Reset the high-water mark once the VM initialization is done.
045ef6
-  _capacity_until_GC = MAX2(MetaspaceAux::committed_bytes(), MetaspaceSize);
045ef6
+  _capacity_until_GC = MAX2(MetaspaceAux::committed_bytes(), (size_t)MetaspaceSize);
045ef6
 }
045ef6
 
045ef6
 bool MetaspaceGC::can_expand(size_t word_size, bool is_class) {
3dea0a
@@ -1542,7 +1542,7 @@
3dea0a
     (size_t)MIN2(min_tmp, double(MaxMetaspaceSize));
045ef6
   // Don't shrink less than the initial generation size
045ef6
   minimum_desired_capacity = MAX2(minimum_desired_capacity,
045ef6
-                                  MetaspaceSize);
045ef6
+                                  (size_t)MetaspaceSize);
045ef6
 
045ef6
   if (PrintGCDetails && Verbose) {
045ef6
     gclog_or_tty->print_cr("\nMetaspaceGC::compute_new_size: ");
3dea0a
@@ -1600,7 +1600,7 @@
045ef6
     const double max_tmp = used_after_gc / minimum_used_percentage;
3dea0a
     size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(MaxMetaspaceSize));
045ef6
     maximum_desired_capacity = MAX2(maximum_desired_capacity,
045ef6
-                                    MetaspaceSize);
045ef6
+                                    (size_t)MetaspaceSize);
045ef6
     if (PrintGCDetails && Verbose) {
045ef6
       gclog_or_tty->print_cr("  "
045ef6
                              "  maximum_free_percentage: %6.2f"
3dea0a
@@ -3361,7 +3361,7 @@
045ef6
     // on the medium chunk list.   The next chunk will be small and progress
045ef6
     // from there.  This size calculated by -version.
045ef6
     _first_class_chunk_word_size = MIN2((size_t)MediumChunk*6,
045ef6
-                                       (CompressedClassSpaceSize/BytesPerWord)*2);
045ef6
+                                       (size_t)(CompressedClassSpaceSize/BytesPerWord)*2);
045ef6
     _first_class_chunk_word_size = align_word_size_up(_first_class_chunk_word_size);
045ef6
     // Arbitrarily set the initial virtual space to a multiple
045ef6
     // of the boot class loader size.
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp openjdk/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/memory/threadLocalAllocBuffer.cpp
3dea0a
@@ -250,13 +250,13 @@
045ef6
   size_t init_sz = 0;
045ef6
 
045ef6
   if (TLABSize > 0) {
045ef6
-    init_sz = TLABSize / HeapWordSize;
045ef6
+    init_sz = (size_t)(TLABSize / HeapWordSize);
045ef6
   } else if (global_stats() != NULL) {
045ef6
     // Initial size is a function of the average number of allocating threads.
045ef6
     unsigned nof_threads = global_stats()->allocating_threads_avg();
045ef6
 
045ef6
-    init_sz  = (Universe::heap()->tlab_capacity(myThread()) / HeapWordSize) /
045ef6
-                      (nof_threads * target_refills());
045ef6
+    init_sz  = (size_t)((Universe::heap()->tlab_capacity(myThread()) / HeapWordSize) /
045ef6
+                      (nof_threads * target_refills()));
045ef6
     init_sz = align_object_size(init_sz);
045ef6
   }
045ef6
   init_sz = MIN2(MAX2(init_sz, min_size()), max_size());
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp openjdk/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp
045ef6
+++ openjdk/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp
045ef6
@@ -48,7 +48,7 @@
045ef6
   const size_t beg_index = size_t(index);
045ef6
   assert(beg_index < len || len == 0, "index too large");
045ef6
 
045ef6
-  const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
045ef6
+  const size_t stride = MIN2(len - beg_index, (size_t)ObjArrayMarkingStride);
045ef6
   const size_t end_index = beg_index + stride;
045ef6
   T* const base = (T*)a->base();
045ef6
   T* const beg = base + beg_index;
045ef6
@@ -82,7 +82,7 @@
045ef6
   const size_t beg_index = size_t(index);
045ef6
   assert(beg_index < len || len == 0, "index too large");
045ef6
 
045ef6
-  const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
045ef6
+  const size_t stride = MIN2(len - beg_index, (size_t)ObjArrayMarkingStride);
045ef6
   const size_t end_index = beg_index + stride;
045ef6
   T* const base = (T*)a->base();
045ef6
   T* const beg = base + beg_index;
3dea0a
diff --git openjdk.orig/hotspot/src/share/vm/runtime/arguments.cpp openjdk/hotspot/src/share/vm/runtime/arguments.cpp
3dea0a
--- openjdk.orig/hotspot/src/share/vm/runtime/arguments.cpp
045ef6
+++ openjdk/hotspot/src/share/vm/runtime/arguments.cpp
3dea0a
@@ -1289,7 +1289,7 @@
045ef6
     // NewSize was set on the command line and it is larger than
045ef6
     // preferred_max_new_size.
045ef6
     if (!FLAG_IS_DEFAULT(NewSize)) {   // NewSize explicitly set at command-line
045ef6
-      FLAG_SET_ERGO(uintx, MaxNewSize, MAX2(NewSize, preferred_max_new_size));
045ef6
+      FLAG_SET_ERGO(uintx, MaxNewSize, MAX2((size_t)NewSize, preferred_max_new_size));
045ef6
     } else {
045ef6
       FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size);
045ef6
     }
3dea0a
@@ -1314,8 +1314,8 @@
045ef6
       // Unless explicitly requested otherwise, make young gen
045ef6
       // at least min_new, and at most preferred_max_new_size.
045ef6
       if (FLAG_IS_DEFAULT(NewSize)) {
045ef6
-        FLAG_SET_ERGO(uintx, NewSize, MAX2(NewSize, min_new));
045ef6
-        FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, NewSize));
045ef6
+        FLAG_SET_ERGO(uintx, NewSize, MAX2((size_t)NewSize, min_new));
045ef6
+        FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, (size_t)NewSize));
045ef6
         if (PrintGCDetails && Verbose) {
045ef6
           // Too early to use gclog_or_tty
045ef6
           tty->print_cr("CMS ergo set NewSize: " SIZE_FORMAT, NewSize);
3dea0a
@@ -1325,7 +1325,7 @@
045ef6
       // so it's NewRatio x of NewSize.
045ef6
       if (FLAG_IS_DEFAULT(OldSize)) {
045ef6
         if (max_heap > NewSize) {
045ef6
-          FLAG_SET_ERGO(uintx, OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize));
045ef6
+          FLAG_SET_ERGO(uintx, OldSize, MIN2((size_t)(NewRatio*NewSize), max_heap - NewSize));
045ef6
           if (PrintGCDetails && Verbose) {
045ef6
             // Too early to use gclog_or_tty
045ef6
             tty->print_cr("CMS ergo set OldSize: " SIZE_FORMAT, OldSize);