changeset 2605:7836b5436b70 icedtea-3.0.0pre07

PR2777: Fix MAX/MIN template usage on s390 2015-12-23 Andrew John Hughes <gnu.andrew@member.fsf.org> * Makefile.am: (ICEDTEA_PATCHES): Add new patch. * NEWS: Updated. * patches/pr2777.patch: Fix size_t/uintx mismatches apparent on s390 MIN/MAX template instantiations.
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Thu, 24 Dec 2015 01:57:41 +0000
parents 3533dde47086
children 7442a0ce54ca
files ChangeLog Makefile.am NEWS patches/pr2777.patch
diffstat 4 files changed, 302 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Dec 09 05:58:52 2015 +0000
+++ b/ChangeLog	Thu Dec 24 01:57:41 2015 +0000
@@ -1,3 +1,12 @@
+2015-12-23  Andrew John Hughes  <gnu.andrew@member.fsf.org>
+
+	* Makefile.am:
+	(ICEDTEA_PATCHES): Add new patch.
+	* NEWS: Updated.
+	* patches/pr2777.patch:
+	Fix size_t/uintx mismatches apparent on s390
+	MIN/MAX template instantiations.
+
 2015-12-08  Andrew John Hughes  <gnu.andrew@member.fsf.org>
 
 	PR2362: Update HACKING & fsg.sh.in
--- a/Makefile.am	Wed Dec 09 05:58:52 2015 +0000
+++ b/Makefile.am	Thu Dec 24 01:57:41 2015 +0000
@@ -230,7 +230,8 @@
 	patches/memory-limits.patch \
 	patches/override-redirect-metacity.patch \
 	patches/rh1022017.patch \
-	patches/disable-intree-ec.patch
+	patches/disable-intree-ec.patch \
+	patches/pr2777.patch
 
 # Conditional patches
 
--- a/NEWS	Wed Dec 09 05:58:52 2015 +0000
+++ b/NEWS	Thu Dec 24 01:57:41 2015 +0000
@@ -121,6 +121,7 @@
   - PR2738: java.lang.UnsatisfiedLinkError: no javalcms in java.library.path
   - PR2743: Remove bad AArch64 merge fragment
   - PR2759: LCMS library should be named javalcms, not lcms, to avoid potential conflicts with the system library
+  - PR2777: Fix MAX/MIN template usage on s390
   - Don't substitute 'j' for '-j' inside -I directives
   - Extend 8041658 to all files in the HotSpot build.
   - Remove jcheck
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/pr2777.patch	Thu Dec 24 01:57:41 2015 +0000
@@ -0,0 +1,290 @@
+diff -Nru openjdk/hotspot.old/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
+--- openjdk/hotspot.old/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	2015-12-23 16:03:01.880881131 -0500
+@@ -2659,7 +2659,7 @@
+   if (ResizeOldPLAB && CMSOldPLABResizeQuicker) {
+     size_t multiple = _num_blocks[word_sz]/(CMSOldPLABToleranceFactor*CMSOldPLABNumRefills*n_blks);
+     n_blks +=  CMSOldPLABReactivityFactor*multiple*n_blks;
+-    n_blks = MIN2(n_blks, CMSOldPLABMax);
++    n_blks = MIN2(n_blks, (size_t) CMSOldPLABMax);
+   }
+   assert(n_blks > 0, "Error");
+   _cfls->par_get_chunk_of_blocks(word_sz, n_blks, fl);
+diff -Nru openjdk/hotspot.old/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+--- openjdk/hotspot.old/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	2015-12-23 16:10:30.880805198 -0500
+@@ -963,7 +963,7 @@
+   if (free_percentage < desired_free_percentage) {
+     size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
+     assert(desired_capacity >= capacity(), "invalid expansion size");
+-    size_t expand_bytes = MAX2(desired_capacity - capacity(), MinHeapDeltaBytes);
++    size_t expand_bytes = MAX2(desired_capacity - capacity(), (size_t) MinHeapDeltaBytes);
+     if (PrintGCDetails && Verbose) {
+       size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
+       gclog_or_tty->print_cr("\nFrom compute_new_size: ");
+@@ -6589,7 +6589,7 @@
+     HeapWord* curAddr = _markBitMap.startWord();
+     while (curAddr < _markBitMap.endWord()) {
+       size_t remaining  = pointer_delta(_markBitMap.endWord(), curAddr);
+-      MemRegion chunk(curAddr, MIN2(CMSBitMapYieldQuantum, remaining));
++      MemRegion chunk(curAddr, MIN2((size_t) CMSBitMapYieldQuantum, remaining));
+       _markBitMap.clear_large_range(chunk);
+       if (ConcurrentMarkSweepThread::should_yield() &&
+           !foregroundGCIsActive() &&
+@@ -6887,7 +6887,7 @@
+     return;
+   }
+   // Double capacity if possible
+-  size_t new_capacity = MIN2(_capacity*2, MarkStackSizeMax);
++  size_t new_capacity = MIN2(_capacity*2, (size_t) MarkStackSizeMax);
+   // Do not give up existing stack until we have managed to
+   // get the double capacity that we desired.
+   ReservedSpace rs(ReservedSpace::allocation_align_size_up(
+diff -Nru openjdk/hotspot.old/src/share/vm/gc_implementation/g1/concurrentMark.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+--- openjdk/hotspot.old/src/share/vm/gc_implementation/g1/concurrentMark.cpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	2015-12-23 16:05:54.970862212 -0500
+@@ -3903,7 +3903,7 @@
+   // of things to do) or totally (at the very end).
+   size_t target_size;
+   if (partially) {
+-    target_size = MIN2((size_t)_task_queue->max_elems()/3, GCDrainStackTargetSize);
++    target_size = MIN2((size_t)_task_queue->max_elems()/3, (size_t) GCDrainStackTargetSize);
+   } else {
+     target_size = 0;
+   }
+diff -Nru openjdk/hotspot.old/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+--- openjdk/hotspot.old/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	2015-12-23 16:14:44.630756825 -0500
+@@ -1726,7 +1726,7 @@
+ 
+   verify_region_sets_optional();
+ 
+-  size_t expand_bytes = MAX2(word_size * HeapWordSize, MinHeapDeltaBytes);
++  size_t expand_bytes = MAX2(word_size * HeapWordSize, (size_t) MinHeapDeltaBytes);
+   ergo_verbose1(ErgoHeapSizing,
+                 "attempt heap expansion",
+                 ergo_format_reason("allocation request failed")
+diff -Nru openjdk/hotspot.old/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.hpp openjdk/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.hpp
+--- openjdk/hotspot.old/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.hpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1PageBasedVirtualSpace.hpp	2015-12-23 16:17:52.080706118 -0500
+@@ -89,7 +89,7 @@
+   void pretouch_internal(size_t start_page, size_t end_page);
+ 
+   // Returns the index of the page which contains the given address.
+-  uintptr_t  addr_to_page_index(char* addr) const;
++  size_t  addr_to_page_index(char* addr) const;
+   // Returns the address of the given page index.
+   char*  page_start(size_t index) const;
+ 
+diff -Nru openjdk/hotspot.old/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp
+--- openjdk/hotspot.old/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp	2015-12-23 16:20:31.140706118 -0500
+@@ -38,7 +38,7 @@
+   _cancel(false),
+   _empty(true),
+   _dropped(0) {
+-  _nqueues = MAX2(ParallelGCThreads, (size_t)1);
++  _nqueues = MAX2((size_t) ParallelGCThreads, (size_t)1);
+   _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);
+diff -Nru openjdk/hotspot.old/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
+--- openjdk/hotspot.old/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp	2015-12-23 16:21:21.140696134 -0500
+@@ -110,7 +110,7 @@
+ };
+ 
+ G1StringDedupEntryCache::G1StringDedupEntryCache() {
+-  _nlists = MAX2(ParallelGCThreads, (size_t)1);
++  _nlists = MAX2((size_t) ParallelGCThreads, (size_t)1);
+   _lists = PaddedArray<G1StringDedupEntryFreeList, mtGC>::create_unfreeable((uint)_nlists);
+ }
+ 
+diff -Nru openjdk/hotspot.old/src/share/vm/gc_implementation/g1/heapRegion.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
+--- openjdk/hotspot.old/src/share/vm/gc_implementation/g1/heapRegion.cpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	2015-12-23 16:24:16.160655121 -0500
+@@ -108,7 +108,7 @@
+   uintx region_size = G1HeapRegionSize;
+   if (FLAG_IS_DEFAULT(G1HeapRegionSize)) {
+     size_t average_heap_size = (initial_heap_size + max_heap_size) / 2;
+-    region_size = MAX2(average_heap_size / HeapRegionBounds::target_number(),
++    region_size = MAX2((uintx) (average_heap_size / HeapRegionBounds::target_number()),
+                        (uintx) HeapRegionBounds::min_size());
+   }
+ 
+diff -Nru openjdk/hotspot.old/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
+--- openjdk/hotspot.old/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	2015-12-23 16:36:19.840421459 -0500
+@@ -920,8 +920,8 @@
+ void PSParallelCompact::initialize_dead_wood_limiter()
+ {
+   const size_t max = 100;
+-  _dwl_mean = double(MIN2(ParallelOldDeadWoodLimiterMean, max)) / 100.0;
+-  _dwl_std_dev = double(MIN2(ParallelOldDeadWoodLimiterStdDev, max)) / 100.0;
++  _dwl_mean = double(MIN2((size_t) ParallelOldDeadWoodLimiterMean, max)) / 100.0;
++  _dwl_std_dev = double(MIN2((size_t) ParallelOldDeadWoodLimiterStdDev, max)) / 100.0;
+   _dwl_first_term = 1.0 / (sqrt(2.0 * M_PI) * _dwl_std_dev);
+   DEBUG_ONLY(_dwl_initialized = true;)
+   _dwl_adjustment = normal_distribution(1.0);
+diff -Nru openjdk/hotspot.old/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp openjdk/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
+--- openjdk/hotspot.old/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	2015-12-23 16:34:41.150421459 -0500
+@@ -200,7 +200,7 @@
+   const size_t num_overflow_elems = of_stack->size();
+   const size_t space_available = queue->max_elems() - queue->size();
+   const size_t num_take_elems = MIN3(space_available / 4,
+-                                     ParGCDesiredObjsFromOverflowList,
++                                     (size_t) ParGCDesiredObjsFromOverflowList,
+                                      num_overflow_elems);
+   // Transfer the most recent num_take_elems from the overflow
+   // stack to our work queue.
+diff -Nru openjdk/hotspot.old/src/share/vm/memory/collectorPolicy.cpp openjdk/hotspot/src/share/vm/memory/collectorPolicy.cpp
+--- openjdk/hotspot.old/src/share/vm/memory/collectorPolicy.cpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/memory/collectorPolicy.cpp	2015-12-23 16:01:06.870914224 -0500
+@@ -385,7 +385,7 @@
+       uintx calculated_size = NewSize + OldSize;
+       double shrink_factor = (double) MaxHeapSize / calculated_size;
+       uintx smaller_new_size = align_size_down((uintx)(NewSize * shrink_factor), _gen_alignment);
+-      FLAG_SET_ERGO(uintx, NewSize, MAX2(young_gen_size_lower_bound(), smaller_new_size));
++      FLAG_SET_ERGO(uintx, NewSize, MAX2((uintx) young_gen_size_lower_bound(), smaller_new_size));
+       _initial_gen0_size = NewSize;
+ 
+       // OldSize is already aligned because above we aligned MaxHeapSize to
+@@ -423,7 +423,7 @@
+ 
+   // Determine maximum size of gen0
+ 
+-  size_t max_new_size = 0;
++  uintx max_new_size = 0;
+   if (!FLAG_IS_DEFAULT(MaxNewSize)) {
+     max_new_size = MaxNewSize;
+   } else {
+@@ -448,7 +448,7 @@
+     _initial_gen0_size = max_new_size;
+     _max_gen0_size = max_new_size;
+   } else {
+-    size_t desired_new_size = 0;
++    uintx desired_new_size = 0;
+     if (FLAG_IS_CMDLINE(NewSize)) {
+       // If NewSize is set on the command line, we must use it as
+       // the initial size and it also makes sense to use it as the
+@@ -461,7 +461,7 @@
+       // limit, but use NewRatio to calculate the initial size.
+       _min_gen0_size = NewSize;
+       desired_new_size =
+-        MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize);
++        MAX2((uintx) (scale_by_NewRatio_aligned(_initial_heap_byte_size)), NewSize);
+       max_new_size = MAX2(max_new_size, NewSize);
+     } else {
+       // For the case where NewSize is the default, use NewRatio
+@@ -469,9 +469,9 @@
+       // Use the default NewSize as the floor for these values.  If
+       // NewRatio is overly large, the resulting sizes can be too
+       // small.
+-      _min_gen0_size = MAX2(scale_by_NewRatio_aligned(_min_heap_byte_size), NewSize);
++      _min_gen0_size = MAX2((uintx) (scale_by_NewRatio_aligned(_min_heap_byte_size)), NewSize);
+       desired_new_size =
+-        MAX2(scale_by_NewRatio_aligned(_initial_heap_byte_size), NewSize);
++        MAX2((uintx) (scale_by_NewRatio_aligned(_initial_heap_byte_size)), NewSize);
+     }
+ 
+     assert(_min_gen0_size > 0, "Sanity check");
+@@ -573,7 +573,7 @@
+   } else {
+     // It's been explicitly set on the command line.  Use the
+     // OldSize and then determine the consequences.
+-    _min_gen1_size = MIN2(OldSize, _min_heap_byte_size - _min_gen0_size);
++    _min_gen1_size = MIN2(OldSize, (uintx) (_min_heap_byte_size - _min_gen0_size));
+     _initial_gen1_size = OldSize;
+ 
+     // If the user has explicitly set an OldSize that is inconsistent
+diff -Nru openjdk/hotspot.old/src/share/vm/memory/metaspace.cpp openjdk/hotspot/src/share/vm/memory/metaspace.cpp
+--- openjdk/hotspot.old/src/share/vm/memory/metaspace.cpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/memory/metaspace.cpp	2015-12-23 16:33:24.470421459 -0500
+@@ -1455,7 +1455,7 @@
+ 
+ void MetaspaceGC::post_initialize() {
+   // Reset the high-water mark once the VM initialization is done.
+-  _capacity_until_GC = MAX2(MetaspaceAux::committed_bytes(), MetaspaceSize);
++  _capacity_until_GC = MAX2(MetaspaceAux::committed_bytes(), (size_t) MetaspaceSize);
+ }
+ 
+ bool MetaspaceGC::can_expand(size_t word_size, bool is_class) {
+@@ -1515,7 +1515,7 @@
+     (size_t)MIN2(min_tmp, double(max_uintx));
+   // Don't shrink less than the initial generation size
+   minimum_desired_capacity = MAX2(minimum_desired_capacity,
+-                                  MetaspaceSize);
++                                  (size_t) MetaspaceSize);
+ 
+   if (PrintGCDetails && Verbose) {
+     gclog_or_tty->print_cr("\nMetaspaceGC::compute_new_size: ");
+@@ -1573,7 +1573,7 @@
+     const double max_tmp = used_after_gc / minimum_used_percentage;
+     size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx));
+     maximum_desired_capacity = MAX2(maximum_desired_capacity,
+-                                    MetaspaceSize);
++                                    (size_t) MetaspaceSize);
+     if (PrintGCDetails && Verbose) {
+       gclog_or_tty->print_cr("  "
+                              "  maximum_free_percentage: %6.2f"
+@@ -3285,7 +3285,7 @@
+     // on the medium chunk list.   The next chunk will be small and progress
+     // from there.  This size calculated by -version.
+     _first_class_chunk_word_size = MIN2((size_t)MediumChunk*6,
+-                                       (CompressedClassSpaceSize/BytesPerWord)*2);
++					(size_t) ((CompressedClassSpaceSize/BytesPerWord)*2));
+     _first_class_chunk_word_size = align_word_size_up(_first_class_chunk_word_size);
+     // Arbitrarily set the initial virtual space to a multiple
+     // of the boot class loader size.
+diff -Nru openjdk/hotspot.old/src/share/vm/oops/objArrayKlass.inline.hpp openjdk/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp
+--- openjdk/hotspot.old/src/share/vm/oops/objArrayKlass.inline.hpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/oops/objArrayKlass.inline.hpp	2015-12-23 16:26:32.200644827 -0500
+@@ -48,7 +48,7 @@
+   const size_t beg_index = size_t(index);
+   assert(beg_index < len || len == 0, "index too large");
+ 
+-  const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
++  const size_t stride = MIN2(len - beg_index, (size_t) ObjArrayMarkingStride);
+   const size_t end_index = beg_index + stride;
+   T* const base = (T*)a->base();
+   T* const beg = base + beg_index;
+@@ -82,7 +82,7 @@
+   const size_t beg_index = size_t(index);
+   assert(beg_index < len || len == 0, "index too large");
+ 
+-  const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
++  const size_t stride = MIN2(len - beg_index, (size_t) ObjArrayMarkingStride);
+   const size_t end_index = beg_index + stride;
+   T* const base = (T*)a->base();
+   T* const beg = base + beg_index;
+diff -Nru openjdk/hotspot.old/src/share/vm/runtime/arguments.cpp openjdk/hotspot/src/share/vm/runtime/arguments.cpp
+--- openjdk/hotspot.old/src/share/vm/runtime/arguments.cpp	2015-11-17 22:43:28.000000000 -0500
++++ openjdk/hotspot/src/share/vm/runtime/arguments.cpp	2015-12-23 15:40:25.731137339 -0500
+@@ -1264,7 +1264,7 @@
+     (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));
+-  size_t preferred_max_new_size =
++  uintx preferred_max_new_size = (uintx)
+     align_size_up(preferred_max_new_size_unaligned, os::vm_page_size());
+ 
+   // Unless explicitly requested otherwise, size young gen
+@@ -1295,7 +1295,7 @@
+            " max_heap: " SIZE_FORMAT,
+            min_heap_size(), InitialHeapSize, max_heap);
+     }
+-    size_t min_new = preferred_max_new_size;
++    uintx min_new = preferred_max_new_size;
+     if (FLAG_IS_CMDLINE(NewSize)) {
+       min_new = NewSize;
+     }
+@@ -1314,7 +1314,7 @@
+       // so it's NewRatio x of NewSize.
+       if (FLAG_IS_DEFAULT(OldSize)) {
+         if (max_heap > NewSize) {
+-          FLAG_SET_ERGO(uintx, OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize));
++          FLAG_SET_ERGO(uintx, OldSize, MIN2(NewRatio*NewSize, (uintx) (max_heap - NewSize)));
+           if (PrintGCDetails && Verbose) {
+             // Too early to use gclog_or_tty
+             tty->print_cr("CMS ergo set OldSize: " SIZE_FORMAT, OldSize);