src/hotspot/share/utilities/globalDefinitions_solstudio.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 53130 106fc138542a
child 58124 dc792fa77da0
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53130
106fc138542a 8215644: Clean up globalDefinitions_<compiler>.hpp
hseigel
parents: 51605
diff changeset
     2
 * Copyright (c) 1997, 2019, 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: 2105
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 2105
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: 2105
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
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53130
diff changeset
    25
#ifndef SHARE_UTILITIES_GLOBALDEFINITIONS_SOLSTUDIO_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53130
diff changeset
    26
#define SHARE_UTILITIES_GLOBALDEFINITIONS_SOLSTUDIO_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
47659
a8e9aff89f7b 8189608: Remove duplicated jni.h
ihse
parents: 47216
diff changeset
    28
#include "jni.h"
7397
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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
# include <ctype.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
# include <string.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
# include <strings.h>     // for bsd'isms
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
# include <stdarg.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
# include <stddef.h>      // for offsetof
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
# include <stdio.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
# include <stdlib.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
# include <wchar.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
# include <stdarg.h>
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
    44
#ifdef SOLARIS
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
# include <ieeefp.h>
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
    46
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
# include <math.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
# include <time.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
# include <fcntl.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
# include <dlfcn.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
# include <pthread.h>
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
    52
#ifdef SOLARIS
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
# include <thread.h>
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
    54
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
# include <limits.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
# include <errno.h>
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
    57
#ifdef SOLARIS
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
# include <sys/trap.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
# include <sys/regset.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
# include <sys/procset.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
# include <ucontext.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
# include <setjmp.h>
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
    63
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
# ifdef SOLARIS_MUTATOR_LIBTHREAD
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
# include <sys/procfs.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
# endif
10565
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    67
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    68
#include <inttypes.h>
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    69
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    70
// Solaris 8 doesn't provide definitions of these
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    71
#ifdef SOLARIS
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    72
#ifndef PRIdPTR
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    73
#if defined(_LP64)
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    74
#define PRIdPTR                 "ld"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    75
#define PRIuPTR                 "lu"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    76
#define PRIxPTR                 "lx"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    77
#else
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    78
#define PRIdPTR                 "d"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    79
#define PRIuPTR                 "u"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    80
#define PRIxPTR                 "x"
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    81
#endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    82
#endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    83
#endif
dc90c239f4ec 7089790: integrate bsd-port changes
never
parents: 8921
diff changeset
    84
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
    85
#ifdef LINUX
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
    86
# include <signal.h>
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
    87
# include <ucontext.h>
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
    88
# include <sys/time.h>
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
    89
#endif
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
    90
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
// 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
// When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
// system header files.  On 32-bit architectures, there is no problem.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
// On 64-bit architectures, defining NULL as a 32-bit constant can cause
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
// problems with varargs functions: C++ integral promotion rules say for
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
// varargs, we pass the argument 0 as an int.  So, if NULL was passed to a
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
// varargs function it will remain 32-bits.  Depending on the calling
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
// convention of the machine, if the argument is passed on the stack then
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
// only 32-bits of the "NULL" pointer may be initialized to zero.  The
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
// other 32-bits will be garbage.  If the varargs function is expecting a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
// pointer when it extracts the argument, then we have a problem.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
// Solution: For 64-bit architectures, redefine NULL as 64-bit constant 0.
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   105
//
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   106
// Note: this fix doesn't work well on Linux because NULL will be overwritten
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   107
// whenever a system header file is included. Linux handles NULL correctly
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   108
// through a special type '__null'.
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   109
#ifdef SOLARIS
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
#undef NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
#define NULL 0L
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
#ifndef NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
#define NULL 0
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
#endif
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   118
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
// NULL vs NULL_WORD:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
// On Linux NULL is defined as a special type '__null'. Assigning __null to
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
// integer variable will cause gcc warning. Use NULL_WORD in places where a
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   123
// pointer is stored as integer value. On some platforms, sizeof(intptr_t) >
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   124
// sizeof(void*), so here we want something which is integer type, but has the
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   125
// same size as a pointer.
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   126
#ifdef LINUX
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   127
  #ifdef _LP64
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   128
    #define NULL_WORD  0L
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   129
  #else
1888
bbf498fb4354 6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents: 670
diff changeset
   130
    // Cast 0 to intptr_t rather than int32_t since they are not the same type
bbf498fb4354 6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents: 670
diff changeset
   131
    // on some platforms.
bbf498fb4354 6787106: Hotspot 32 bit build fails on platforms having different definitions for intptr_t & int32_t
xlu
parents: 670
diff changeset
   132
    #define NULL_WORD  ((intptr_t)0)
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   133
  #endif
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   134
#else
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   135
  #define NULL_WORD  NULL
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   136
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   138
#ifndef LINUX
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
// Compiler-specific primitive types
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
typedef unsigned short     uint16_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
#ifndef _UINT32_T
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
#define _UINT32_T
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
typedef unsigned int       uint32_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
#if !defined(_SYS_INT_TYPES_H)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
#ifndef _UINT64_T
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
#define _UINT64_T
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
typedef unsigned long long uint64_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
// %%%% how to access definition of intptr_t portably in 5.5 onward?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
typedef int                     intptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
typedef unsigned int            uintptr_t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
// If this gets an error, figure out a symbol XXX that implies the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
// prior definition of intptr_t, and add "&& !defined(XXX)" above.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
#endif
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   156
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
8481
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   158
// On solaris 8, UINTPTR_MAX is defined as empty.
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   159
// Everywhere else it's an actual value.
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   160
#if UINTPTR_MAX - 1 == -1
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   161
#undef UINTPTR_MAX
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   162
#ifdef _LP64
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   163
#define UINTPTR_MAX UINT64_MAX
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   164
#else
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   165
#define UINTPTR_MAX UINT32_MAX
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   166
#endif /* ifdef _LP64 */
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   167
#endif
42a79b703814 6878713: Verifier heap corruption, relating to backward jsrs
kamg
parents: 7397
diff changeset
   168
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
// Additional Java basic types
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
typedef unsigned char      jubyte;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
typedef unsigned short     jushort;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
typedef unsigned int       juint;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
typedef unsigned long long julong;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   177
#ifdef SOLARIS
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
// ANSI C++ fixes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
// NOTE:In the ANSI committee's continuing attempt to make each version
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
// of C++ incompatible with the previous version, you can no longer cast
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
// pointers to functions without specifying linkage unless you want to get
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
// warnings.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
// This also means that pointers to functions can no longer be "hidden"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
// in opaque types like void * because at the invokation point warnings
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
// will be generated. While this makes perfect sense from a type safety
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
// point of view it causes a lot of warnings on old code using C header
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
// files. Here are some typedefs to make the job of silencing warnings
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
// a bit easier.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
// The final kick in the teeth is that you can only have extern "C" linkage
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
// specified at file scope. So these typedefs are here rather than in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
// .hpp for the class (os:Solaris usually) that needs them.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
extern "C" {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
   typedef int (*int_fnP_thread_t_iP_uP_stack_tP_gregset_t)(thread_t, int*, unsigned *, stack_t*, gregset_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
   typedef int (*int_fnP_thread_t_i_gregset_t)(thread_t, int, gregset_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
   typedef int (*int_fnP_thread_t_i)(thread_t, int);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
   typedef int (*int_fnP_thread_t)(thread_t);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
   typedef int (*int_fnP_cond_tP_mutex_tP_timestruc_tP)(cond_t *cv, mutex_t *mx, timestruc_t *abst);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
   typedef int (*int_fnP_cond_tP_mutex_tP)(cond_t *cv, mutex_t *mx);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
   // typedef for missing API in libc
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
   typedef int (*int_fnP_mutex_tP_i_vP)(mutex_t *, int, void *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
   typedef int (*int_fnP_mutex_tP)(mutex_t *);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
   typedef int (*int_fnP_cond_tP_i_vP)(cond_t *cv, int scope, void *arg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
   typedef int (*int_fnP_cond_tP)(cond_t *cv);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
};
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   210
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
// checking for nanness
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   213
#ifdef SOLARIS
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
#ifdef SPARC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
inline int g_isnan(float  f) { return isnanf(f); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
// isnanf() broken on Intel Solaris use isnand()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
inline int g_isnan(float  f) { return isnand(f); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
inline int g_isnan(double f) { return isnand(f); }
223
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   222
#elif LINUX
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   223
inline int g_isnan(float  f) { return isnanf(f); }
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   224
inline int g_isnan(double f) { return isnan(f); }
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   225
#else
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   226
#error "missing platform-specific definition here"
5c3b023117d9 6452081: 3/4 Allow for Linux builds with Sun Studio Linux compilers
dcubed
parents: 1
diff changeset
   227
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
// Checking for finiteness
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
inline int g_isfinite(jfloat  f)                 { return finite(f); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
inline int g_isfinite(jdouble f)                 { return finite(f); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
// Wide characters
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
// Formatting.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
#define FORMAT64_MODIFIER "l"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
#else // !_LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
#define FORMAT64_MODIFIER "ll"
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
#endif // _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
#define offset_of(klass,field) offsetof(klass,field)
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   247
34633
2a6c7c7b30a7 8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables
dholmes
parents: 32393
diff changeset
   248
#ifndef USE_LIBRARY_BASED_TLS_ONLY
2a6c7c7b30a7 8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables
dholmes
parents: 32393
diff changeset
   249
#define THREAD_LOCAL_DECL __thread
2a6c7c7b30a7 8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables
dholmes
parents: 32393
diff changeset
   250
#endif
2a6c7c7b30a7 8132510: Replace ThreadLocalStorage with compiler/language-based thread-local variables
dholmes
parents: 32393
diff changeset
   251
37092
0e56e3c9d545 8151593: Cleanup definition/usage of INLINE/NOINLINE macros and add xlC support
simonis
parents: 34633
diff changeset
   252
// Inlining support
0e56e3c9d545 8151593: Cleanup definition/usage of INLINE/NOINLINE macros and add xlC support
simonis
parents: 34633
diff changeset
   253
#define NOINLINE
39405
314741ca98d5 8153743: AllocateHeap() and ReallocateHeap() should use ALWAYSINLINE macro
ysuenaga
parents: 37092
diff changeset
   254
#define ALWAYSINLINE inline __attribute__((always_inline))
37092
0e56e3c9d545 8151593: Cleanup definition/usage of INLINE/NOINLINE macros and add xlC support
simonis
parents: 34633
diff changeset
   255
50120
9da00197ff72 8203220: Introduce ATTRIBUTE_ALIGNED macro
pliden
parents: 49392
diff changeset
   256
// Alignment
9da00197ff72 8203220: Introduce ATTRIBUTE_ALIGNED macro
pliden
parents: 49392
diff changeset
   257
#define ATTRIBUTE_ALIGNED(x) __attribute__((aligned(x)))
9da00197ff72 8203220: Introduce ATTRIBUTE_ALIGNED macro
pliden
parents: 49392
diff changeset
   258
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 53130
diff changeset
   259
#endif // SHARE_UTILITIES_GLOBALDEFINITIONS_SOLSTUDIO_HPP