Wed, 03 Jul 2019 20:42:37 +0800
Merge
1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. 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 it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 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 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
25 /*
26 * This file has been modified by Loongson Technology in 2015. These
27 * modifications are Copyright (c) 2015 Loongson Technology, and are made
28 * available on the same license terms set forth above.
29 */
31 #ifndef SHARE_VM_UTILITIES_MACROS_HPP
32 #define SHARE_VM_UTILITIES_MACROS_HPP
34 // Use this to mark code that needs to be cleaned up (for development only)
35 #define NEEDS_CLEANUP
37 // Makes a string of the argument (which is not macro-expanded)
38 #define STR(a) #a
40 // Makes a string of the macro expansion of a
41 #define XSTR(a) STR(a)
43 // -DINCLUDE_<something>=0 | 1 can be specified on the command line to include
44 // or exclude functionality.
46 #ifndef INCLUDE_JVMTI
47 #define INCLUDE_JVMTI 1
48 #endif // INCLUDE_JVMTI
50 #if INCLUDE_JVMTI
51 #define JVMTI_ONLY(x) x
52 #define NOT_JVMTI(x)
53 #define NOT_JVMTI_RETURN
54 #define NOT_JVMTI_RETURN_(code) /* next token must be ; */
55 #else
56 #define JVMTI_ONLY(x)
57 #define NOT_JVMTI(x) x
58 #define NOT_JVMTI_RETURN { return; }
59 #define NOT_JVMTI_RETURN_(code) { return code; }
60 #endif // INCLUDE_JVMTI
62 #ifndef INCLUDE_FPROF
63 #define INCLUDE_FPROF 1
64 #endif
66 #if INCLUDE_FPROF
67 #define NOT_FPROF_RETURN /* next token must be ; */
68 #define NOT_FPROF_RETURN_(code) /* next token must be ; */
69 #else
70 #define NOT_FPROF_RETURN {}
71 #define NOT_FPROF_RETURN_(code) { return code; }
72 #endif // INCLUDE_FPROF
74 #ifndef INCLUDE_VM_STRUCTS
75 #define INCLUDE_VM_STRUCTS 1
76 #endif
78 #if INCLUDE_VM_STRUCTS
79 #define NOT_VM_STRUCTS_RETURN /* next token must be ; */
80 #define NOT_VM_STRUCTS_RETURN_(code) /* next token must be ; */
81 #else
82 #define NOT_VM_STRUCTS_RETURN {}
83 #define NOT_VM_STRUCTS_RETURN_(code) { return code; }
84 #endif // INCLUDE_VM_STRUCTS
86 #ifndef INCLUDE_JNI_CHECK
87 #define INCLUDE_JNI_CHECK 1
88 #endif
90 #if INCLUDE_JNI_CHECK
91 #define NOT_JNI_CHECK_RETURN /* next token must be ; */
92 #define NOT_JNI_CHECK_RETURN_(code) /* next token must be ; */
93 #else
94 #define NOT_JNI_CHECK_RETURN {}
95 #define NOT_JNI_CHECK_RETURN_(code) { return code; }
96 #endif // INCLUDE_JNI_CHECK
98 #ifndef INCLUDE_SERVICES
99 #define INCLUDE_SERVICES 1
100 #endif
102 #if INCLUDE_SERVICES
103 #define NOT_SERVICES_RETURN /* next token must be ; */
104 #define NOT_SERVICES_RETURN_(code) /* next token must be ; */
105 #else
106 #define NOT_SERVICES_RETURN {}
107 #define NOT_SERVICES_RETURN_(code) { return code; }
108 #endif // INCLUDE_SERVICES
110 #ifndef INCLUDE_CDS
111 #define INCLUDE_CDS 1
112 #endif
114 #if INCLUDE_CDS
115 #define CDS_ONLY(x) x
116 #define NOT_CDS(x)
117 #define NOT_CDS_RETURN /* next token must be ; */
118 #define NOT_CDS_RETURN_(code) /* next token must be ; */
119 #else
120 #define CDS_ONLY(x)
121 #define NOT_CDS(x) x
122 #define NOT_CDS_RETURN {}
123 #define NOT_CDS_RETURN_(code) { return code; }
124 #endif // INCLUDE_CDS
126 #ifndef INCLUDE_MANAGEMENT
127 #define INCLUDE_MANAGEMENT 1
128 #endif // INCLUDE_MANAGEMENT
130 #if INCLUDE_MANAGEMENT
131 #define NOT_MANAGEMENT_RETURN /* next token must be ; */
132 #define NOT_MANAGEMENT_RETURN_(code) /* next token must be ; */
133 #else
134 #define NOT_MANAGEMENT_RETURN {}
135 #define NOT_MANAGEMENT_RETURN_(code) { return code; }
136 #endif // INCLUDE_MANAGEMENT
138 /*
139 * When INCLUDE_ALL_GCS is false the only garbage collectors
140 * included in the JVM are defaultNewGeneration and markCompact.
141 *
142 * When INCLUDE_ALL_GCS is true all garbage collectors are
143 * included in the JVM.
144 */
145 #ifndef INCLUDE_ALL_GCS
146 #define INCLUDE_ALL_GCS 1
147 #endif // INCLUDE_ALL_GCS
149 #if INCLUDE_ALL_GCS
150 #define NOT_ALL_GCS_RETURN /* next token must be ; */
151 #define NOT_ALL_GCS_RETURN_(code) /* next token must be ; */
152 #else
153 #define NOT_ALL_GCS_RETURN {}
154 #define NOT_ALL_GCS_RETURN_(code) { return code; }
155 #endif // INCLUDE_ALL_GCS
157 #ifndef INCLUDE_NMT
158 #define INCLUDE_NMT 1
159 #endif // INCLUDE_NMT
161 #if INCLUDE_NMT
162 #define NOT_NMT_RETURN /* next token must be ; */
163 #define NOT_NMT_RETURN_(code) /* next token must be ; */
164 #else
165 #define NOT_NMT_RETURN {}
166 #define NOT_NMT_RETURN_(code) { return code; }
167 #endif // INCLUDE_NMT
169 #ifndef INCLUDE_TRACE
170 #define INCLUDE_TRACE 1
171 #endif // INCLUDE_TRACE
173 // COMPILER1 variant
174 #ifdef COMPILER1
175 #ifdef COMPILER2
176 #define TIERED
177 #endif
178 #define COMPILER1_PRESENT(code) code
179 #else // COMPILER1
180 #define COMPILER1_PRESENT(code)
181 #endif // COMPILER1
183 // COMPILER2 variant
184 #ifdef COMPILER2
185 #define COMPILER2_PRESENT(code) code
186 #define NOT_COMPILER2(code)
187 #else // COMPILER2
188 #define COMPILER2_PRESENT(code)
189 #define NOT_COMPILER2(code) code
190 #endif // COMPILER2
192 #ifdef TIERED
193 #define TIERED_ONLY(code) code
194 #define NOT_TIERED(code)
195 #else
196 #define TIERED_ONLY(code)
197 #define NOT_TIERED(code) code
198 #endif // TIERED
201 // PRODUCT variant
202 #ifdef PRODUCT
203 #define PRODUCT_ONLY(code) code
204 #define NOT_PRODUCT(code)
205 #define NOT_PRODUCT_ARG(arg)
206 #define PRODUCT_RETURN {}
207 #define PRODUCT_RETURN0 { return 0; }
208 #define PRODUCT_RETURN_(code) { code }
209 #else // PRODUCT
210 #define PRODUCT_ONLY(code)
211 #define NOT_PRODUCT(code) code
212 #define NOT_PRODUCT_ARG(arg) arg,
213 #define PRODUCT_RETURN /*next token must be ;*/
214 #define PRODUCT_RETURN0 /*next token must be ;*/
215 #define PRODUCT_RETURN_(code) /*next token must be ;*/
216 #endif // PRODUCT
218 #ifdef CHECK_UNHANDLED_OOPS
219 #define CHECK_UNHANDLED_OOPS_ONLY(code) code
220 #define NOT_CHECK_UNHANDLED_OOPS(code)
221 #else
222 #define CHECK_UNHANDLED_OOPS_ONLY(code)
223 #define NOT_CHECK_UNHANDLED_OOPS(code) code
224 #endif // CHECK_UNHANDLED_OOPS
226 #ifdef CC_INTERP
227 #define CC_INTERP_ONLY(code) code
228 #define NOT_CC_INTERP(code)
229 #else
230 #define CC_INTERP_ONLY(code)
231 #define NOT_CC_INTERP(code) code
232 #endif // CC_INTERP
234 #ifdef ASSERT
235 #define DEBUG_ONLY(code) code
236 #define NOT_DEBUG(code)
237 #define NOT_DEBUG_RETURN /*next token must be ;*/
238 // Historical.
239 #define debug_only(code) code
240 #else // ASSERT
241 #define DEBUG_ONLY(code)
242 #define NOT_DEBUG(code) code
243 #define NOT_DEBUG_RETURN {}
244 #define debug_only(code)
245 #endif // ASSERT
247 #ifdef _LP64
248 #define LP64_ONLY(code) code
249 #define NOT_LP64(code)
250 #else // !_LP64
251 #define LP64_ONLY(code)
252 #define NOT_LP64(code) code
253 #endif // _LP64
255 #ifdef LINUX
256 #define LINUX_ONLY(code) code
257 #define NOT_LINUX(code)
258 #else
259 #define LINUX_ONLY(code)
260 #define NOT_LINUX(code) code
261 #endif
263 #ifdef AIX
264 #define AIX_ONLY(code) code
265 #define NOT_AIX(code)
266 #else
267 #define AIX_ONLY(code)
268 #define NOT_AIX(code) code
269 #endif
271 #ifdef SOLARIS
272 #define SOLARIS_ONLY(code) code
273 #define NOT_SOLARIS(code)
274 #else
275 #define SOLARIS_ONLY(code)
276 #define NOT_SOLARIS(code) code
277 #endif
279 #ifdef _WINDOWS
280 #define WINDOWS_ONLY(code) code
281 #define NOT_WINDOWS(code)
282 #else
283 #define WINDOWS_ONLY(code)
284 #define NOT_WINDOWS(code) code
285 #endif
287 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
288 #define BSD_ONLY(code) code
289 #define NOT_BSD(code)
290 #else
291 #define BSD_ONLY(code)
292 #define NOT_BSD(code) code
293 #endif
295 #ifdef _WIN64
296 #define WIN64_ONLY(code) code
297 #define NOT_WIN64(code)
298 #else
299 #define WIN64_ONLY(code)
300 #define NOT_WIN64(code) code
301 #endif
303 #if defined(ZERO)
304 #define ZERO_ONLY(code) code
305 #define NOT_ZERO(code)
306 #else
307 #define ZERO_ONLY(code)
308 #define NOT_ZERO(code) code
309 #endif
311 #if defined(SHARK)
312 #define SHARK_ONLY(code) code
313 #define NOT_SHARK(code)
314 #else
315 #define SHARK_ONLY(code)
316 #define NOT_SHARK(code) code
317 #endif
319 #if defined(IA32) || defined(AMD64)
320 #define X86
321 #define X86_ONLY(code) code
322 #define NOT_X86(code)
323 #else
324 #undef X86
325 #define X86_ONLY(code)
326 #define NOT_X86(code) code
327 #endif
329 #ifdef IA32
330 #define IA32_ONLY(code) code
331 #define NOT_IA32(code)
332 #else
333 #define IA32_ONLY(code)
334 #define NOT_IA32(code) code
335 #endif
337 // This is a REALLY BIG HACK, but on AIX <sys/systemcfg.h> unconditionally defines IA64.
338 // At least on AIX 7.1 this is a real problem because 'systemcfg.h' is indirectly included
339 // by 'pthread.h' and other common system headers.
341 #if defined(IA64) && !defined(AIX)
342 #define IA64_ONLY(code) code
343 #define NOT_IA64(code)
344 #else
345 #define IA64_ONLY(code)
346 #define NOT_IA64(code) code
347 #endif
349 #ifdef AMD64
350 #define AMD64_ONLY(code) code
351 #define NOT_AMD64(code)
352 #else
353 #define AMD64_ONLY(code)
354 #define NOT_AMD64(code) code
355 #endif
357 #ifdef SPARC
358 #define SPARC_ONLY(code) code
359 #define NOT_SPARC(code)
360 #else
361 #define SPARC_ONLY(code)
362 #define NOT_SPARC(code) code
363 #endif
365 #ifdef MIPS64
366 #ifndef MIPS
367 #define MIPS
368 #endif
369 #define MIPS64_ONLY(code) code
370 #define NOT_MIPS64(code)
371 #else
372 #undef MIPS
373 #define MIPS64_ONLY(code)
374 #define NOT_MIPS64(code) code
375 #endif
377 #if defined(PPC32) || defined(PPC64)
378 #ifndef PPC
379 #define PPC
380 #endif
381 #define PPC_ONLY(code) code
382 #define NOT_PPC(code)
383 #else
384 #undef PPC
385 #define PPC_ONLY(code)
386 #define NOT_PPC(code) code
387 #endif
389 #ifdef PPC32
390 #define PPC32_ONLY(code) code
391 #define NOT_PPC32(code)
392 #else
393 #define PPC32_ONLY(code)
394 #define NOT_PPC32(code) code
395 #endif
397 #ifdef PPC64
398 #define PPC64_ONLY(code) code
399 #define NOT_PPC64(code)
400 #else
401 #define PPC64_ONLY(code)
402 #define NOT_PPC64(code) code
403 #endif
405 #ifdef E500V2
406 #define E500V2_ONLY(code) code
407 #define NOT_E500V2(code)
408 #else
409 #define E500V2_ONLY(code)
410 #define NOT_E500V2(code) code
411 #endif
413 #ifdef ARM
414 #define ARM_ONLY(code) code
415 #define NOT_ARM(code)
416 #else
417 #define ARM_ONLY(code)
418 #define NOT_ARM(code) code
419 #endif
421 #ifdef ARM32
422 #define ARM32_ONLY(code) code
423 #define NOT_ARM32(code)
424 #else
425 #define ARM32_ONLY(code)
426 #define NOT_ARM32(code) code
427 #endif
429 #ifdef JAVASE_EMBEDDED
430 #define EMBEDDED_ONLY(code) code
431 #define NOT_EMBEDDED(code)
432 #else
433 #define EMBEDDED_ONLY(code)
434 #define NOT_EMBEDDED(code) code
435 #endif
437 #define define_pd_global(type, name, value) const type pd_##name = value;
439 #endif // SHARE_VM_UTILITIES_MACROS_HPP