8168490: Use the LL/ULL suffixes to define 64-bit integer literals on Windows
authorsimonis
Tue, 25 Oct 2016 16:42:28 +0200
changeset 42061 67176803a846
parent 42060 a915170794e7
child 42062 473286891dd8
8168490: Use the LL/ULL suffixes to define 64-bit integer literals on Windows Reviewed-by: dholmes, mgerdin, stuefe
hotspot/src/os/aix/vm/globals_aix.hpp
hotspot/src/os/aix/vm/os_aix.cpp
hotspot/src/share/vm/memory/virtualspace.cpp
hotspot/src/share/vm/utilities/globalDefinitions.hpp
hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp
hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp
hotspot/src/share/vm/utilities/globalDefinitions_xlc.hpp
--- a/hotspot/src/os/aix/vm/globals_aix.hpp	Wed Oct 26 20:13:29 2016 +0000
+++ b/hotspot/src/os/aix/vm/globals_aix.hpp	Tue Oct 25 16:42:28 2016 +0200
@@ -61,7 +61,7 @@
   /*  data segment when placing the java heap. If that space is too small, we  */   \
   /*  reduce our chance of getting a low heap address (needed for compressed   */   \
   /*  Oops).                                                                   */   \
-  product(uintx, MaxExpectedDataSegmentSize, (SIZE_4G * 2),                         \
+  product(uintx, MaxExpectedDataSegmentSize, 8*G,                                   \
           "Maximum expected Data Segment Size.")                                    \
                                                                                     \
   /* Use optimized addresses for the polling page.                             */   \
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Wed Oct 26 20:13:29 2016 +0000
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Tue Oct 25 16:42:28 2016 +0200
@@ -321,7 +321,7 @@
 
   if (os::Aix::on_pase() && os::Aix::os_version_short() < 0x0601) {
     // AS/400 older than V6R1: no vmgetinfo here, default to 4K
-    return SIZE_4K;
+    return 4*K;
   }
 
   vm_page_info pi;
@@ -330,7 +330,7 @@
     return pi.pagesize;
   } else {
     assert(false, "vmgetinfo failed to retrieve page size");
-    return SIZE_4K;
+    return 4*K;
   }
 }
 
@@ -351,10 +351,10 @@
 // Helper function for tracing page sizes.
 static const char* describe_pagesize(size_t pagesize) {
   switch (pagesize) {
-    case SIZE_4K : return "4K";
-    case SIZE_64K: return "64K";
-    case SIZE_16M: return "16M";
-    case SIZE_16G: return "16G";
+    case 4*K : return "4K";
+    case 64*K: return "64K";
+    case 16*M: return "16M";
+    case 16*G: return "16G";
     default:
       assert(false, "surprise");
       return "??";
@@ -372,14 +372,14 @@
   g_multipage_support.pagesize = ::sysconf(_SC_PAGESIZE);
 
   // This really would surprise me.
-  assert(g_multipage_support.pagesize == SIZE_4K, "surprise!");
+  assert(g_multipage_support.pagesize == 4*K, "surprise!");
 
   // Query default data page size (default page size for C-Heap, pthread stacks and .bss).
   // Default data page size is defined either by linker options (-bdatapsize)
   // or by environment variable LDR_CNTRL (suboption DATAPSIZE). If none is given,
   // default should be 4K.
   {
-    void* p = ::malloc(SIZE_16M);
+    void* p = ::malloc(16*M);
     g_multipage_support.datapsize = os::Aix::query_pagesize(p);
     ::free(p);
   }
@@ -447,7 +447,7 @@
     // Can we use 64K, 16M pages?
     for (int i = 0; i < num_psizes; i ++) {
       const size_t pagesize = sizes[i];
-      if (pagesize != SIZE_64K && pagesize != SIZE_16M) {
+      if (pagesize != 64*K && pagesize != 16*M) {
         continue;
       }
       bool can_use = false;
@@ -477,9 +477,9 @@
         ::shmdt(p);
       }
       trcVerbose("Can use: %s", (can_use ? "yes" : "no"));
-      if (pagesize == SIZE_64K) {
+      if (pagesize == 64*K) {
         g_multipage_support.can_use_64K_pages = can_use;
-      } else if (pagesize == SIZE_16M) {
+      } else if (pagesize == 16*M) {
         g_multipage_support.can_use_16M_pages = can_use;
       }
     }
@@ -506,11 +506,11 @@
       g_multipage_support.error);
 
   // sanity checks
-  assert0(g_multipage_support.pagesize == SIZE_4K);
-  assert0(g_multipage_support.datapsize == SIZE_4K || g_multipage_support.datapsize == SIZE_64K);
-  assert0(g_multipage_support.textpsize == SIZE_4K || g_multipage_support.textpsize == SIZE_64K);
+  assert0(g_multipage_support.pagesize == 4*K);
+  assert0(g_multipage_support.datapsize == 4*K || g_multipage_support.datapsize == 64*K);
+  assert0(g_multipage_support.textpsize == 4*K || g_multipage_support.textpsize == 64*K);
   assert0(g_multipage_support.pthr_stack_pagesize == g_multipage_support.datapsize);
-  assert0(g_multipage_support.shmpsize == SIZE_4K || g_multipage_support.shmpsize == SIZE_64K);
+  assert0(g_multipage_support.shmpsize == 4*K || g_multipage_support.shmpsize == 64*K);
 
 }
 
@@ -1924,7 +1924,7 @@
   }
 
   // Align size of shm up to 64K to avoid errors if we later try to change the page size.
