changeset 6547:58c34ffeff58

7102489: RFE: cleanup jlong typedef on __APPLE__and _LLP64 systems. Summary: Define jlong as long on all LP64 platforms and add JLONG_FORMAT macro. Reviewed-by: dholmes, coleenp, mikael, kvn
author hseigel
date Wed, 19 Apr 2017 06:00:00 +0100
parents 661dc6d8482f
children be8da42894af
files src/cpu/x86/vm/jni_x86.h src/os/bsd/vm/os_bsd.inline.hpp src/os/linux/vm/os_linux.inline.hpp src/os/posix/launcher/java_md.c src/os/posix/launcher/java_md.h src/os/solaris/vm/os_solaris.inline.hpp src/os/windows/launcher/java_md.c src/os/windows/launcher/java_md.h src/os/windows/vm/os_windows.cpp src/os/windows/vm/os_windows.inline.hpp src/share/tools/launcher/java.c src/share/tools/launcher/java.h src/share/vm/c1/c1_InstructionPrinter.cpp src/share/vm/c1/c1_LIR.cpp src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp src/share/vm/gc_implementation/shared/ageTable.cpp src/share/vm/memory/universe.cpp src/share/vm/opto/idealGraphPrinter.cpp src/share/vm/opto/type.cpp src/share/vm/runtime/aprofiler.cpp src/share/vm/runtime/arguments.cpp src/share/vm/runtime/os.hpp src/share/vm/runtime/perfData.cpp src/share/vm/runtime/virtualspace.cpp src/share/vm/services/diagnosticArgument.cpp src/share/vm/services/heapDumper.cpp src/share/vm/services/lowMemoryDetector.cpp src/share/vm/utilities/globalDefinitions.hpp src/share/vm/utilities/globalDefinitions_gcc.hpp src/share/vm/utilities/ostream.cpp src/share/vm/utilities/taskqueue.cpp
diffstat 33 files changed, 76 insertions(+), 100 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/x86/vm/jni_x86.h	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/cpu/x86/vm/jni_x86.h	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,14 +38,9 @@
 
   #define JNICALL
   typedef int jint;
-#if defined(_LP64) && !defined(__APPLE__)
+#if defined(_LP64)
   typedef long jlong;
 #else
-  /*
-   * On _LP64 __APPLE__ "long" and "long long" are both 64 bits,
-   * but we use the "long long" typedef to avoid complaints from
-   * the __APPLE__ compiler about fprintf formats.
-   */
   typedef long long jlong;
 #endif
 
--- a/src/os/bsd/vm/os_bsd.inline.hpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/os/bsd/vm/os_bsd.inline.hpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,14 +59,6 @@
   return ":";
 }
 
-inline const char* os::jlong_format_specifier() {
-  return "%lld";
-}
-
-inline const char* os::julong_format_specifier() {
-  return "%llu";
-}
-
 // File names are case-sensitive on windows only
 inline int os::file_name_strcmp(const char* s1, const char* s2) {
   return strcmp(s1, s2);
--- a/src/os/linux/vm/os_linux.inline.hpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/os/linux/vm/os_linux.inline.hpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,14 +71,6 @@
   return ":";
 }
 
-inline const char* os::jlong_format_specifier() {
-  return "%lld";
-}
-
-inline const char* os::julong_format_specifier() {
-  return "%llu";
-}
-
 // File names are case-sensitive on windows only
 inline int os::file_name_strcmp(const char* s1, const char* s2) {
   return strcmp(s1, s2);
--- a/src/os/posix/launcher/java_md.c	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/os/posix/launcher/java_md.c	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1887,11 +1887,6 @@
     }
 }
 
-const char *
-jlong_format_specifier() {
-    return "%lld";
-}
-
 /*
  * Block current thread and continue execution in a new thread
  */
--- a/src/os/posix/launcher/java_md.h	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/os/posix/launcher/java_md.h	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,6 +64,12 @@
 #define Counter2Micros(counts)    (1)
 #endif /* HAVE_GETHRTIME */
 
+#ifdef _LP64
+#define JLONG_FORMAT "%ld"
+#else
+#define JLONG_FORMAT "%lld"
+#endif
+
 /*
  * Function prototypes.
  */
