Wed, 14 Oct 2020 17:44:48 +0800
Merge
1 /*
2 * Copyright (c) 1997, 2018, 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_JFR
170 #define INCLUDE_JFR 1
171 #endif
173 #if INCLUDE_JFR
174 #define JFR_ONLY(code) code
175 #else
176 #define JFR_ONLY(code)
177 #endif
179 // COMPILER1 variant
180 #ifdef COMPILER1
181 #ifdef COMPILER2
182 #define TIERED
183 #endif
184 #define COMPILER1_PRESENT(code) code
185 #else // COMPILER1
186 #define COMPILER1_PRESENT(code)
187 #endif // COMPILER1
189 // COMPILER2 variant
190 #ifdef COMPILER2
191 #define COMPILER2_PRESENT(code) code
192 #define NOT_COMPILER2(code)
193 #else // COMPILER2
194 #define COMPILER2_PRESENT(code)
195 #define NOT_COMPILER2(code) code
196 #endif // COMPILER2
198 #ifdef TIERED
199 #define TIERED_ONLY(code) code
200 #define NOT_TIERED(code)
201 #else
202 #define TIERED_ONLY(code)
203 #define NOT_TIERED(code) code
204 #endif // TIERED
207 // PRODUCT variant
208 #ifdef PRODUCT
209 #define PRODUCT_ONLY(code) code
210 #define NOT_PRODUCT(code)
211 #define NOT_PRODUCT_ARG(arg)
212 #define PRODUCT_RETURN {}
213 #define PRODUCT_RETURN0 { return 0; }
214 #define PRODUCT_RETURN_(code) { code }
215 #else // PRODUCT
216 #define PRODUCT_ONLY(code)
217 #define NOT_PRODUCT(code) code
218 #define NOT_PRODUCT_ARG(arg) arg,
219 #define PRODUCT_RETURN /*next token must be ;*/
220 #define PRODUCT_RETURN0 /*next token must be ;*/
221 #define PRODUCT_RETURN_(code) /*next token must be ;*/
222 #endif // PRODUCT
224 #ifdef CHECK_UNHANDLED_OOPS
225 #define CHECK_UNHANDLED_OOPS_ONLY(code) code
226 #define NOT_CHECK_UNHANDLED_OOPS(code)
227 #else
228 #define CHECK_UNHANDLED_OOPS_ONLY(code)
229 #define NOT_CHECK_UNHANDLED_OOPS(code) code
230 #endif // CHECK_UNHANDLED_OOPS
232 #ifdef CC_INTERP
233 #define CC_INTERP_ONLY(code) code
234 #define NOT_CC_INTERP(code)
235 #else
236 #define CC_INTERP_ONLY(code)
237 #define NOT_CC_INTERP(code) code
238 #endif // CC_INTERP
240 #ifdef ASSERT
241 #define DEBUG_ONLY(code) code
242 #define NOT_DEBUG(code)
243 #define NOT_DEBUG_RETURN /*next token must be ;*/
244 // Historical.
245 #define debug_only(code) code
246 #else // ASSERT
247 #define DEBUG_ONLY(code)
248 #define NOT_DEBUG(code) code
249 #define NOT_DEBUG_RETURN {}
250 #define debug_only(code)
251 #endif // ASSERT
253 #ifdef _LP64
254 #define LP64_ONLY(code) code
255 #define NOT_LP64(code)
256 #else // !_LP64
257 #define LP64_ONLY(code)
258 #define NOT_LP64(code) code
259 #endif // _LP64
261 #ifdef LINUX
262 #define LINUX_ONLY(code) code
263 #define NOT_LINUX(code)
264 #else
265 #define LINUX_ONLY(code)
266 #define NOT_LINUX(code) code
267 #endif
269 #ifdef AIX
270 #define AIX_ONLY(code) code
271 #define NOT_AIX(code)
272 #else
273 #define AIX_ONLY(code)
274 #define NOT_AIX(code) code
275 #endif
277 #ifdef SOLARIS
278 #define SOLARIS_ONLY(code) code
279 #define NOT_SOLARIS(code)
280 #else
281 #define SOLARIS_ONLY(code)
282 #define NOT_SOLARIS(code) code
283 #endif
285 #ifdef _WINDOWS
286 #define WINDOWS_ONLY(code) code
287 #define NOT_WINDOWS(code)
288 #else
289 #define WINDOWS_ONLY(code)
290 #define NOT_WINDOWS(code) code
291 #endif
293 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
294 #define BSD_ONLY(code) code
295 #define NOT_BSD(code)
296 #else
297 #define BSD_ONLY(code)
298 #define NOT_BSD(code) code
299 #endif
301 #ifdef _WIN64
302 #define WIN64_ONLY(code) code
303 #define NOT_WIN64(code)
304 #else
305 #define WIN64_ONLY(code)
306 #define NOT_WIN64(code) code
307 #endif
309 #if defined(ZERO)
310 #define ZERO_ONLY(code) code
311 #define NOT_ZERO(code)
312 #else
313 #define ZERO_ONLY(code)
314 #define NOT_ZERO(code) code
315 #endif
317 #if defined(SHARK)
318 #define SHARK_ONLY(code) code
319 #define NOT_SHARK(code)
320 #else
321 #define SHARK_ONLY(code)
322 #define NOT_SHARK(code) code
323 #endif
325 #if defined(IA32) || defined(AMD64)
326 #define X86
327 #define X86_ONLY(code) code
328 #define NOT_X86(code)
329 #else
330 #undef X86
331 #define X86_ONLY(code)
332 #define NOT_X86(code) code
333 #endif
335 #ifdef IA32
336 #define IA32_ONLY(code) code
337 #define NOT_IA32(code)
338 #else
339 #define IA32_ONLY(code)
340 #define NOT_IA32(code) code
341 #endif
343 // This is a REALLY BIG HACK, but on AIX <sys/systemcfg.h> unconditionally defines IA64.
344 // At least on AIX 7.1 this is a real problem because 'systemcfg.h' is indirectly included
345 // by 'pthread.h' and other common system headers.
347 #if defined(IA64) && !defined(AIX)
348 #define IA64_ONLY(code) code
349 #define NOT_IA64(code)
350 #else
351 #define IA64_ONLY(code)
352 #define NOT_IA64(code) code
353 #endif
355 #ifdef AMD64
356 #define AMD64_ONLY(code) code
357 #define NOT_AMD64(code)
358 #else
359 #define AMD64_ONLY(code)
360 #define NOT_AMD64(code) code
361 #endif
363 #ifdef SPARC
364 #define SPARC_ONLY(code) code
365 #define NOT_SPARC(code)
366 #else
367 #define SPARC_ONLY(code)
368 #define NOT_SPARC(code) code
369 #endif
371 #ifdef MIPS64
372 #ifndef MIPS
373 #define MIPS
374 #endif
375 #define MIPS64_ONLY(code) code
376 #define NOT_MIPS64(code)
377 #else
378 #undef MIPS
379 #define MIPS64_ONLY(code)
380 #define NOT_MIPS64(code) code
381 #endif
383 #if defined(PPC32) || defined(PPC64)
384 #ifndef PPC
385 #define PPC
386 #endif
387 #define PPC_ONLY(code) code
388 #define NOT_PPC(code)
389 #else
390 #undef PPC
391 #define PPC_ONLY(code)
392 #define NOT_PPC(code) code
393 #endif
395 #ifdef PPC32
396 #define PPC32_ONLY(code) code
397 #define NOT_PPC32(code)
398 #else
399 #define PPC32_ONLY(code)
400 #define NOT_PPC32(code) code
401 #endif
403 #ifdef PPC64
404 #define PPC64_ONLY(code) code
405 #define NOT_PPC64(code)
406 #else
407 #define PPC64_ONLY(code)
408 #define NOT_PPC64(code) code
409 #endif
411 #ifdef E500V2
412 #define E500V2_ONLY(code) code
413 #define NOT_E500V2(code)
414 #else
415 #define E500V2_ONLY(code)
416 #define NOT_E500V2(code) code
417 #endif
419 #ifdef ARM
420 #define ARM_ONLY(code) code
421 #define NOT_ARM(code)
422 #else
423 #define ARM_ONLY(code)
424 #define NOT_ARM(code) code
425 #endif
427 #ifdef ARM32
428 #define ARM32_ONLY(code) code
429 #define NOT_ARM32(code)
430 #else
431 #define ARM32_ONLY(code)
432 #define NOT_ARM32(code) code
433 #endif
435 #ifdef JAVASE_EMBEDDED
436 #define EMBEDDED_ONLY(code) code
437 #define NOT_EMBEDDED(code)
438 #else
439 #define EMBEDDED_ONLY(code)
440 #define NOT_EMBEDDED(code) code
441 #endif
443 #ifdef VM_LITTLE_ENDIAN
444 #define LITTLE_ENDIAN_ONLY(code) code
445 #define BIG_ENDIAN_ONLY(code)
446 #else
447 #define LITTLE_ENDIAN_ONLY(code)
448 #define BIG_ENDIAN_ONLY(code) code
449 #endif
451 #define define_pd_global(type, name, value) const type pd_##name = value;
453 #endif // SHARE_VM_UTILITIES_MACROS_HPP