src/share/vm/utilities/globalDefinitions_xlc.hpp

Thu, 19 Mar 2015 19:53:34 +0100

author
zmajo
date
Thu, 19 Mar 2015 19:53:34 +0100
changeset 7638
aefa2e84b424
parent 7001
b6a8cc1e0d92
child 9858
b985cbb00e68
permissions
-rw-r--r--

8074869: C2 code generator can replace -0.0f with +0.0f on Linux
Summary: Instead of 'fpclass', use cast float->int and double->long to check if value is +0.0f and +0.0d, respectively.
Reviewed-by: kvn, simonis, dlong

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * Copyright 2012, 2013 SAP AG. All rights reserved.
aoqi@0 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 5 *
aoqi@0 6 * This code is free software; you can redistribute it and/or modify it
aoqi@0 7 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 8 * published by the Free Software Foundation.
aoqi@0 9 *
aoqi@0 10 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 13 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 14 * accompanied this code).
aoqi@0 15 *
aoqi@0 16 * You should have received a copy of the GNU General Public License version
aoqi@0 17 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 19 *
aoqi@0 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 21 * or visit www.oracle.com if you need additional information or have any
aoqi@0 22 * questions.
aoqi@0 23 *
aoqi@0 24 */
aoqi@0 25
aoqi@0 26 #ifndef SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP
aoqi@0 27 #define SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP
aoqi@0 28
aoqi@0 29 #include "prims/jni.h"
aoqi@0 30
aoqi@0 31 // This file holds compiler-dependent includes,
aoqi@0 32 // globally used constants & types, class (forward)
aoqi@0 33 // declarations and a few frequently used utility functions.
aoqi@0 34
aoqi@0 35 #include <ctype.h>
aoqi@0 36 #include <string.h>
aoqi@0 37 #include <stdarg.h>
aoqi@0 38 #include <stddef.h>
aoqi@0 39 #include <stdio.h>
aoqi@0 40 #include <stdlib.h>
aoqi@0 41 #include <wchar.h>
aoqi@0 42
aoqi@0 43 #include <math.h>
aoqi@0 44 #include <time.h>
aoqi@0 45 #include <fcntl.h>
aoqi@0 46 #include <dlfcn.h>
aoqi@0 47 #include <pthread.h>
aoqi@0 48
aoqi@0 49 #include <limits.h>
aoqi@0 50 #include <errno.h>
aoqi@0 51
aoqi@0 52 #include <stdint.h>
aoqi@0 53
aoqi@0 54 // Use XLC compiler builtins instead of inline assembler
aoqi@0 55 #define USE_XLC_BUILTINS
aoqi@0 56 #ifdef USE_XLC_BUILTINS
aoqi@0 57 #include <builtins.h>
aoqi@0 58 #if __IBMCPP__ < 1000
aoqi@0 59 // the funtion prototype for __dcbtst(void *) is missing in XLC V8.0
aoqi@0 60 // I could compile a little test, where I provided the prototype.
aoqi@0 61 // The generated code was correct there. This is the prototype:
aoqi@0 62 // extern "builtin" void __dcbtst (void *);
aoqi@0 63 // For now we don't make use of it when compiling with XLC V8.0
aoqi@0 64 #else
aoqi@0 65 // __IBMCPP__ >= 1000
aoqi@0 66 // XLC V10 provides the prototype for __dcbtst (void *);
aoqi@0 67 #define USE_XLC_PREFETCH_WRITE_BUILTIN
aoqi@0 68 #endif
aoqi@0 69 #endif // USE_XLC_BUILTINS
aoqi@0 70
aoqi@0 71 // NULL vs NULL_WORD:
aoqi@0 72 // On Linux NULL is defined as a special type '__null'. Assigning __null to
aoqi@0 73 // integer variable will cause gcc warning. Use NULL_WORD in places where a
aoqi@0 74 // pointer is stored as integer value. On some platforms, sizeof(intptr_t) >
aoqi@0 75 // sizeof(void*), so here we want something which is integer type, but has the
aoqi@0 76 // same size as a pointer.
aoqi@0 77 #ifdef __GNUC__
aoqi@0 78 #error XLC and __GNUC__?
aoqi@0 79 #else
aoqi@0 80 #define NULL_WORD NULL
aoqi@0 81 #endif
aoqi@0 82
aoqi@0 83 // AIX also needs a 64 bit NULL to work as a null address pointer.
aoqi@0 84 // Most system includes on AIX would define it as an int 0 if not already defined with one
aoqi@0 85 // exception: /usr/include/dirent.h will unconditionally redefine NULL to int 0 again.
aoqi@0 86 // In this case you need to copy the following defines to a position after #include <dirent.h>
aoqi@0 87 // (see jmv_aix.h).
aoqi@0 88 #ifdef AIX
aoqi@0 89 #ifdef _LP64
aoqi@0 90 #undef NULL
aoqi@0 91 #define NULL 0L
aoqi@0 92 #else
aoqi@0 93 #ifndef NULL
aoqi@0 94 #define NULL 0
aoqi@0 95 #endif
aoqi@0 96 #endif
aoqi@0 97 #endif // AIX
aoqi@0 98
aoqi@0 99 // Compiler-specific primitive types
aoqi@0 100 // All defs of int (uint16_6 etc) are defined in AIX' /usr/include/stdint.h
aoqi@0 101
aoqi@0 102 // Additional Java basic types
aoqi@0 103
aoqi@0 104 typedef uint8_t jubyte;
aoqi@0 105 typedef uint16_t jushort;
aoqi@0 106 typedef uint32_t juint;
aoqi@0 107 typedef uint64_t julong;
aoqi@0 108
aoqi@0 109
aoqi@0 110 //----------------------------------------------------------------------------------------------------
aoqi@0 111 // Constant for jlong (specifying an long long canstant is C++ compiler specific)
aoqi@0 112
aoqi@0 113 // Build a 64bit integer constant
aoqi@0 114 #define CONST64(x) (x ## LL)
aoqi@0 115 #define UCONST64(x) (x ## ULL)
aoqi@0 116
aoqi@0 117 const jlong min_jlong = CONST64(0x8000000000000000);
aoqi@0 118 const jlong max_jlong = CONST64(0x7fffffffffffffff);
aoqi@0 119
aoqi@0 120 //----------------------------------------------------------------------------------------------------
aoqi@0 121 // Debugging
aoqi@0 122
aoqi@0 123 #define DEBUG_EXCEPTION ::abort();
aoqi@0 124
aoqi@0 125 extern "C" void breakpoint();
aoqi@0 126 #define BREAKPOINT ::breakpoint()
aoqi@0 127
aoqi@0 128 // checking for nanness
aoqi@0 129 #ifdef AIX
aoqi@0 130 inline int g_isnan(float f) { return isnan(f); }
aoqi@0 131 inline int g_isnan(double f) { return isnan(f); }
aoqi@0 132 #else
aoqi@0 133 #error "missing platform-specific definition here"
aoqi@0 134 #endif
aoqi@0 135
aoqi@0 136 // Checking for finiteness
aoqi@0 137
aoqi@0 138 inline int g_isfinite(jfloat f) { return finite(f); }
aoqi@0 139 inline int g_isfinite(jdouble f) { return finite(f); }
aoqi@0 140
aoqi@0 141
aoqi@0 142 // Wide characters
aoqi@0 143
aoqi@0 144 inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
aoqi@0 145
aoqi@0 146
aoqi@0 147 // Portability macros
aoqi@0 148 #define PRAGMA_INTERFACE #pragma interface
aoqi@0 149 #define PRAGMA_IMPLEMENTATION #pragma implementation
aoqi@0 150 #define VALUE_OBJ_CLASS_SPEC
aoqi@0 151
aoqi@0 152 // Formatting.
aoqi@0 153 #ifdef _LP64
aoqi@0 154 #define FORMAT64_MODIFIER "l"
aoqi@0 155 #else // !_LP64
aoqi@0 156 #define FORMAT64_MODIFIER "ll"
aoqi@0 157 #endif // _LP64
aoqi@0 158
aoqi@0 159 // Cannot use xlc's offsetof as implementation of hotspot's
aoqi@0 160 // offset_of(), because xlc warns about applying offsetof() to non-POD
aoqi@0 161 // object and xlc cannot compile the expression offsetof(DataLayout,
aoqi@0 162 // _cells[index]) in DataLayout::cell_offset() . Therefore we define
aoqi@0 163 // offset_of as it is defined for gcc.
aoqi@0 164 #define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16)
aoqi@0 165
aoqi@0 166 // Some constant sizes used throughout the AIX port
aoqi@0 167 #define SIZE_1K ((uint64_t) 0x400ULL)
aoqi@0 168 #define SIZE_4K ((uint64_t) 0x1000ULL)
aoqi@0 169 #define SIZE_64K ((uint64_t) 0x10000ULL)
aoqi@0 170 #define SIZE_1M ((uint64_t) 0x100000ULL)
aoqi@0 171 #define SIZE_4M ((uint64_t) 0x400000ULL)
aoqi@0 172 #define SIZE_8M ((uint64_t) 0x800000ULL)
aoqi@0 173 #define SIZE_16M ((uint64_t) 0x1000000ULL)
aoqi@0 174 #define SIZE_256M ((uint64_t) 0x10000000ULL)
aoqi@0 175 #define SIZE_1G ((uint64_t) 0x40000000ULL)
aoqi@0 176 #define SIZE_2G ((uint64_t) 0x80000000ULL)
aoqi@0 177 #define SIZE_4G ((uint64_t) 0x100000000ULL)
aoqi@0 178 #define SIZE_16G ((uint64_t) 0x400000000ULL)
aoqi@0 179 #define SIZE_32G ((uint64_t) 0x800000000ULL)
aoqi@0 180 #define SIZE_64G ((uint64_t) 0x1000000000ULL)
aoqi@0 181 #define SIZE_1T ((uint64_t) 0x10000000000ULL)
aoqi@0 182
aoqi@0 183
aoqi@0 184 #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP

mercurial