--- a/src/os/solaris/vm/os_solaris.inline.hpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/os/solaris/vm/os_solaris.inline.hpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,9 +50,6 @@
 inline const char* os::line_separator() { return "\n"; }
 inline const char* os::path_separator() { return ":"; }
 
-inline const char* os::jlong_format_specifier()   { return "%lld"; }
-inline const char* os::julong_format_specifier()  { return "%llu"; }
-
 // File names are case-sensitive on windows only
 inline int os::file_name_strcmp(const char* s1, const char* s2) {
   return strcmp(s1, s2);
--- a/src/os/windows/launcher/java_md.c	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/os/windows/launcher/java_md.c	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1323,11 +1323,6 @@
     }
 }
 
-const char *
-jlong_format_specifier() {
-    return "%I64d";
-}
-
 /*
  * Block current thread and continue execution in a new thread
  */
--- a/src/os/windows/launcher/java_md.h	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/os/windows/launcher/java_md.h	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,6 +69,8 @@
 extern int _main(int argc, char **argv);
 #endif
 
+#define JLONG_FORMAT "%I64d"
+
 /*
  * Function prototypes.
  */
--- a/src/os/windows/vm/os_windows.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/os/windows/vm/os_windows.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -3157,7 +3157,7 @@
     }
     if( Verbose && PrintMiscellaneous ) {
       reserveTimer.stop();
-      tty->print_cr("reserve_memory of %Ix bytes took %ld ms (%ld ticks)", bytes,
+      tty->print_cr("reserve_memory of %Ix bytes took " JLONG_FORMAT " ms (" JLONG_FORMAT " ticks)", bytes,
                     reserveTimer.milliseconds(), reserveTimer.ticks());
     }
   }
@@ -4588,7 +4588,7 @@
   if (hFile == NULL) {
     if (PrintMiscellaneous && Verbose) {
       DWORD err = GetLastError();
-      tty->print_cr("CreateFile() failed: GetLastError->%ld.");
+      tty->print_cr("CreateFile() failed: GetLastError->%ld.", err);
     }
     return NULL;
   }
@@ -4638,7 +4638,7 @@
     if (hMap == NULL) {
       if (PrintMiscellaneous && Verbose) {
         DWORD err = GetLastError();
-        tty->print_cr("CreateFileMapping() failed: GetLastError->%ld.");
+        tty->print_cr("CreateFileMapping() failed: GetLastError->%ld.", err);
       }
       CloseHandle(hFile);
       return NULL;
--- a/src/os/windows/vm/os_windows.inline.hpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/os/windows/vm/os_windows.inline.hpp	Wed Apr 19 06:00:00 2017 +0100
@@ -37,9 +37,6 @@
 inline const char* os::path_separator()                { return ";"; }
 inline const char* os::dll_file_extension()            { return ".dll"; }
 
-inline const char* os::jlong_format_specifier()        { return "%I64d"; }
-inline const char* os::julong_format_specifier()       { return "%I64u"; }
-
 inline const int os::default_file_open_flags() { return O_BINARY | O_NOINHERIT;}
 
 // File names are case-insensitive on windows only
--- a/src/share/tools/launcher/java.c	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/tools/launcher/java.c	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -808,7 +808,7 @@
 static int
 parse_stack_size(const char *s, jlong *result) {
   jlong n = 0;
-  int args_read = sscanf(s, jlong_format_specifier(), &n);
+  int args_read = sscanf(s, JLONG_FORMAT, &n);
   if (args_read != 1) {
     return 0;
   }
--- a/src/share/tools/launcher/java.h	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/tools/launcher/java.h	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,7 +86,6 @@
 jboolean RemovableMachineDependentOption(char * option);
 void PrintMachineDependentOptions();
 
-const char *jlong_format_specifier();
 /*
  * Block current thread and continue execution in new thread
  */
--- a/src/share/vm/c1/c1_InstructionPrinter.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/c1/c1_InstructionPrinter.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -360,7 +360,7 @@
   ValueType* t = x->type();
   switch (t->tag()) {
     case intTag    : output()->print("%d"  , t->as_IntConstant   ()->value());    break;
-    case longTag   : output()->print(os::jlong_format_specifier(), t->as_LongConstant()->value()); output()->print("L"); break;
+    case longTag   : output()->print(JLONG_FORMAT, t->as_LongConstant()->value()); output()->print("L"); break;
     case floatTag  : output()->print("%g"  , t->as_FloatConstant ()->value());    break;
     case doubleTag : output()->print("%gD" , t->as_DoubleConstant()->value());    break;
     case objectTag : print_object(x);                                        break;
--- a/src/share/vm/c1/c1_LIR.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/c1/c1_LIR.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1549,7 +1549,7 @@
   switch (type()) {
     case T_ADDRESS:out->print("address:%d",as_jint());          break;
     case T_INT:    out->print("int:%d",   as_jint());           break;
-    case T_LONG:   out->print("lng:%lld", as_jlong());          break;
+    case T_LONG:   out->print("lng:" JLONG_FORMAT, as_jlong()); break;
     case T_FLOAT:  out->print("flt:%f",   as_jfloat());         break;
     case T_DOUBLE: out->print("dbl:%f",   as_jdouble());        break;
     case T_OBJECT: out->print("obj:0x%x", as_jobject());        break;
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -556,7 +556,7 @@
     reportIndexedFreeListStatistics();
     size_t total_size = totalSizeInIndexedFreeLists() +
                        _dictionary->total_chunk_size(DEBUG_ONLY(freelistLock()));
-    gclog_or_tty->print(" free=%ld frag=%1.4f\n", total_size, flsFrag());
+    gclog_or_tty->print(" free=" SIZE_FORMAT " frag=%1.4f\n", total_size, flsFrag());
   }
 }
 
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3471,7 +3471,7 @@
     if (Verbose && PrintGC) {
       size_t new_mem_size = _virtual_space.committed_size();
       size_t old_mem_size = new_mem_size - bytes;
-      gclog_or_tty->print_cr("Expanding %s from %ldK by %ldK to %ldK",
+      gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K",
                     name(), old_mem_size/K, bytes/K, new_mem_size/K);
     }
   }
@@ -9526,7 +9526,7 @@
       if (Verbose && PrintGCDetails) {
         size_t new_mem_size = _virtual_space.committed_size();
         size_t old_mem_size = new_mem_size + bytes;
-        gclog_or_tty->print_cr("Shrinking %s from %ldK by %ldK to %ldK",
+        gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K",
                       name(), old_mem_size/K, bytes/K, new_mem_size/K);
       }
     }
--- a/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -556,7 +556,7 @@
 
        if (PrintTenuringDistribution) {
          gclog_or_tty->cr();
-         gclog_or_tty->print_cr("Desired survivor size %ld bytes, new threshold %u (max %u)",
+         gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u (max %u)",
                                 size_policy->calculated_survivor_size_in_bytes(),
                                 _tenuring_threshold, MaxTenuringThreshold);
        }
--- a/src/share/vm/gc_implementation/shared/ageTable.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/gc_implementation/shared/ageTable.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,7 +96,7 @@
 
     if (PrintTenuringDistribution) {
       gclog_or_tty->cr();
-      gclog_or_tty->print_cr("Desired survivor size %ld bytes, new threshold %u (max %u)",
+      gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u (max %u)",
         desired_survivor_size*oopSize, result, MaxTenuringThreshold);
     }
 
--- a/src/share/vm/memory/universe.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/memory/universe.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -291,7 +291,7 @@
   if (size < alignment || size % alignment != 0) {
     ResourceMark rm;
     stringStream st;
-    st.print("Size of %s (%ld bytes) must be aligned to %ld bytes", name, size, alignment);
+    st.print("Size of %s (" UINTX_FORMAT " bytes) must be aligned to " UINTX_FORMAT " bytes", name, size, alignment);
     char* error = st.as_string();
     vm_exit_during_initialization(error);
   }