-  const size_t size = align_size_up(bytes, SIZE_64K);
+  const size_t size = align_size_up(bytes, 64*K);
 
   // Reserve the shared segment.
   int shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | S_IRUSR | S_IWUSR);
@@ -1941,10 +1941,10 @@
 
   struct shmid_ds shmbuf;
   memset(&shmbuf, 0, sizeof(shmbuf));
-  shmbuf.shm_pagesize = SIZE_64K;
+  shmbuf.shm_pagesize = 64*K;
   if (shmctl(shmid, SHM_PAGESIZE, &shmbuf) != 0) {
     trcVerbose("Failed to set page size (need " UINTX_FORMAT " 64K pages) - shmctl failed with %d.",
-               size / SIZE_64K, errno);
+               size / (64*K), errno);
     // I want to know if this ever happens.
     assert(false, "failed to set page size for shmat");
   }
@@ -2122,7 +2122,7 @@
   }
 
   // bookkeeping
-  vmembk_add(addr, size, SIZE_4K, VMEM_MAPPED);
+  vmembk_add(addr, size, 4*K, VMEM_MAPPED);
 
   // Test alignment, see above.
   assert0(is_aligned_to(addr, os::vm_page_size()));
@@ -2218,7 +2218,7 @@
 
   if (UseExplicitCommit) {
     // AIX commits memory on touch. So, touch all pages to be committed.
-    for (char* p = addr; p < (addr + size); p += SIZE_4K) {
+    for (char* p = addr; p < (addr + size); p += 4*K) {
       *p = '\0';
     }
   }
@@ -2330,7 +2330,7 @@
 
   // In 4K mode always use mmap.
   // In 64K mode allocate small sizes with mmap, large ones with 64K shmatted.
-  if (os::vm_page_size() == SIZE_4K) {
+  if (os::vm_page_size() == 4*K) {
     return reserve_mmaped_memory(bytes, requested_addr, alignment_hint);
   } else {
     if (bytes >= Use64KPagesThreshold) {
@@ -2519,7 +2519,7 @@
 
   // In 4K mode always use mmap.
   // In 64K mode allocate small sizes with mmap, large ones with 64K shmatted.
-  if (os::vm_page_size() == SIZE_4K) {
+  if (os::vm_page_size() == 4*K) {
     return reserve_mmaped_memory(bytes, requested_addr, 0);
   } else {
     if (bytes >= Use64KPagesThreshold) {
@@ -3399,7 +3399,7 @@
   // We explicitly leave no option to change page size, because only upgrading would work,
   // not downgrading (if stack page size is 64k you cannot pretend its 4k).
 
-  if (g_multipage_support.datapsize == SIZE_4K) {
+  if (g_multipage_support.datapsize == 4*K) {
     // datapsize = 4K. Data segment, thread stacks are 4K paged.
     if (g_multipage_support.can_use_64K_pages) {
       // .. but we are able to use 64K pages dynamically.
@@ -3414,16 +3414,16 @@
       // -XX:-Use64KPages.
       if (Use64KPages) {
         trcVerbose("64K page mode (faked for data segment)");
-        Aix::_page_size = SIZE_64K;
+        Aix::_page_size = 64*K;
       } else {
         trcVerbose("4K page mode (Use64KPages=off)");
-        Aix::_page_size = SIZE_4K;
+        Aix::_page_size = 4*K;
       }
     } else {
       // .. and not able to allocate 64k pages dynamically. Here, just
       // fall back to 4K paged mode and use mmap for everything.
       trcVerbose("4K page mode");
-      Aix::_page_size = SIZE_4K;
+      Aix::_page_size = 4*K;
       FLAG_SET_ERGO(bool, Use64KPages, false);
     }
   } else {
@@ -3432,7 +3432,7 @@
     // (There is one special case where this may be false: EXTSHM=on.
     // but we decided to not support that mode).
     assert0(g_multipage_support.can_use_64K_pages);
-    Aix::_page_size = SIZE_64K;
+    Aix::_page_size = 64*K;
     trcVerbose("64K page mode");
     FLAG_SET_ERGO(bool, Use64KPages, true);
   }
--- a/hotspot/src/share/vm/memory/virtualspace.cpp	Wed Oct 26 20:13:29 2016 +0000
+++ b/hotspot/src/share/vm/memory/virtualspace.cpp	Tue Oct 25 16:42:28 2016 +0200
@@ -276,7 +276,7 @@
   if (base() && base() + _size > (char *)OopEncodingHeapMax) {
     if (true
         WIN64_ONLY(&& !UseLargePages)
-        AIX_ONLY(&& os::vm_page_size() != SIZE_64K)) {
+        AIX_ONLY(&& os::vm_page_size() != 64*K)) {
       // Protect memory at the base of the allocated region.
       // If special, the page was committed (only matters on windows)
       if (!os::protect_memory(_base, _noaccess_prefix, os::MEM_PROT_NONE, _special)) {
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Wed Oct 26 20:13:29 2016 +0000
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Tue Oct 25 16:42:28 2016 +0200
@@ -193,6 +193,16 @@
   return (byte_size + (HeapWordSize-1)) >> LogHeapWordSize;
 }
 
+//-------------------------------------------
+// Constant for jlong (standardized by C++11)
+
+// Build a 64bit integer constant
+#define CONST64(x)  (x ## LL)
+#define UCONST64(x) (x ## ULL)
+
+const jlong min_jlong = CONST64(0x8000000000000000);
+const jlong max_jlong = CONST64(0x7fffffffffffffff);
+
 const size_t K                  = 1024;
 const size_t M                  = K*K;
 const size_t G                  = M*K;
--- a/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Wed Oct 26 20:13:29 2016 +0000
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp	Tue Oct 25 16:42:28 2016 +0200
@@ -160,17 +160,6 @@
 typedef uint64_t julong;
 
 
-//----------------------------------------------------------------------------------------------------
-// Constant for jlong (specifying a long long constant is C++ compiler specific)
-
-// Build a 64bit integer constant
-#define CONST64(x)  (x ## LL)
-#define UCONST64(x) (x ## ULL)
-
-const jlong min_jlong = CONST64(0x8000000000000000);
-const jlong max_jlong = CONST64(0x7fffffffffffffff);
-
-
 #ifdef SOLARIS
 //----------------------------------------------------------------------------------------------------
 // ANSI C++ fixes
--- a/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp	Wed Oct 26 20:13:29 2016 +0000
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_sparcWorks.hpp	Tue Oct 25 16:42:28 2016 +0200
@@ -174,16 +174,6 @@
 typedef unsigned long long julong;
 
 
-//----------------------------------------------------------------------------------------------------
-// Constant for jlong (specifying a long long constant is C++ compiler specific)
-
-// Build a 64bit integer constant
-#define CONST64(x)  (x ## LL)
-#define UCONST64(x) (x ## ULL)
-
-const jlong min_jlong = CONST64(0x8000000000000000);
-const jlong max_jlong = CONST64(0x7fffffffffffffff);
-
 #ifdef SOLARIS
 //----------------------------------------------------------------------------------------------------
 // ANSI C++ fixes
--- a/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp	Wed Oct 26 20:13:29 2016 +0000
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp	Tue Oct 25 16:42:28 2016 +0200
@@ -63,8 +63,8 @@
 #undef NULL
 // 64-bit Windows uses a P64 data model (not LP64, although we define _LP64)
 // Since longs are 32-bit we cannot use 0L here.  Use the Visual C++ specific
-// 64-bit integer-suffix (i64) instead.
-#define NULL 0i64
+// 64-bit integer-suffix (LL) instead.
+#define NULL 0LL
 #else
 #ifndef NULL
 #define NULL 0
@@ -148,16 +148,6 @@
 inline int g_isfinite(jdouble f)                 { return _finite(f); }
 
 //----------------------------------------------------------------------------------------------------
-// Constant for jlong (specifying a long long constant is C++ compiler specific)
-
-// Build a 64bit integer constant with Visual C++
-#define  CONST64(x) (x ##  i64)
-#define UCONST64(x) (x ## ui64)
-
-const jlong min_jlong = (jlong)UCONST64(0x8000000000000000);
-const jlong max_jlong =         CONST64(0x7fffffffffffffff);
-
-//----------------------------------------------------------------------------------------------------
 // Miscellaneous
 
 // Visual Studio 2005 deprecates POSIX names - use ISO C++ names instead
--- a/hotspot/src/share/vm/utilities/globalDefinitions_xlc.hpp	Wed Oct 26 20:13:29 2016 +0000
+++ b/hotspot/src/share/vm/utilities/globalDefinitions_xlc.hpp	Tue Oct 25 16:42:28 2016 +0200
@@ -108,16 +108,6 @@
 
 
 //----------------------------------------------------------------------------------------------------
-// Constant for jlong (specifying a long long constant is C++ compiler specific)
-
-// Build a 64bit integer constant
-#define CONST64(x)  (x ## LL)
-#define UCONST64(x) (x ## ULL)
-
-const jlong min_jlong = CONST64(0x8000000000000000);
-const jlong max_jlong = CONST64(0x7fffffffffffffff);
-
-//----------------------------------------------------------------------------------------------------
 // Debugging
 
 #define DEBUG_EXCEPTION ::abort();
@@ -163,23 +153,6 @@
 // offset_of as it is defined for gcc.
 #define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16)
 
-// Some constant sizes used throughout the AIX port
-#define SIZE_1K   ((uint64_t) UCONST64(        0x400))
-#define SIZE_4K   ((uint64_t) UCONST64(       0x1000))
-#define SIZE_64K  ((uint64_t) UCONST64(      0x10000))
-#define SIZE_1M   ((uint64_t) UCONST64(     0x100000))
-#define SIZE_4M   ((uint64_t) UCONST64(     0x400000))
-#define SIZE_8M   ((uint64_t) UCONST64(     0x800000))
-#define SIZE_16M  ((uint64_t) UCONST64(    0x1000000))
-#define SIZE_256M ((uint64_t) UCONST64(   0x10000000))
-#define SIZE_1G   ((uint64_t) UCONST64(   0x40000000))
-#define SIZE_2G   ((uint64_t) UCONST64(   0x80000000))
-#define SIZE_4G   ((uint64_t) UCONST64(  0x100000000))
-#define SIZE_16G  ((uint64_t) UCONST64(  0x400000000))
-#define SIZE_32G  ((uint64_t) UCONST64(  0x800000000))
-#define SIZE_64G  ((uint64_t) UCONST64( 0x1000000000))
-#define SIZE_1T   ((uint64_t) UCONST64(0x10000000000))
-
 #ifndef USE_LIBRARY_BASED_TLS_ONLY
 #define THREAD_LOCAL_DECL __thread
 #endif