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