--- a/src/share/vm/opto/idealGraphPrinter.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/opto/idealGraphPrinter.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -547,7 +547,7 @@
 
         // max. 2 chars allowed
         if (value >= -9 && value <= 99) {
-          sprintf(buffer, INT64_FORMAT, value);
+          sprintf(buffer, JLONG_FORMAT, value);
           print_prop(short_name, buffer);
         } else {
           print_prop(short_name, "L");
--- a/src/share/vm/opto/type.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/opto/type.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1546,10 +1546,10 @@
 static const char* longnamenear(jlong x, const char* xname, char* buf, jlong n) {
   if (n > x) {
     if (n >= x + 10000)  return NULL;
-    sprintf(buf, "%s+" INT64_FORMAT, xname, n - x);
+    sprintf(buf, "%s+" JLONG_FORMAT, xname, n - x);
   } else if (n < x) {
     if (n <= x - 10000)  return NULL;
-    sprintf(buf, "%s-" INT64_FORMAT, xname, x - n);
+    sprintf(buf, "%s-" JLONG_FORMAT, xname, x - n);
   } else {
     return xname;
   }
@@ -1561,11 +1561,11 @@
   if (n == min_jlong)
     return "min";
   else if (n < min_jlong + 10000)
-    sprintf(buf, "min+" INT64_FORMAT, n - min_jlong);
+    sprintf(buf, "min+" JLONG_FORMAT, n - min_jlong);
   else if (n == max_jlong)
     return "max";
   else if (n > max_jlong - 10000)
-    sprintf(buf, "max-" INT64_FORMAT, max_jlong - n);
+    sprintf(buf, "max-" JLONG_FORMAT, max_jlong - n);
   else if ((str = longnamenear(max_juint, "maxuint", buf, n)) != NULL)
     return str;
   else if ((str = longnamenear(max_jint, "maxint", buf, n)) != NULL)
@@ -1573,7 +1573,7 @@
   else if ((str = longnamenear(min_jint, "minint", buf, n)) != NULL)
     return str;
   else
-    sprintf(buf, INT64_FORMAT, n);
+    sprintf(buf, JLONG_FORMAT, n);
   return buf;
 }
 
--- a/src/share/vm/runtime/aprofiler.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/runtime/aprofiler.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -144,7 +144,7 @@
   assert(!is_active(), "AllocationProfiler cannot be active while printing profile");
 
   tty->cr();
-  tty->print_cr("Allocation profile (sizes in bytes, cutoff = %ld bytes):", cutoff * BytesPerWord);
+  tty->print_cr("Allocation profile (sizes in bytes, cutoff = " SIZE_FORMAT " bytes):", cutoff * BytesPerWord);
   tty->cr();
 
   // Print regular instance klasses and basic type array klasses
--- a/src/share/vm/runtime/arguments.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/runtime/arguments.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -548,7 +548,7 @@
 // Parses a memory size specification string.
 static bool atomull(const char *s, julong* result) {
   julong n = 0;
-  int args_read = sscanf(s, os::julong_format_specifier(), &n);
+  int args_read = sscanf(s, JULONG_FORMAT, &n);
   if (args_read != 1) {
     return false;
   }
--- a/src/share/vm/runtime/os.hpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/runtime/os.hpp	Wed Apr 19 06:00:00 2017 +0100
@@ -685,10 +685,6 @@
 
   static struct hostent* get_host_by_name(char* name);
 
-  // Printing 64 bit integers
-  static const char* jlong_format_specifier();
-  static const char* julong_format_specifier();
-
   // Support for signals (see JVM_RaiseSignal, JVM_RegisterSignal)
   static void  signal_init();
   static void  signal_init_pd();
--- a/src/share/vm/runtime/perfData.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/runtime/perfData.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -192,7 +192,7 @@
 }
 
 int PerfLong::format(char* buffer, int length) {
-  return jio_snprintf(buffer, length,"%lld", *(jlong*)_valuep);
+  return jio_snprintf(buffer, length, JLONG_FORMAT, *(jlong*)_valuep);
 }
 
 PerfLongVariant::PerfLongVariant(CounterNS ns, const char* namep, Units u,
--- a/src/share/vm/runtime/virtualspace.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/runtime/virtualspace.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -938,8 +938,8 @@
   tty->print   ("Virtual space:");
   if (special()) tty->print(" (pinned in memory)");
   tty->cr();
-  tty->print_cr(" - committed: %ld", committed_size());
-  tty->print_cr(" - reserved:  %ld", reserved_size());
+  tty->print_cr(" - committed: " SIZE_FORMAT, committed_size());
+  tty->print_cr(" - reserved:  " SIZE_FORMAT, reserved_size());
   tty->print_cr(" - [low, high]:     [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",  low(), high());
   tty->print_cr(" - [low_b, high_b]: [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",  low_boundary(), high_boundary());
 }
--- a/src/share/vm/services/diagnosticArgument.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/services/diagnosticArgument.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,7 +89,7 @@
                                                   size_t len, TRAPS) {
   int scanned = -1;
   if (str == NULL
-      || sscanf(str, INT64_FORMAT"%n", &_value, &scanned) != 1
+      || sscanf(str, JLONG_FORMAT"%n", &_value, &scanned) != 1
       || (size_t)scanned != len)
   {
     ResourceMark rm;
@@ -186,7 +186,7 @@
               "Integer parsing error nanotime value: syntax error, value is null");
   }
 
-  int argc = sscanf(str, INT64_FORMAT , &_value._time);
+  int argc = sscanf(str, JLONG_FORMAT, &_value._time);
   if (argc != 1) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Integer parsing error nanotime value: syntax error");
--- a/src/share/vm/services/heapDumper.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/services/heapDumper.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1890,7 +1890,7 @@
     if (error() == NULL) {
       char msg[256];
       sprintf(msg, "Heap dump file created [%s bytes in %3.3f secs]",
-        os::jlong_format_specifier(), timer()->seconds());
+        JLONG_FORMAT, timer()->seconds());
       tty->print_cr(msg, writer.bytes_written());
     } else {
       tty->print_cr("Dump file is incomplete: %s", writer.error());
--- a/src/share/vm/services/lowMemoryDetector.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/services/lowMemoryDetector.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -353,7 +353,7 @@
 
 #ifndef PRODUCT
 void SensorInfo::print() {
-  tty->print_cr("%s count = %ld pending_triggers = %ld pending_clears = %ld",
+  tty->print_cr("%s count = " SIZE_FORMAT " pending_triggers = %ld pending_clears = %ld",
                 (_sensor_on ? "on" : "off"),
                 _sensor_count, _pending_trigger_count, _pending_clear_count);
 }
--- a/src/share/vm/utilities/globalDefinitions.hpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/utilities/globalDefinitions.hpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1237,6 +1237,14 @@
 
 #define PTR64_FORMAT           "0x%016" PRIx64
 
+// Format jlong, if necessary
+#ifndef JLONG_FORMAT
+#define JLONG_FORMAT           INT64_FORMAT
+#endif
+#ifndef JULONG_FORMAT
+#define JULONG_FORMAT          UINT64_FORMAT
+#endif
+
 // Format pointers which change size between 32- and 64-bit.
 #ifdef  _LP64
 #define INTPTR_FORMAT "0x%016" PRIxPTR
--- a/src/share/vm/utilities/globalDefinitions_gcc.hpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/utilities/globalDefinitions_gcc.hpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -306,4 +306,8 @@
 #endif
 #define offsetof(klass,field) offset_of(klass,field)
 
+#if defined(_LP64) && defined(__APPLE__)
+#define JLONG_FORMAT           "%ld"
+#endif // _LP64 && __APPLE__
+
 #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_GCC_HPP
--- a/src/share/vm/utilities/ostream.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/utilities/ostream.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -246,13 +246,11 @@
 }
 
 void outputStream::print_jlong(jlong value) {
-  // N.B. Same as INT64_FORMAT
-  print(os::jlong_format_specifier(), value);
+  print(JLONG_FORMAT, value);
 }
 
 void outputStream::print_julong(julong value) {
-  // N.B. Same as UINT64_FORMAT
-  print(os::julong_format_specifier(), value);
+  print(JULONG_FORMAT, value);
 }
 
 /**
--- a/src/share/vm/utilities/taskqueue.cpp	Wed Apr 19 05:37:53 2017 +0100
+++ b/src/share/vm/utilities/taskqueue.cpp	Wed Apr 19 06:00:00 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -253,8 +253,8 @@
 
 #ifdef TRACESPINNING
 void ParallelTaskTerminator::print_termination_counts() {
-  gclog_or_tty->print_cr("ParallelTaskTerminator Total yields: %lld  "
-    "Total spins: %lld  Total peeks: %lld",
+  gclog_or_tty->print_cr("ParallelTaskTerminator Total yields: " UINT32_FORMAT
+    " Total spins: " UINT32_FORMAT " Total peeks: " UINT32_FORMAT,
     total_yields(),
     total_spins(),
     total_peeks());