Tue, 29 Jul 2014 13:54:16 +0200
8040121: Load variable through a pointer of an incompatible type in src/hotspot/src/share/vm: opto/output.cpp, runtime/sharedRuntimeTrans.cpp, utilities/globalDefinitions_visCPP.hpp
Summary: Fixed parfait warnings in globalDefinitions files by using a union for casts.
Reviewed-by: kvn
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 | #ifndef FP_PZERO |
aoqi@0 | 45 | // Linux doesn't have positive/negative zero |
aoqi@0 | 46 | #define FP_PZERO FP_ZERO |
aoqi@0 | 47 | #endif |
aoqi@0 | 48 | #if (!defined fpclass) |
aoqi@0 | 49 | #define fpclass fpclassify |
aoqi@0 | 50 | #endif |
aoqi@0 | 51 | |
aoqi@0 | 52 | #include <time.h> |
aoqi@0 | 53 | #include <fcntl.h> |
aoqi@0 | 54 | #include <dlfcn.h> |
aoqi@0 | 55 | #include <pthread.h> |
aoqi@0 | 56 | |
aoqi@0 | 57 | #include <limits.h> |
aoqi@0 | 58 | #include <errno.h> |
aoqi@0 | 59 | |
aoqi@0 | 60 | #include <stdint.h> |
aoqi@0 | 61 | |
aoqi@0 | 62 | // Use XLC compiler builtins instead of inline assembler |
aoqi@0 | 63 | #define USE_XLC_BUILTINS |
aoqi@0 | 64 | #ifdef USE_XLC_BUILTINS |
aoqi@0 | 65 | #include <builtins.h> |
aoqi@0 | 66 | #if __IBMCPP__ < 1000 |
aoqi@0 | 67 | // the funtion prototype for __dcbtst(void *) is missing in XLC V8.0 |
aoqi@0 | 68 | // I could compile a little test, where I provided the prototype. |
aoqi@0 | 69 | // The generated code was correct there. This is the prototype: |
aoqi@0 | 70 | // extern "builtin" void __dcbtst (void *); |
aoqi@0 | 71 | // For now we don't make use of it when compiling with XLC V8.0 |
aoqi@0 | 72 | #else |
aoqi@0 | 73 | // __IBMCPP__ >= 1000 |
aoqi@0 | 74 | // XLC V10 provides the prototype for __dcbtst (void *); |
aoqi@0 | 75 | #define USE_XLC_PREFETCH_WRITE_BUILTIN |
aoqi@0 | 76 | #endif |
aoqi@0 | 77 | #endif // USE_XLC_BUILTINS |
aoqi@0 | 78 | |
aoqi@0 | 79 | // NULL vs NULL_WORD: |
aoqi@0 | 80 | // On Linux NULL is defined as a special type '__null'. Assigning __null to |
aoqi@0 | 81 | // integer variable will cause gcc warning. Use NULL_WORD in places where a |
aoqi@0 | 82 | // pointer is stored as integer value. On some platforms, sizeof(intptr_t) > |
aoqi@0 | 83 | // sizeof(void*), so here we want something which is integer type, but has the |
aoqi@0 | 84 | // same size as a pointer. |
aoqi@0 | 85 | #ifdef __GNUC__ |
aoqi@0 | 86 | #error XLC and __GNUC__? |
aoqi@0 | 87 | #else |
aoqi@0 | 88 | #define NULL_WORD NULL |
aoqi@0 | 89 | #endif |
aoqi@0 | 90 | |
aoqi@0 | 91 | // AIX also needs a 64 bit NULL to work as a null address pointer. |
aoqi@0 | 92 | // Most system includes on AIX would define it as an int 0 if not already defined with one |
aoqi@0 | 93 | // exception: /usr/include/dirent.h will unconditionally redefine NULL to int 0 again. |
aoqi@0 | 94 | // In this case you need to copy the following defines to a position after #include <dirent.h> |
aoqi@0 | 95 | // (see jmv_aix.h). |
aoqi@0 | 96 | #ifdef AIX |
aoqi@0 | 97 | #ifdef _LP64 |
aoqi@0 | 98 | #undef NULL |
aoqi@0 | 99 | #define NULL 0L |
aoqi@0 | 100 | #else |
aoqi@0 | 101 | #ifndef NULL |
aoqi@0 | 102 | #define NULL 0 |
aoqi@0 | 103 | #endif |
aoqi@0 | 104 | #endif |
aoqi@0 | 105 | #endif // AIX |
aoqi@0 | 106 | |
aoqi@0 | 107 | // Compiler-specific primitive types |
aoqi@0 | 108 | // All defs of int (uint16_6 etc) are defined in AIX' /usr/include/stdint.h |
aoqi@0 | 109 | |
aoqi@0 | 110 | // Additional Java basic types |
aoqi@0 | 111 | |
aoqi@0 | 112 | typedef uint8_t jubyte; |
aoqi@0 | 113 | typedef uint16_t jushort; |
aoqi@0 | 114 | typedef uint32_t juint; |
aoqi@0 | 115 | typedef uint64_t julong; |
aoqi@0 | 116 | |
aoqi@0 | 117 | |
aoqi@0 | 118 | //---------------------------------------------------------------------------------------------------- |
aoqi@0 | 119 | // Constant for jlong (specifying an long long canstant is C++ compiler specific) |
aoqi@0 | 120 | |
aoqi@0 | 121 | // Build a 64bit integer constant |
aoqi@0 | 122 | #define CONST64(x) (x ## LL) |
aoqi@0 | 123 | #define UCONST64(x) (x ## ULL) |
aoqi@0 | 124 | |
aoqi@0 | 125 | const jlong min_jlong = CONST64(0x8000000000000000); |
aoqi@0 | 126 | const jlong max_jlong = CONST64(0x7fffffffffffffff); |
aoqi@0 | 127 | |
aoqi@0 | 128 | //---------------------------------------------------------------------------------------------------- |
aoqi@0 | 129 | // Debugging |
aoqi@0 | 130 | |
aoqi@0 | 131 | #define DEBUG_EXCEPTION ::abort(); |
aoqi@0 | 132 | |
aoqi@0 | 133 | extern "C" void breakpoint(); |
aoqi@0 | 134 | #define BREAKPOINT ::breakpoint() |
aoqi@0 | 135 | |
aoqi@0 | 136 | // checking for nanness |
aoqi@0 | 137 | #ifdef AIX |
aoqi@0 | 138 | inline int g_isnan(float f) { return isnan(f); } |
aoqi@0 | 139 | inline int g_isnan(double f) { return isnan(f); } |
aoqi@0 | 140 | #else |
aoqi@0 | 141 | #error "missing platform-specific definition here" |
aoqi@0 | 142 | #endif |
aoqi@0 | 143 | |
aoqi@0 | 144 | // Checking for finiteness |
aoqi@0 | 145 | |
aoqi@0 | 146 | inline int g_isfinite(jfloat f) { return finite(f); } |
aoqi@0 | 147 | inline int g_isfinite(jdouble f) { return finite(f); } |
aoqi@0 | 148 | |
aoqi@0 | 149 | |
aoqi@0 | 150 | // Wide characters |
aoqi@0 | 151 | |
aoqi@0 | 152 | inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); } |
aoqi@0 | 153 | |
aoqi@0 | 154 | |
aoqi@0 | 155 | // Portability macros |
aoqi@0 | 156 | #define PRAGMA_INTERFACE #pragma interface |
aoqi@0 | 157 | #define PRAGMA_IMPLEMENTATION #pragma implementation |
aoqi@0 | 158 | #define VALUE_OBJ_CLASS_SPEC |
aoqi@0 | 159 | |
aoqi@0 | 160 | // Formatting. |
aoqi@0 | 161 | #ifdef _LP64 |
aoqi@0 | 162 | #define FORMAT64_MODIFIER "l" |
aoqi@0 | 163 | #else // !_LP64 |
aoqi@0 | 164 | #define FORMAT64_MODIFIER "ll" |
aoqi@0 | 165 | #endif // _LP64 |
aoqi@0 | 166 | |
aoqi@0 | 167 | // Cannot use xlc's offsetof as implementation of hotspot's |
aoqi@0 | 168 | // offset_of(), because xlc warns about applying offsetof() to non-POD |
aoqi@0 | 169 | // object and xlc cannot compile the expression offsetof(DataLayout, |
aoqi@0 | 170 | // _cells[index]) in DataLayout::cell_offset() . Therefore we define |
aoqi@0 | 171 | // offset_of as it is defined for gcc. |
aoqi@0 | 172 | #define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16) |
aoqi@0 | 173 | |
aoqi@0 | 174 | // Some constant sizes used throughout the AIX port |
aoqi@0 | 175 | #define SIZE_1K ((uint64_t) 0x400ULL) |
aoqi@0 | 176 | #define SIZE_4K ((uint64_t) 0x1000ULL) |
aoqi@0 | 177 | #define SIZE_64K ((uint64_t) 0x10000ULL) |
aoqi@0 | 178 | #define SIZE_1M ((uint64_t) 0x100000ULL) |
aoqi@0 | 179 | #define SIZE_4M ((uint64_t) 0x400000ULL) |
aoqi@0 | 180 | #define SIZE_8M ((uint64_t) 0x800000ULL) |
aoqi@0 | 181 | #define SIZE_16M ((uint64_t) 0x1000000ULL) |
aoqi@0 | 182 | #define SIZE_256M ((uint64_t) 0x10000000ULL) |
aoqi@0 | 183 | #define SIZE_1G ((uint64_t) 0x40000000ULL) |
aoqi@0 | 184 | #define SIZE_2G ((uint64_t) 0x80000000ULL) |
aoqi@0 | 185 | #define SIZE_4G ((uint64_t) 0x100000000ULL) |
aoqi@0 | 186 | #define SIZE_16G ((uint64_t) 0x400000000ULL) |
aoqi@0 | 187 | #define SIZE_32G ((uint64_t) 0x800000000ULL) |
aoqi@0 | 188 | #define SIZE_64G ((uint64_t) 0x1000000000ULL) |
aoqi@0 | 189 | #define SIZE_1T ((uint64_t) 0x10000000000ULL) |
aoqi@0 | 190 | |
aoqi@0 | 191 | |
aoqi@0 | 192 | #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP |