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