# HG changeset patch
# User andrew
# Date 1526788009 -3600
#      Sun May 20 04:46:49 2018 +0100
# Node ID 999983606f5c61b093c6f6316a7b26c4cd4ca79e
# Parent  7f6e1069a5719c8908b53774d3560ce851c7cd70
PR3593: s390 needs to use '%z' format specifier for size_t arguments as size_t != int

diff -Nru openjdk.orig/hotspot/src/share/vm/asm/codeBuffer.cpp openjdk/hotspot/src/share/vm/asm/codeBuffer.cpp
--- openjdk.orig/hotspot/src/share/vm/asm/codeBuffer.cpp	2020-10-17 05:31:10.000000000 +0100
+++ openjdk/hotspot/src/share/vm/asm/codeBuffer.cpp	2020-10-26 04:00:54.102745171 +0000
@@ -977,7 +977,7 @@
     for (int n = (int) CodeBuffer::SECT_FIRST; n < (int) CodeBuffer::SECT_LIMIT; n++) {
       CodeSection* sect = code_section(n);
       if (!sect->is_allocated() || sect->is_empty())  continue;
-      xtty->print_cr("<sect index='%d' size='" SIZE_FORMAT "' free='" SIZE_FORMAT "'/>",
+      xtty->print_cr("<sect index='%d' size='" INTX_FORMAT "' free='" INTX_FORMAT "'/>",
                      n, sect->limit() - sect->start(), sect->limit() - sect->end());
     }
     xtty->print_cr("</blob>");
diff -Nru openjdk.orig/hotspot/src/share/vm/code/codeCache.cpp openjdk/hotspot/src/share/vm/code/codeCache.cpp
--- openjdk.orig/hotspot/src/share/vm/code/codeCache.cpp	2020-10-17 05:31:10.000000000 +0100
+++ openjdk/hotspot/src/share/vm/code/codeCache.cpp	2020-10-26 04:00:54.103745182 +0000
@@ -199,7 +199,7 @@
     }
     if (PrintCodeCacheExtension) {
       ResourceMark rm;
-      tty->print_cr("code cache extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (" SSIZE_FORMAT " bytes)",
+      tty->print_cr("code cache extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (" INTX_FORMAT " bytes)",
                     (intptr_t)_heap->low_boundary(), (intptr_t)_heap->high(),
                     (address)_heap->high() - (address)_heap->low_boundary());
     }
diff -Nru openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
--- openjdk.orig/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp	2020-10-26 03:56:19.253830644 +0000
+++ openjdk/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp	2020-10-26 04:01:43.844272631 +0000
@@ -597,7 +597,7 @@
     "   [Table]\n"
     "      [Memory Usage: " G1_STRDEDUP_BYTES_FORMAT_NS "]\n"
     "      [Size: " SIZE_FORMAT ", Min: " SIZE_FORMAT ", Max: " SIZE_FORMAT "]\n"
-    "      [Entries: " UINTX_FORMAT ", Load: " G1_STRDEDUP_PERCENT_FORMAT_NS ", Cached: " UINTX_FORMAT ", Added: " UINTX_FORMAT ", Removed: " UINTX_FORMAT "]\n"
+    "      [Entries: " UINTX_FORMAT ", Load: " G1_STRDEDUP_PERCENT_FORMAT_NS ", Cached: " SIZE_FORMAT ", Added: " UINTX_FORMAT ", Removed: " UINTX_FORMAT "]\n"
     "      [Resize Count: " UINTX_FORMAT ", Shrink Threshold: " UINTX_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT_NS "), Grow Threshold: " UINTX_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT_NS ")]\n"
     "      [Rehash Count: " UINTX_FORMAT ", Rehash Threshold: " UINTX_FORMAT ", Hash Seed: " UINT64_FORMAT "]\n"
     "      [Age Threshold: " UINTX_FORMAT "]",
diff -Nru openjdk.orig/hotspot/src/share/vm/memory/blockOffsetTable.cpp openjdk/hotspot/src/share/vm/memory/blockOffsetTable.cpp
--- openjdk.orig/hotspot/src/share/vm/memory/blockOffsetTable.cpp	2020-10-17 05:31:10.000000000 +0100
+++ openjdk/hotspot/src/share/vm/memory/blockOffsetTable.cpp	2020-10-26 04:00:54.105745203 +0000
@@ -57,7 +57,7 @@
     gclog_or_tty->print_cr("BlockOffsetSharedArray::BlockOffsetSharedArray: ");
     gclog_or_tty->print_cr("  "
                   "  rs.base(): " INTPTR_FORMAT
-                  "  rs.size(): " INTPTR_FORMAT
+                  "  rs.size(): " SIZE_FORMAT
                   "  rs end(): " INTPTR_FORMAT,
                   p2i(rs.base()), rs.size(), p2i(rs.base() + rs.size()));
     gclog_or_tty->print_cr("  "
diff -Nru openjdk.orig/hotspot/src/share/vm/memory/collectorPolicy.cpp openjdk/hotspot/src/share/vm/memory/collectorPolicy.cpp
--- openjdk.orig/hotspot/src/share/vm/memory/collectorPolicy.cpp	2020-10-26 03:56:19.255830665 +0000
+++ openjdk/hotspot/src/share/vm/memory/collectorPolicy.cpp	2020-10-26 04:00:54.106745214 +0000
@@ -1056,7 +1056,8 @@
     size_t expected = msp.scale_by_NewRatio_aligned(initial_heap_size);
     assert(msp.initial_gen0_size() == expected, err_msg("%zu != %zu", msp.initial_gen0_size(), expected));
     assert(FLAG_IS_ERGO(NewSize) && NewSize == expected,
-        err_msg("NewSize should have been set ergonomically to %zu, but was %zu", expected, NewSize));
+        err_msg("NewSize should have been set ergonomically to " SIZE_FORMAT ", but was " UINTX_FORMAT,
+		expected, NewSize));
   }
 
 private:
diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/arguments.cpp openjdk/hotspot/src/share/vm/runtime/arguments.cpp
--- openjdk.orig/hotspot/src/share/vm/runtime/arguments.cpp	2020-10-26 03:56:19.261830729 +0000
+++ openjdk/hotspot/src/share/vm/runtime/arguments.cpp	2020-10-26 04:00:54.108745235 +0000
@@ -1312,14 +1312,14 @@
     }
     if (PrintGCDetails && Verbose) {
       // Too early to use gclog_or_tty
-      tty->print_cr("CMS ergo set MaxNewSize: " SIZE_FORMAT, MaxNewSize);
+      tty->print_cr("CMS ergo set MaxNewSize: " UINTX_FORMAT, MaxNewSize);
     }
 
     // Code along this path potentially sets NewSize and OldSize
     if (PrintGCDetails && Verbose) {
       // Too early to use gclog_or_tty
-      tty->print_cr("CMS set min_heap_size: " SIZE_FORMAT
-           " initial_heap_size:  " SIZE_FORMAT
+      tty->print_cr("CMS set min_heap_size: " UINTX_FORMAT
+           " initial_heap_size:  " UINTX_FORMAT
            " max_heap: " SIZE_FORMAT,
            min_heap_size(), InitialHeapSize, max_heap);
     }
@@ -1335,7 +1335,7 @@
         FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, NewSize));
         if (PrintGCDetails && Verbose) {
           // Too early to use gclog_or_tty
-          tty->print_cr("CMS ergo set NewSize: " SIZE_FORMAT, NewSize);
+          tty->print_cr("CMS ergo set NewSize: " UINTX_FORMAT, NewSize);
         }
       }
       // Unless explicitly requested otherwise, size old gen
@@ -1345,7 +1345,7 @@
           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);
+            tty->print_cr("CMS ergo set OldSize: " UINTX_FORMAT, OldSize);
           }
         }
       }
@@ -2074,7 +2074,7 @@
 
       if (PrintGCDetails && Verbose) {
         // Cannot use gclog_or_tty yet.
-        tty->print_cr("  Initial heap size " SIZE_FORMAT, (uintx)reasonable_initial);
+        tty->print_cr("  Initial heap size " SIZE_FORMAT, (size_t)reasonable_initial);
       }
       FLAG_SET_ERGO(uintx, InitialHeapSize, (uintx)reasonable_initial);
     }
@@ -2084,7 +2084,7 @@
       set_min_heap_size(MIN2((uintx)reasonable_minimum, InitialHeapSize));
       if (PrintGCDetails && Verbose) {
         // Cannot use gclog_or_tty yet.
-        tty->print_cr("  Minimum heap size " SIZE_FORMAT, min_heap_size());
+        tty->print_cr("  Minimum heap size " UINTX_FORMAT, min_heap_size());
       }
     }
   }
diff -Nru openjdk.orig/hotspot/src/share/vm/utilities/globalDefinitions.hpp openjdk/hotspot/src/share/vm/utilities/globalDefinitions.hpp
--- openjdk.orig/hotspot/src/share/vm/utilities/globalDefinitions.hpp	2020-10-17 05:31:10.000000000 +0100
+++ openjdk/hotspot/src/share/vm/utilities/globalDefinitions.hpp	2020-10-26 04:00:54.109745246 +0000
@@ -1456,12 +1456,21 @@
 
 #define INTPTR_FORMAT_W(width)   "%" #width PRIxPTR
 
+#if defined(S390) && !defined(_LP64)
+#define SSIZE_FORMAT          "%z"   PRIdPTR
+#define SIZE_FORMAT           "%z"   PRIuPTR
+#define SIZE_FORMAT_HEX       "0x%z" PRIxPTR
+#define SSIZE_FORMAT_W(width) "%"   #width "z" PRIdPTR
+#define SIZE_FORMAT_W(width)  "%"   #width "z" PRIuPTR
+#define SIZE_FORMAT_HEX_W(width) "0x%" #width "z" PRIxPTR
+#else   // !S390
 #define SSIZE_FORMAT          "%"   PRIdPTR
 #define SIZE_FORMAT           "%"   PRIuPTR
 #define SIZE_FORMAT_HEX       "0x%" PRIxPTR
 #define SSIZE_FORMAT_W(width) "%"   #width PRIdPTR
 #define SIZE_FORMAT_W(width)  "%"   #width PRIuPTR
 #define SIZE_FORMAT_HEX_W(width) "0x%" #width PRIxPTR
+#endif  // S390
 
 #define INTX_FORMAT           "%" PRIdPTR
 #define UINTX_FORMAT          "%" PRIuPTR
