aoqi@0: /* aoqi@0: * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. aoqi@0: * Copyright 2012, 2013 SAP AG. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: #ifndef SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP aoqi@0: #define SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP aoqi@0: aoqi@0: #include "prims/jni.h" aoqi@0: aoqi@0: // This file holds compiler-dependent includes, aoqi@0: // globally used constants & types, class (forward) aoqi@0: // declarations and a few frequently used utility functions. aoqi@0: aoqi@0: #include aoqi@0: #include aoqi@0: #include aoqi@0: #include aoqi@0: #include aoqi@0: #include aoqi@0: #include aoqi@0: aoqi@0: #include aoqi@0: #include aoqi@0: #include aoqi@0: #include aoqi@0: #include aoqi@0: aoqi@0: #include aoqi@0: #include aoqi@0: aoqi@0: #include aoqi@0: aoqi@0: // Use XLC compiler builtins instead of inline assembler aoqi@0: #define USE_XLC_BUILTINS aoqi@0: #ifdef USE_XLC_BUILTINS aoqi@0: #include aoqi@0: #if __IBMCPP__ < 1000 aoqi@0: // the funtion prototype for __dcbtst(void *) is missing in XLC V8.0 aoqi@0: // I could compile a little test, where I provided the prototype. aoqi@0: // The generated code was correct there. This is the prototype: aoqi@0: // extern "builtin" void __dcbtst (void *); aoqi@0: // For now we don't make use of it when compiling with XLC V8.0 aoqi@0: #else aoqi@0: // __IBMCPP__ >= 1000 aoqi@0: // XLC V10 provides the prototype for __dcbtst (void *); aoqi@0: #define USE_XLC_PREFETCH_WRITE_BUILTIN aoqi@0: #endif aoqi@0: #endif // USE_XLC_BUILTINS aoqi@0: aoqi@0: // NULL vs NULL_WORD: aoqi@0: // On Linux NULL is defined as a special type '__null'. Assigning __null to aoqi@0: // integer variable will cause gcc warning. Use NULL_WORD in places where a aoqi@0: // pointer is stored as integer value. On some platforms, sizeof(intptr_t) > aoqi@0: // sizeof(void*), so here we want something which is integer type, but has the aoqi@0: // same size as a pointer. aoqi@0: #ifdef __GNUC__ aoqi@0: #error XLC and __GNUC__? aoqi@0: #else aoqi@0: #define NULL_WORD NULL aoqi@0: #endif aoqi@0: aoqi@0: // AIX also needs a 64 bit NULL to work as a null address pointer. aoqi@0: // Most system includes on AIX would define it as an int 0 if not already defined with one aoqi@0: // exception: /usr/include/dirent.h will unconditionally redefine NULL to int 0 again. aoqi@0: // In this case you need to copy the following defines to a position after #include aoqi@0: // (see jmv_aix.h). aoqi@0: #ifdef AIX aoqi@0: #ifdef _LP64 aoqi@0: #undef NULL aoqi@0: #define NULL 0L aoqi@0: #else aoqi@0: #ifndef NULL aoqi@0: #define NULL 0 aoqi@0: #endif aoqi@0: #endif aoqi@0: #endif // AIX aoqi@0: aoqi@0: // Compiler-specific primitive types aoqi@0: // All defs of int (uint16_6 etc) are defined in AIX' /usr/include/stdint.h aoqi@0: aoqi@0: // Additional Java basic types aoqi@0: aoqi@0: typedef uint8_t jubyte; aoqi@0: typedef uint16_t jushort; aoqi@0: typedef uint32_t juint; aoqi@0: typedef uint64_t julong; aoqi@0: aoqi@0: aoqi@0: //---------------------------------------------------------------------------------------------------- aoqi@0: // Constant for jlong (specifying an long long canstant is C++ compiler specific) aoqi@0: aoqi@0: // Build a 64bit integer constant aoqi@0: #define CONST64(x) (x ## LL) aoqi@0: #define UCONST64(x) (x ## ULL) aoqi@0: aoqi@0: const jlong min_jlong = CONST64(0x8000000000000000); aoqi@0: const jlong max_jlong = CONST64(0x7fffffffffffffff); aoqi@0: aoqi@0: //---------------------------------------------------------------------------------------------------- aoqi@0: // Debugging aoqi@0: aoqi@0: #define DEBUG_EXCEPTION ::abort(); aoqi@0: aoqi@0: extern "C" void breakpoint(); aoqi@0: #define BREAKPOINT ::breakpoint() aoqi@0: aoqi@0: // checking for nanness aoqi@0: #ifdef AIX aoqi@0: inline int g_isnan(float f) { return isnan(f); } aoqi@0: inline int g_isnan(double f) { return isnan(f); } aoqi@0: #else aoqi@0: #error "missing platform-specific definition here" aoqi@0: #endif aoqi@0: aoqi@0: // Checking for finiteness aoqi@0: aoqi@0: inline int g_isfinite(jfloat f) { return finite(f); } aoqi@0: inline int g_isfinite(jdouble f) { return finite(f); } aoqi@0: aoqi@0: aoqi@0: // Wide characters aoqi@0: aoqi@0: inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); } aoqi@0: aoqi@0: aoqi@0: // Portability macros aoqi@0: #define PRAGMA_INTERFACE #pragma interface aoqi@0: #define PRAGMA_IMPLEMENTATION #pragma implementation aoqi@0: #define VALUE_OBJ_CLASS_SPEC aoqi@0: aoqi@0: // Formatting. aoqi@0: #ifdef _LP64 aoqi@0: #define FORMAT64_MODIFIER "l" aoqi@0: #else // !_LP64 aoqi@0: #define FORMAT64_MODIFIER "ll" aoqi@0: #endif // _LP64 aoqi@0: aoqi@0: // Cannot use xlc's offsetof as implementation of hotspot's aoqi@0: // offset_of(), because xlc warns about applying offsetof() to non-POD aoqi@0: // object and xlc cannot compile the expression offsetof(DataLayout, aoqi@0: // _cells[index]) in DataLayout::cell_offset() . Therefore we define aoqi@0: // offset_of as it is defined for gcc. aoqi@0: #define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16) aoqi@0: aoqi@0: // Some constant sizes used throughout the AIX port aoqi@0: #define SIZE_1K ((uint64_t) 0x400ULL) aoqi@0: #define SIZE_4K ((uint64_t) 0x1000ULL) aoqi@0: #define SIZE_64K ((uint64_t) 0x10000ULL) aoqi@0: #define SIZE_1M ((uint64_t) 0x100000ULL) aoqi@0: #define SIZE_4M ((uint64_t) 0x400000ULL) aoqi@0: #define SIZE_8M ((uint64_t) 0x800000ULL) aoqi@0: #define SIZE_16M ((uint64_t) 0x1000000ULL) aoqi@0: #define SIZE_256M ((uint64_t) 0x10000000ULL) aoqi@0: #define SIZE_1G ((uint64_t) 0x40000000ULL) aoqi@0: #define SIZE_2G ((uint64_t) 0x80000000ULL) aoqi@0: #define SIZE_4G ((uint64_t) 0x100000000ULL) aoqi@0: #define SIZE_16G ((uint64_t) 0x400000000ULL) aoqi@0: #define SIZE_32G ((uint64_t) 0x800000000ULL) aoqi@0: #define SIZE_64G ((uint64_t) 0x1000000000ULL) aoqi@0: #define SIZE_1T ((uint64_t) 0x10000000000ULL) aoqi@0: aoqi@0: aoqi@0: #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP