src/share/vm/utilities/globalDefinitions_xlc.hpp

changeset 6465
666e6ce3976c
parent 0
f90c822e73f8
child 7001
b6a8cc1e0d92
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/utilities/globalDefinitions_xlc.hpp	Fri Sep 06 20:16:09 2013 +0200
     1.3 @@ -0,0 +1,202 @@
     1.4 +/*
     1.5 + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright 2012, 2013 SAP AG. All rights reserved.
     1.7 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 + *
     1.9 + * This code is free software; you can redistribute it and/or modify it
    1.10 + * under the terms of the GNU General Public License version 2 only, as
    1.11 + * published by the Free Software Foundation.
    1.12 + *
    1.13 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 + * version 2 for more details (a copy is included in the LICENSE file that
    1.17 + * accompanied this code).
    1.18 + *
    1.19 + * You should have received a copy of the GNU General Public License version
    1.20 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.21 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 + *
    1.23 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 + * or visit www.oracle.com if you need additional information or have any
    1.25 + * questions.
    1.26 + *
    1.27 + */
    1.28 +
    1.29 +#ifndef SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP
    1.30 +#define SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP
    1.31 +
    1.32 +#include "prims/jni.h"
    1.33 +
    1.34 +// This file holds compiler-dependent includes,
    1.35 +// globally used constants & types, class (forward)
    1.36 +// declarations and a few frequently used utility functions.
    1.37 +
    1.38 +#include <ctype.h>
    1.39 +#include <string.h>
    1.40 +#include <stdarg.h>
    1.41 +#include <stddef.h>
    1.42 +#include <stdio.h>
    1.43 +#include <stdlib.h>
    1.44 +#include <wchar.h>
    1.45 +
    1.46 +#include <math.h>
    1.47 +#ifndef FP_PZERO
    1.48 +// Linux doesn't have positive/negative zero
    1.49 +#define FP_PZERO FP_ZERO
    1.50 +#endif
    1.51 +#if (!defined fpclass)
    1.52 +#define fpclass fpclassify
    1.53 +#endif
    1.54 +
    1.55 +#include <time.h>
    1.56 +#include <fcntl.h>
    1.57 +#include <dlfcn.h>
    1.58 +#include <pthread.h>
    1.59 +
    1.60 +#include <limits.h>
    1.61 +#include <errno.h>
    1.62 +
    1.63 +#include <stdint.h>
    1.64 +
    1.65 +// Use XLC compiler builtins instead of inline assembler
    1.66 +#define USE_XLC_BUILTINS
    1.67 +#ifdef USE_XLC_BUILTINS
    1.68 +#include <builtins.h>
    1.69 +  #if __IBMCPP__ < 1000
    1.70 +  // the funtion prototype for __dcbtst(void *) is missing in XLC V8.0
    1.71 +  // I could compile a little test, where I provided the prototype.
    1.72 +  // The generated code was correct there. This is the prototype:
    1.73 +  // extern "builtin" void __dcbtst (void *);
    1.74 +  // For now we don't make use of it when compiling with XLC V8.0
    1.75 +  #else
    1.76 +  // __IBMCPP__ >= 1000
    1.77 +  // XLC V10 provides the prototype for __dcbtst (void *);
    1.78 +  #define USE_XLC_PREFETCH_WRITE_BUILTIN
    1.79 +  #endif
    1.80 +#endif // USE_XLC_BUILTINS
    1.81 +
    1.82 +// NULL vs NULL_WORD:
    1.83 +// On Linux NULL is defined as a special type '__null'. Assigning __null to
    1.84 +// integer variable will cause gcc warning. Use NULL_WORD in places where a
    1.85 +// pointer is stored as integer value.  On some platforms, sizeof(intptr_t) >
    1.86 +// sizeof(void*), so here we want something which is integer type, but has the
    1.87 +// same size as a pointer.
    1.88 +#ifdef __GNUC__
    1.89 +  #error XLC and __GNUC__?
    1.90 +#else
    1.91 +  #define NULL_WORD  NULL
    1.92 +#endif
    1.93 +
    1.94 +// AIX also needs a 64 bit NULL to work as a null address pointer.
    1.95 +// Most system includes on AIX would define it as an int 0 if not already defined with one
    1.96 +// exception: /usr/include/dirent.h will unconditionally redefine NULL to int 0 again.
    1.97 +// In this case you need to copy the following defines to a position after #include <dirent.h>
    1.98 +// (see jmv_aix.h).
    1.99 +#ifdef AIX
   1.100 +  #ifdef _LP64
   1.101 +    #undef NULL
   1.102 +    #define NULL 0L
   1.103 +  #else
   1.104 +    #ifndef NULL
   1.105 +      #define NULL 0
   1.106 +    #endif
   1.107 +  #endif
   1.108 +#endif // AIX
   1.109 +
   1.110 +// Compiler-specific primitive types
   1.111 +// All defs of int (uint16_6 etc) are defined in AIX' /usr/include/stdint.h
   1.112 +
   1.113 +// Additional Java basic types
   1.114 +
   1.115 +typedef uint8_t  jubyte;
   1.116 +typedef uint16_t jushort;
   1.117 +typedef uint32_t juint;
   1.118 +typedef uint64_t julong;
   1.119 +
   1.120 +//----------------------------------------------------------------------------------------------------
   1.121 +// Special (possibly not-portable) casts
   1.122 +// Cast floats into same-size integers and vice-versa w/o changing bit-pattern
   1.123 +// %%%%%% These seem like standard C++ to me--how about factoring them out? - Ungar
   1.124 +
   1.125 +inline jint    jint_cast   (jfloat  x)           { return *(jint*   )&x; }
   1.126 +inline jlong   jlong_cast  (jdouble x)           { return *(jlong*  )&x; }
   1.127 +
   1.128 +inline jfloat  jfloat_cast (jint    x)           { return *(jfloat* )&x; }
   1.129 +inline jdouble jdouble_cast(jlong   x)           { return *(jdouble*)&x; }
   1.130 +
   1.131 +//----------------------------------------------------------------------------------------------------
   1.132 +// Constant for jlong (specifying an long long canstant is C++ compiler specific)
   1.133 +
   1.134 +// Build a 64bit integer constant
   1.135 +#define CONST64(x)  (x ## LL)
   1.136 +#define UCONST64(x) (x ## ULL)
   1.137 +
   1.138 +const jlong min_jlong = CONST64(0x8000000000000000);
   1.139 +const jlong max_jlong = CONST64(0x7fffffffffffffff);
   1.140 +
   1.141 +//----------------------------------------------------------------------------------------------------
   1.142 +// Debugging
   1.143 +
   1.144 +#define DEBUG_EXCEPTION ::abort();
   1.145 +
   1.146 +extern "C" void breakpoint();
   1.147 +#define BREAKPOINT ::breakpoint()
   1.148 +
   1.149 +// checking for nanness
   1.150 +#ifdef AIX
   1.151 +inline int g_isnan(float  f) { return isnan(f); }
   1.152 +inline int g_isnan(double f) { return isnan(f); }
   1.153 +#else
   1.154 +#error "missing platform-specific definition here"
   1.155 +#endif
   1.156 +
   1.157 +// Checking for finiteness
   1.158 +
   1.159 +inline int g_isfinite(jfloat  f)                 { return finite(f); }
   1.160 +inline int g_isfinite(jdouble f)                 { return finite(f); }
   1.161 +
   1.162 +
   1.163 +// Wide characters
   1.164 +
   1.165 +inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
   1.166 +
   1.167 +
   1.168 +// Portability macros
   1.169 +#define PRAGMA_INTERFACE             #pragma interface
   1.170 +#define PRAGMA_IMPLEMENTATION        #pragma implementation
   1.171 +#define VALUE_OBJ_CLASS_SPEC
   1.172 +
   1.173 +// Formatting.
   1.174 +#ifdef _LP64
   1.175 +#define FORMAT64_MODIFIER "l"
   1.176 +#else // !_LP64
   1.177 +#define FORMAT64_MODIFIER "ll"
   1.178 +#endif // _LP64
   1.179 +
   1.180 +// Cannot use xlc's offsetof as implementation of hotspot's
   1.181 +// offset_of(), because xlc warns about applying offsetof() to non-POD
   1.182 +// object and xlc cannot compile the expression offsetof(DataLayout,
   1.183 +// _cells[index]) in DataLayout::cell_offset() .  Therefore we define
   1.184 +// offset_of as it is defined for gcc.
   1.185 +#define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16)
   1.186 +
   1.187 +// Some constant sizes used throughout the AIX port
   1.188 +#define SIZE_1K   ((uint64_t)         0x400ULL)
   1.189 +#define SIZE_4K   ((uint64_t)        0x1000ULL)
   1.190 +#define SIZE_64K  ((uint64_t)       0x10000ULL)
   1.191 +#define SIZE_1M   ((uint64_t)      0x100000ULL)
   1.192 +#define SIZE_4M   ((uint64_t)      0x400000ULL)
   1.193 +#define SIZE_8M   ((uint64_t)      0x800000ULL)
   1.194 +#define SIZE_16M  ((uint64_t)     0x1000000ULL)
   1.195 +#define SIZE_256M ((uint64_t)    0x10000000ULL)
   1.196 +#define SIZE_1G   ((uint64_t)    0x40000000ULL)
   1.197 +#define SIZE_2G   ((uint64_t)    0x80000000ULL)
   1.198 +#define SIZE_4G   ((uint64_t)   0x100000000ULL)
   1.199 +#define SIZE_16G  ((uint64_t)   0x400000000ULL)
   1.200 +#define SIZE_32G  ((uint64_t)   0x800000000ULL)
   1.201 +#define SIZE_64G  ((uint64_t)  0x1000000000ULL)
   1.202 +#define SIZE_1T   ((uint64_t) 0x10000000000ULL)
   1.203 +
   1.204 +
   1.205 +#endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP

mercurial