Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/utilities/globalDefinitions_xlc.hpp
32285 views
/*1* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.2* Copyright 2012, 2013 SAP AG. All rights reserved.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#ifndef SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP26#define SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP2728#include "prims/jni.h"2930// This file holds compiler-dependent includes,31// globally used constants & types, class (forward)32// declarations and a few frequently used utility functions.3334#include <ctype.h>35#include <string.h>36#include <stdarg.h>37#include <stddef.h>38#include <stdio.h>39#include <stdlib.h>40#include <wchar.h>4142#include <math.h>43#include <time.h>44#include <fcntl.h>45#include <dlfcn.h>46#include <pthread.h>4748#include <limits.h>49#include <errno.h>5051#include <stdint.h>5253// Use XLC compiler builtins instead of inline assembler54#define USE_XLC_BUILTINS55#ifdef USE_XLC_BUILTINS56#include <builtins.h>57#if __IBMCPP__ < 100058// the funtion prototype for __dcbtst(void *) is missing in XLC V8.059// I could compile a little test, where I provided the prototype.60// The generated code was correct there. This is the prototype:61// extern "builtin" void __dcbtst (void *);62// For now we don't make use of it when compiling with XLC V8.063#else64// __IBMCPP__ >= 100065// XLC V10 provides the prototype for __dcbtst (void *);66#define USE_XLC_PREFETCH_WRITE_BUILTIN67#endif68#endif // USE_XLC_BUILTINS6970// NULL vs NULL_WORD:71// On Linux NULL is defined as a special type '__null'. Assigning __null to72// integer variable will cause gcc warning. Use NULL_WORD in places where a73// pointer is stored as integer value. On some platforms, sizeof(intptr_t) >74// sizeof(void*), so here we want something which is integer type, but has the75// same size as a pointer.76#ifdef __GNUC__77#error XLC and __GNUC__?78#else79#define NULL_WORD NULL80#endif8182// AIX also needs a 64 bit NULL to work as a null address pointer.83// Most system includes on AIX would define it as an int 0 if not already defined with one84// exception: /usr/include/dirent.h will unconditionally redefine NULL to int 0 again.85// In this case you need to copy the following defines to a position after #include <dirent.h>86// (see jmv_aix.h).87#ifdef AIX88#ifdef _LP6489#undef NULL90#define NULL 0L91#else92#ifndef NULL93#define NULL 094#endif95#endif96#endif // AIX9798// Compiler-specific primitive types99// All defs of int (uint16_6 etc) are defined in AIX' /usr/include/stdint.h100101// Additional Java basic types102103typedef uint8_t jubyte;104typedef uint16_t jushort;105typedef uint32_t juint;106typedef uint64_t julong;107108109//----------------------------------------------------------------------------------------------------110// Constant for jlong (specifying an long long canstant is C++ compiler specific)111112// Build a 64bit integer constant113#define CONST64(x) (x ## LL)114#define UCONST64(x) (x ## ULL)115116const jlong min_jlong = CONST64(0x8000000000000000);117const jlong max_jlong = CONST64(0x7fffffffffffffff);118119//----------------------------------------------------------------------------------------------------120// Debugging121122#define DEBUG_EXCEPTION ::abort();123124extern "C" void breakpoint();125#define BREAKPOINT ::breakpoint()126127// checking for nanness128#ifdef AIX129inline int g_isnan(float f) { return isnan(f); }130inline int g_isnan(double f) { return isnan(f); }131#else132#error "missing platform-specific definition here"133#endif134135// Checking for finiteness136137inline int g_isfinite(jfloat f) { return finite(f); }138inline int g_isfinite(jdouble f) { return finite(f); }139140141// Wide characters142143inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }144145146// Portability macros147#define PRAGMA_INTERFACE #pragma interface148#define PRAGMA_IMPLEMENTATION #pragma implementation149#define VALUE_OBJ_CLASS_SPEC150151// Formatting.152#ifdef _LP64153#define FORMAT64_MODIFIER "l"154#else // !_LP64155#define FORMAT64_MODIFIER "ll"156#endif // _LP64157158// Cannot use xlc's offsetof as implementation of hotspot's159// offset_of(), because xlc warns about applying offsetof() to non-POD160// object and xlc cannot compile the expression offsetof(DataLayout,161// _cells[index]) in DataLayout::cell_offset() . Therefore we define162// offset_of as it is defined for gcc.163#define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16)164165// Some constant sizes used throughout the AIX port166#define SIZE_1K ((uint64_t) 0x400ULL)167#define SIZE_4K ((uint64_t) 0x1000ULL)168#define SIZE_64K ((uint64_t) 0x10000ULL)169#define SIZE_1M ((uint64_t) 0x100000ULL)170#define SIZE_4M ((uint64_t) 0x400000ULL)171#define SIZE_8M ((uint64_t) 0x800000ULL)172#define SIZE_16M ((uint64_t) 0x1000000ULL)173#define SIZE_256M ((uint64_t) 0x10000000ULL)174#define SIZE_1G ((uint64_t) 0x40000000ULL)175#define SIZE_2G ((uint64_t) 0x80000000ULL)176#define SIZE_4G ((uint64_t) 0x100000000ULL)177#define SIZE_16G ((uint64_t) 0x400000000ULL)178#define SIZE_32G ((uint64_t) 0x800000000ULL)179#define SIZE_64G ((uint64_t) 0x1000000000ULL)180#define SIZE_1T ((uint64_t) 0x10000000000ULL)181182#define NOINLINE __attribute__((__noinline__))183#define ALWAYSINLINE inline __attribute__((__always_inline__))184185#endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_XLC_HPP186187188