hotspot/src/share/vm/utilities/globalDefinitions.hpp
changeset 24424 2658d7834c6e
parent 24092 e274d864545a
child 24457 0e20b36df5c4
equal deleted inserted replaced
24358:8528b67f6562 24424:2658d7834c6e
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    39 # include "utilities/globalDefinitions_sparcWorks.hpp"
    39 # include "utilities/globalDefinitions_sparcWorks.hpp"
    40 #endif
    40 #endif
    41 #ifdef TARGET_COMPILER_xlc
    41 #ifdef TARGET_COMPILER_xlc
    42 # include "utilities/globalDefinitions_xlc.hpp"
    42 # include "utilities/globalDefinitions_xlc.hpp"
    43 #endif
    43 #endif
       
    44 
       
    45 #ifndef PRAGMA_DIAG_PUSH
       
    46 #define PRAGMA_DIAG_PUSH
       
    47 #endif
       
    48 #ifndef PRAGMA_DIAG_POP
       
    49 #define PRAGMA_DIAG_POP
       
    50 #endif
       
    51 #ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED
       
    52 #define PRAGMA_FORMAT_NONLITERAL_IGNORED
       
    53 #endif
       
    54 #ifndef PRAGMA_FORMAT_IGNORED
       
    55 #define PRAGMA_FORMAT_IGNORED
       
    56 #endif
       
    57 #ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
       
    58 #define PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
       
    59 #endif
       
    60 #ifndef PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
       
    61 #define PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
       
    62 #endif
       
    63 #ifndef PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
       
    64 #define PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
       
    65 #endif
       
    66 #ifndef ATTRIBUTE_PRINTF
       
    67 #define ATTRIBUTE_PRINTF(fmt, vargs)
       
    68 #endif
       
    69 
    44 
    70 
    45 #include "utilities/macros.hpp"
    71 #include "utilities/macros.hpp"
    46 
    72 
    47 // This file holds all globally used constants & types, class (forward)
    73 // This file holds all globally used constants & types, class (forward)
    48 // declarations and a few frequently used utility functions.
    74 // declarations and a few frequently used utility functions.
  1282 
  1308 
  1283 inline int build_int_from_shorts( jushort low, jushort high ) {
  1309 inline int build_int_from_shorts( jushort low, jushort high ) {
  1284   return ((int)((unsigned int)high << 16) | (unsigned int)low);
  1310   return ((int)((unsigned int)high << 16) | (unsigned int)low);
  1285 }
  1311 }
  1286 
  1312 
       
  1313 // Convert pointer to intptr_t, for use in printing pointers.
       
  1314 inline intptr_t p2i(const void * p) {
       
  1315   return (intptr_t) p;
       
  1316 }
       
  1317 
  1287 // Printf-style formatters for fixed- and variable-width types as pointers and
  1318 // Printf-style formatters for fixed- and variable-width types as pointers and
  1288 // integers.  These are derived from the definitions in inttypes.h.  If the platform
  1319 // integers.  These are derived from the definitions in inttypes.h.  If the platform
  1289 // doesn't provide appropriate definitions, they should be provided in
  1320 // doesn't provide appropriate definitions, they should be provided in
  1290 // the compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp)
  1321 // the compiler-specific definitions file (e.g., globalDefinitions_gcc.hpp)
  1291 
  1322 
  1300 #define PTR32_FORMAT           "0x%08" PRIx32
  1331 #define PTR32_FORMAT           "0x%08" PRIx32
  1301 
  1332 
  1302 // Format 64-bit quantities.
  1333 // Format 64-bit quantities.
  1303 #define INT64_FORMAT           "%" PRId64
  1334 #define INT64_FORMAT           "%" PRId64
  1304 #define UINT64_FORMAT          "%" PRIu64
  1335 #define UINT64_FORMAT          "%" PRIu64
       
  1336 #define UINT64_FORMAT_X        "%" PRIx64
  1305 #define INT64_FORMAT_W(width)  "%" #width PRId64
  1337 #define INT64_FORMAT_W(width)  "%" #width PRId64
  1306 #define UINT64_FORMAT_W(width) "%" #width PRIu64
  1338 #define UINT64_FORMAT_W(width) "%" #width PRIu64
  1307 
  1339 
  1308 #define PTR64_FORMAT           "0x%016" PRIx64
  1340 #define PTR64_FORMAT           "0x%016" PRIx64
  1309 
  1341 
  1322 #else   // !_LP64
  1354 #else   // !_LP64
  1323 #define INTPTR_FORMAT "0x%08"  PRIxPTR
  1355 #define INTPTR_FORMAT "0x%08"  PRIxPTR
  1324 #define PTR_FORMAT    "0x%08"  PRIxPTR
  1356 #define PTR_FORMAT    "0x%08"  PRIxPTR
  1325 #endif  // _LP64
  1357 #endif  // _LP64
  1326 
  1358 
       
  1359 #define INTPTR_FORMAT_W(width)   "%" #width PRIxPTR
       
  1360 
  1327 #define SSIZE_FORMAT             "%"   PRIdPTR
  1361 #define SSIZE_FORMAT             "%"   PRIdPTR
  1328 #define SIZE_FORMAT              "%"   PRIuPTR
  1362 #define SIZE_FORMAT              "%"   PRIuPTR
  1329 #define SIZE_FORMAT_HEX          "0x%" PRIxPTR
  1363 #define SIZE_FORMAT_HEX          "0x%" PRIxPTR
  1330 #define SSIZE_FORMAT_W(width)    "%"   #width PRIdPTR
  1364 #define SSIZE_FORMAT_W(width)    "%"   #width PRIdPTR
  1331 #define SIZE_FORMAT_W(width)     "%"   #width PRIuPTR
  1365 #define SIZE_FORMAT_W(width)     "%"   #width PRIuPTR
  1353 // specific.
  1387 // specific.
  1354 static inline void* dereference_vptr(void* addr) {
  1388 static inline void* dereference_vptr(void* addr) {
  1355   return *(void**)addr;
  1389   return *(void**)addr;
  1356 }
  1390 }
  1357 
  1391 
  1358 
       
  1359 #ifndef PRODUCT
  1392 #ifndef PRODUCT
  1360 
  1393 
  1361 // For unit testing only
  1394 // For unit testing only
  1362 class GlobalDefinitions {
  1395 class GlobalDefinitions {
  1363 public:
  1396 public: