hotspot/src/share/vm/utilities/globalDefinitions_visCPP.hpp
author dholmes
Fri, 04 Dec 2015 04:06:37 -0500
changeset 34633 2a6c7c7b30a7
parent 33759 8a0e9139a9c5
child 36183 15d5045f46c2
permissions -rw-r--r--
8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables Summary: Used compiled-based TLS when available. Additional contributions by Thomas Stufe (AIX) and Andrew Haley (Aarch64) Reviewed-by: stuefe, bdelsart, dcubed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
34633
2a6c7c7b30a7 8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables
dholmes
parents: 33759
diff changeset
     2
 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3261
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_UTILITIES_GLOBALDEFINITIONS_VISCPP_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_UTILITIES_GLOBALDEFINITIONS_VISCPP_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "prims/jni.h"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
// This file holds compiler-dependent includes,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// globally used constants & types, class (forward)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// declarations and a few frequently used utility functions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
# include <ctype.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
# include <string.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
# include <stdarg.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
# include <stdlib.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
# include <stddef.h>// for offsetof
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
# include <io.h>    // for stream.cpp
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
# include <float.h> // for _isnan
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
# include <stdio.h> // for va_list
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
# include <time.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
# include <fcntl.h>
8481
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
    44
# include <limits.h>
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
// Need this on windows to get the math constants (e.g., M_PI).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
#define _USE_MATH_DEFINES
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
# include <math.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
// 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
// system header files.  On 32-bit architectures, there is no problem.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
// On 64-bit architectures, defining NULL as a 32-bit constant can cause
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
// problems with varargs functions: C++ integral promotion rules say for
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
// varargs, we pass the argument 0 as an int.  So, if NULL was passed to a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
// varargs function it will remain 32-bits.  Depending on the calling
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
// convention of the machine, if the argument is passed on the stack then
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
// only 32-bits of the "NULL" pointer may be initialized to zero.  The
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
// other 32-bits will be garbage.  If the varargs function is expecting a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
// pointer when it extracts the argument, then we may have a problem.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
// Solution: For 64-bit architectures, redefine NULL as 64-bit constant 0.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
#undef NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
// 64-bit Windows uses a P64 data model (not LP64, although we define _LP64)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
// Since longs are 32-bit we cannot use 0L here.  Use the Visual C++ specific
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
// 64-bit integer-suffix (i64) instead.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
#define NULL 0i64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
#ifndef NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
#define NULL 0
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
// NULL vs NULL_WORD:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
// On Linux NULL is defined as a special type '__null'. Assigning __null to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
// integer variable will cause gcc warning. Use NULL_WORD in places where a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
// pointer is stored as integer value.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
#define NULL_WORD NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
// Compiler-specific primitive types
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
typedef unsigned __int8  uint8_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
typedef unsigned __int16 uint16_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
typedef unsigned __int32 uint32_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
typedef unsigned __int64 uint64_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
typedef unsigned __int64 uintptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
typedef unsigned int uintptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
typedef signed   __int8  int8_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
typedef signed   __int16 int16_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
typedef signed   __int32 int32_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
typedef signed   __int64 int64_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
typedef signed   __int64 intptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
typedef signed   __int64 ssize_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
typedef signed   int intptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
typedef signed   int ssize_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
8481
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   103
#ifndef UINTPTR_MAX
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   104
#ifdef _WIN64
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   105
#define UINTPTR_MAX _UI64_MAX
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   106
#else
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   107
#define UINTPTR_MAX _UI32_MAX
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   108
#endif
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   109
#endif
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   110
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
//----------------------------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
// Additional Java basic types
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
typedef unsigned char    jubyte;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
typedef unsigned short   jushort;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
typedef unsigned int     juint;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
typedef unsigned __int64 julong;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
//----------------------------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
// Non-standard stdlib-like stuff:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
inline int strcasecmp(const char *s1, const char *s2) { return _stricmp(s1,s2); }
11596
3b9802e6c6a2 7131346: Parsing of boolean arguments to diagnostic commands is broken
fparain
parents: 10565
diff changeset
   123
inline int strncasecmp(const char *s1, const char *s2, size_t n) {
3b9802e6c6a2 7131346: Parsing of boolean arguments to diagnostic commands is broken
fparain
parents: 10565
diff changeset
   124
  return _strnicmp(s1,s2,n);
3b9802e6c6a2 7131346: Parsing of boolean arguments to diagnostic commands is broken
fparain
parents: 10565
diff changeset
   125
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
//----------------------------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
// Debugging
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
#if _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
extern "C" void breakpoint();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
#define BREAKPOINT ::breakpoint()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
#define BREAKPOINT __asm { int 3 }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
//----------------------------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
// Checking for nanness
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
inline int g_isnan(jfloat  f)                    { return _isnan(f); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
inline int g_isnan(jdouble f)                    { return _isnan(f); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
//----------------------------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
// Checking for finiteness
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
inline int g_isfinite(jfloat  f)                 { return _finite(f); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
inline int g_isfinite(jdouble f)                 { return _finite(f); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
//----------------------------------------------------------------------------------------------------
32393
4406de22d8ce 8133625: src/share/vm/opto/compile.hpp:96: error: integer constant is too large for ‘long’ type
zmajo
parents: 27471
diff changeset
   151
// Constant for jlong (specifying a long long constant is C++ compiler specific)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
32393
4406de22d8ce 8133625: src/share/vm/opto/compile.hpp:96: error: integer constant is too large for ‘long’ type
zmajo
parents: 27471
diff changeset
   153
// Build a 64bit integer constant with Visual C++
27471
6e56277909f1 8062370: Various minor code improvements
goetz
parents: 25918
diff changeset
   154
#define  CONST64(x) (x ##  i64)
6e56277909f1 8062370: Various minor code improvements
goetz
parents: 25918
diff changeset
   155
#define UCONST64(x) (x ## ui64)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
27471
6e56277909f1 8062370: Various minor code improvements
goetz
parents: 25918
diff changeset
   157
const jlong min_jlong = (jlong)UCONST64(0x8000000000000000);
6e56277909f1 8062370: Various minor code improvements
goetz
parents: 25918
diff changeset
   158
const jlong max_jlong =         CONST64(0x7fffffffffffffff);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
//----------------------------------------------------------------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
// Miscellaneous
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
// Visual Studio 2005 deprecates POSIX names - use ISO C++ names instead
2257
d8e6e11e7f32 6816308: Changes to allow builds with latest Windows SDK 6.1 on 64bit Windows 2003
kvn
parents: 1
diff changeset
   164
#if _MSC_VER >= 1400
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
#define open _open
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
#define close _close
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
#define read  _read
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
#define write _write
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
#define lseek _lseek
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
#define unlink _unlink
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
#define strdup _strdup
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
33759
8a0e9139a9c5 8141134: Remove unnecessary pragma warning(disable:4355) from GC code
tschatzl
parents: 33137
diff changeset
   174
#if _MSC_VER < 1800
33137
81433d2db1c9 8137329: [windows] Build broken on VS2010 after "8046148: JEP 158: Unified JVM Logging"
stuefe
parents: 32393
diff changeset
   175
// Visual Studio 2013 introduced strtoull(); before, one has to use _strtoui64() instead.
81433d2db1c9 8137329: [windows] Build broken on VS2010 after "8046148: JEP 158: Unified JVM Logging"
stuefe
parents: 32393
diff changeset
   176
#define strtoull _strtoui64
33759
8a0e9139a9c5 8141134: Remove unnecessary pragma warning(disable:4355) from GC code
tschatzl
parents: 33137
diff changeset
   177
// Fixes some wrong warnings about 'this' : used in base member initializer list
8a0e9139a9c5 8141134: Remove unnecessary pragma warning(disable:4355) from GC code
tschatzl
parents: 33137
diff changeset
   178
#pragma warning( disable : 4355 )
33137
81433d2db1c9 8137329: [windows] Build broken on VS2010 after "8046148: JEP 158: Unified JVM Logging"
stuefe
parents: 32393
diff changeset
   179
#endif
81433d2db1c9 8137329: [windows] Build broken on VS2010 after "8046148: JEP 158: Unified JVM Logging"
stuefe
parents: 32393
diff changeset
   180
81433d2db1c9 8137329: [windows] Build broken on VS2010 after "8046148: JEP 158: Unified JVM Logging"
stuefe
parents: 32393
diff changeset
   181
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
#pragma warning( disable : 4100 ) // unreferenced formal parameter
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
#pragma warning( disable : 4127 ) // conditional expression is constant
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
#pragma warning( disable : 4514 ) // unreferenced inline function has been removed
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
#pragma warning( disable : 4244 ) // possible loss of data
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
#pragma warning( disable : 4512 ) // assignment operator could not be generated
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
#pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union (needed in windows.h)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
#pragma warning( disable : 4511 ) // copy constructor could not be generated
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
#pragma warning( disable : 4291 ) // no matching operator delete found; memory will not be freed if initialization thows an exception
20282
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 13963
diff changeset
   190
#ifdef CHECK_UNHANDLED_OOPS
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 13963
diff changeset
   191
#pragma warning( disable : 4521 ) // class has multiple copy ctors of a single type
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 13963
diff changeset
   192
#pragma warning( disable : 4522 ) // class has multiple assignment operators of a single type
7f9cbdf89af2 7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents: 13963
diff changeset
   193
#endif // CHECK_UNHANDLED_OOPS
2271
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 2257
diff changeset
   194
#if _MSC_VER >= 1400
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 2257
diff changeset
   195
#pragma warning( disable : 4996 ) // unsafe string functions. Same as define _CRT_SECURE_NO_WARNINGS/_CRT_SECURE_NO_DEPRICATE
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 2257
diff changeset
   196
#endif
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 2257
diff changeset
   197
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 2257
diff changeset
   198
inline int vsnprintf(char* buf, size_t count, const char* fmt, va_list argptr) {
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 2257
diff changeset
   199
  // If number of characters written == count, Windows doesn't write a
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 2257
diff changeset
   200
  // terminating NULL, so we do it ourselves.
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 2257
diff changeset
   201
  int ret = _vsnprintf(buf, count, fmt, argptr);
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 2257
diff changeset
   202
  if (count > 0) buf[count-1] = '\0';
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 2257
diff changeset
   203
  return ret;
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 2257
diff changeset
   204
}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
// Portability macros
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
#define PRAGMA_INTERFACE
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
#define PRAGMA_IMPLEMENTATION
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
#define PRAGMA_IMPLEMENTATION_(arg)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
#define VALUE_OBJ_CLASS_SPEC    : public _ValueObj
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
// Formatting.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
#define FORMAT64_MODIFIER "I64"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   215
// Visual Studio doesn't provide inttypes.h so provide appropriate definitions here.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   216
// The 32 bits ones might need I32 but seem to work ok without it.
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   217
#define PRId32       "d"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   218
#define PRIu32       "u"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   219
#define PRIx32       "x"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   220
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   221
#define PRId64       "I64d"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   222
#define PRIu64       "I64u"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   223
#define PRIx64       "I64x"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   224
12941
a4a325a315c1 7172708: 32/64 bit type issues on Windows after Mac OS X port
dholmes
parents: 11596
diff changeset
   225
#ifdef _LP64
a4a325a315c1 7172708: 32/64 bit type issues on Windows after Mac OS X port
dholmes
parents: 11596
diff changeset
   226
#define PRIdPTR       "I64d"
a4a325a315c1 7172708: 32/64 bit type issues on Windows after Mac OS X port
dholmes
parents: 11596
diff changeset
   227
#define PRIuPTR       "I64u"
a4a325a315c1 7172708: 32/64 bit type issues on Windows after Mac OS X port
dholmes
parents: 11596
diff changeset
   228
#define PRIxPTR       "I64x"
a4a325a315c1 7172708: 32/64 bit type issues on Windows after Mac OS X port
dholmes
parents: 11596
diff changeset
   229
#else
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   230
#define PRIdPTR       "d"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   231
#define PRIuPTR       "u"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   232
#define PRIxPTR       "x"
12941
a4a325a315c1 7172708: 32/64 bit type issues on Windows after Mac OS X port
dholmes
parents: 11596
diff changeset
   233
#endif
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
   234
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
#define offset_of(klass,field) offsetof(klass,field)
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   236
34633
2a6c7c7b30a7 8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables
dholmes
parents: 33759
diff changeset
   237
#ifndef USE_LIBRARY_BASED_TLS_ONLY
2a6c7c7b30a7 8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables
dholmes
parents: 33759
diff changeset
   238
#define THREAD_LOCAL_DECL __declspec( thread )
2a6c7c7b30a7 8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables
dholmes
parents: 33759
diff changeset
   239
#endif
2a6c7c7b30a7 8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables
dholmes
parents: 33759
diff changeset
   240
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   241
#endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_VISCPP_HPP