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 */ 24 25 #ifndef SHARE_VM_UTILITIES_MACROS_HPP 26 #define SHARE_VM_UTILITIES_MACROS_HPP 27 28 // Use this to mark code that needs to be cleaned up (for development only) 29 #define NEEDS_CLEANUP 30 31 // Makes a string of the argument (which is not macro-expanded) 32 #define STR(a) #a 33 34 // Makes a string of the macro expansion of a 35 #define XSTR(a) STR(a) 36 37 // Apply pre-processor token pasting to the expansions of x and y. 38 // The token pasting operator (##) prevents its arguments from being 39 // expanded. This macro allows expansion of its arguments before the 40 // concatenation is performed. Note: One auxilliary level ought to be 41 // sufficient, but two are used because of bugs in some preprocesors. 42 #define PASTE_TOKENS(x, y) PASTE_TOKENS_AUX(x, y) 43 #define PASTE_TOKENS_AUX(x, y) PASTE_TOKENS_AUX2(x, y) 44 #define PASTE_TOKENS_AUX2(x, y) x ## y 45 46 // -DINCLUDE_<something>=0 | 1 can be specified on the command line to include 47 // or exclude functionality. 48 49 #ifndef INCLUDE_JVMTI 50 #define INCLUDE_JVMTI 1 51 #endif // INCLUDE_JVMTI 52 53 #if INCLUDE_JVMTI 54 #define JVMTI_ONLY(x) x 55 #define NOT_JVMTI(x) 56 #define NOT_JVMTI_RETURN 57 #define NOT_JVMTI_RETURN_(code) /* next token must be ; */ 58 #else 59 #define JVMTI_ONLY(x) 60 #define NOT_JVMTI(x) x 61 #define NOT_JVMTI_RETURN { return; } 62 #define NOT_JVMTI_RETURN_(code) { return code; } 63 #endif // INCLUDE_JVMTI 64 65 #ifndef INCLUDE_FPROF 66 #define INCLUDE_FPROF 1 67 #endif 68 69 #if INCLUDE_FPROF 70 #define NOT_FPROF_RETURN /* next token must be ; */ 71 #define NOT_FPROF_RETURN_(code) /* next token must be ; */ 72 #else 73 #define NOT_FPROF_RETURN {} 74 #define NOT_FPROF_RETURN_(code) { return code; } 75 #endif // INCLUDE_FPROF 76 77 #ifndef INCLUDE_VM_STRUCTS 78 #define INCLUDE_VM_STRUCTS 1 79 #endif 80 81 #if INCLUDE_VM_STRUCTS 82 #define NOT_VM_STRUCTS_RETURN /* next token must be ; */ 83 #define NOT_VM_STRUCTS_RETURN_(code) /* next token must be ; */ 84 #else 85 #define NOT_VM_STRUCTS_RETURN {} 86 #define NOT_VM_STRUCTS_RETURN_(code) { return code; } 87 #endif // INCLUDE_VM_STRUCTS 88 89 #ifndef INCLUDE_JNI_CHECK 90 #define INCLUDE_JNI_CHECK 1 91 #endif 92 93 #if INCLUDE_JNI_CHECK 94 #define NOT_JNI_CHECK_RETURN /* next token must be ; */ 95 #define NOT_JNI_CHECK_RETURN_(code) /* next token must be ; */ 96 #else 97 #define NOT_JNI_CHECK_RETURN {} 98 #define NOT_JNI_CHECK_RETURN_(code) { return code; } 99 #endif // INCLUDE_JNI_CHECK 100 101 #ifndef INCLUDE_SERVICES 102 #define INCLUDE_SERVICES 1 103 #endif 104 105 #if INCLUDE_SERVICES 106 #define NOT_SERVICES_RETURN /* next token must be ; */ 107 #define NOT_SERVICES_RETURN_(code) /* next token must be ; */ 108 #else 109 #define NOT_SERVICES_RETURN {} 110 #define NOT_SERVICES_RETURN_(code) { return code; } 111 #endif // INCLUDE_SERVICES 112 113 #ifndef INCLUDE_CDS 114 #define INCLUDE_CDS 1 115 #endif 116 117 #if INCLUDE_CDS 118 #define CDS_ONLY(x) x 119 #define NOT_CDS(x) 120 #define NOT_CDS_RETURN /* next token must be ; */ 121 #define NOT_CDS_RETURN_(code) /* next token must be ; */ 122 #else 123 #define CDS_ONLY(x) 124 #define NOT_CDS(x) x 125 #define NOT_CDS_RETURN {} 126 #define NOT_CDS_RETURN_(code) { return code; } 127 #endif // INCLUDE_CDS 128 129 #ifndef INCLUDE_MANAGEMENT 130 #define INCLUDE_MANAGEMENT 1 131 #endif // INCLUDE_MANAGEMENT 132 133 #if INCLUDE_MANAGEMENT 134 #define NOT_MANAGEMENT_RETURN /* next token must be ; */ 135 #define NOT_MANAGEMENT_RETURN_(code) /* next token must be ; */ 136 #else 137 #define NOT_MANAGEMENT_RETURN {} 138 #define NOT_MANAGEMENT_RETURN_(code) { return code; } 139 #endif // INCLUDE_MANAGEMENT 140 141 /* 142 * When INCLUDE_ALL_GCS is false the only garbage collectors 143 * included in the JVM are defaultNewGeneration and markCompact. 144 * 145 * When INCLUDE_ALL_GCS is true all garbage collectors are 146 * included in the JVM. 147 */ 148 #ifndef INCLUDE_ALL_GCS 149 #define INCLUDE_ALL_GCS 1 150 #endif // INCLUDE_ALL_GCS 151 152 #if INCLUDE_ALL_GCS 153 #define NOT_ALL_GCS_RETURN /* next token must be ; */ 154 #define NOT_ALL_GCS_RETURN_(code) /* next token must be ; */ 155 #else 156 #define NOT_ALL_GCS_RETURN {} 157 #define NOT_ALL_GCS_RETURN_(code) { return code; } 158 #endif // INCLUDE_ALL_GCS 159 160 #ifndef INCLUDE_NMT 161 #define INCLUDE_NMT 1 162 #endif // INCLUDE_NMT 163 164 #if INCLUDE_NMT 165 #define NOT_NMT_RETURN /* next token must be ; */ 166 #define NOT_NMT_RETURN_(code) /* next token must be ; */ 167 #else 168 #define NOT_NMT_RETURN {} 169 #define NOT_NMT_RETURN_(code) { return code; } 170 #endif // INCLUDE_NMT 171 172 #ifndef INCLUDE_TRACE 173 #define INCLUDE_TRACE 1 174 #endif // INCLUDE_TRACE 175 176 #ifndef INCLUDE_JVMCI 177 #define INCLUDE_JVMCI 1 178 #endif 179 180 #if INCLUDE_JVMCI 181 #define JVMCI_ONLY(code) code 182 #define NOT_JVMCI(code) 183 #define NOT_JVMCI_RETURN /* next token must be ; */ 184 #else 185 #define JVMCI_ONLY(code) 186 #define NOT_JVMCI(code) code 187 #define NOT_JVMCI_RETURN {} 188 #endif // INCLUDE_JVMCI 189 190 // COMPILER1 variant 191 #ifdef COMPILER1 192 #ifdef COMPILER2 193 #define TIERED 194 #endif 195 #define COMPILER1_PRESENT(code) code 196 #else // COMPILER1 197 #define COMPILER1_PRESENT(code) 198 #endif // COMPILER1 199 200 // COMPILER2 variant 201 #ifdef COMPILER2 202 #define COMPILER2_PRESENT(code) code 203 #define NOT_COMPILER2(code) 204 #else // COMPILER2 205 #define COMPILER2_PRESENT(code) 206 #define NOT_COMPILER2(code) code 207 #endif // COMPILER2 208 209 #ifdef TIERED 210 #define TIERED_ONLY(code) code 211 #define NOT_TIERED(code) 212 #else // TIERED 213 #define TIERED_ONLY(code) 214 #define NOT_TIERED(code) code 215 #endif // TIERED 216 217 218 // PRODUCT variant 219 #ifdef PRODUCT 220 #define PRODUCT_ONLY(code) code 221 #define NOT_PRODUCT(code) 222 #define NOT_PRODUCT_ARG(arg) 223 #define PRODUCT_RETURN {} 224 #define PRODUCT_RETURN0 { return 0; } 225 #define PRODUCT_RETURN_(code) { code } 226 #else // PRODUCT 227 #define PRODUCT_ONLY(code) 228 #define NOT_PRODUCT(code) code 229 #define NOT_PRODUCT_ARG(arg) arg, 230 #define PRODUCT_RETURN /*next token must be ;*/ 231 #define PRODUCT_RETURN0 /*next token must be ;*/ 232 #define PRODUCT_RETURN_(code) /*next token must be ;*/ 233 #endif // PRODUCT 234 235 #ifdef CHECK_UNHANDLED_OOPS 236 #define CHECK_UNHANDLED_OOPS_ONLY(code) code 237 #define NOT_CHECK_UNHANDLED_OOPS(code) 238 #else 239 #define CHECK_UNHANDLED_OOPS_ONLY(code) 240 #define NOT_CHECK_UNHANDLED_OOPS(code) code 241 #endif // CHECK_UNHANDLED_OOPS 242 243 #ifdef CC_INTERP 244 #define CC_INTERP_ONLY(code) code 245 #define NOT_CC_INTERP(code) 246 #else 247 #define CC_INTERP_ONLY(code) 248 #define NOT_CC_INTERP(code) code 249 #endif // CC_INTERP 250 251 #ifdef ASSERT 252 #define DEBUG_ONLY(code) code 253 #define NOT_DEBUG(code) 254 #define NOT_DEBUG_RETURN /*next token must be ;*/ 255 // Historical. 256 #define debug_only(code) code 257 #else // ASSERT 258 #define DEBUG_ONLY(code) 259 #define NOT_DEBUG(code) code 260 #define NOT_DEBUG_RETURN {} 261 #define debug_only(code) 262 #endif // ASSERT 263 264 #ifdef _LP64 265 #define LP64_ONLY(code) code 266 #define NOT_LP64(code) 267 #else // !_LP64 268 #define LP64_ONLY(code) 269 #define NOT_LP64(code) code 270 #endif // _LP64 271 272 #ifdef LINUX 273 #define LINUX_ONLY(code) code 274 #define NOT_LINUX(code) 275 #else 276 #define LINUX_ONLY(code) 277 #define NOT_LINUX(code) code 278 #endif 279 280 #ifdef AIX 281 #define AIX_ONLY(code) code 282 #define NOT_AIX(code) 283 #else 284 #define AIX_ONLY(code) 285 #define NOT_AIX(code) code 286 #endif 287 288 #ifdef SOLARIS 289 #define SOLARIS_ONLY(code) code 290 #define NOT_SOLARIS(code) 291 #else 292 #define SOLARIS_ONLY(code) 293 #define NOT_SOLARIS(code) code 294 #endif 295 296 #ifdef _WINDOWS 297 #define WINDOWS_ONLY(code) code 298 #define NOT_WINDOWS(code) 299 #else 300 #define WINDOWS_ONLY(code) 301 #define NOT_WINDOWS(code) code 302 #endif 303 304 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) 305 #define BSD_ONLY(code) code 306 #define NOT_BSD(code) 307 #else 308 #define BSD_ONLY(code) 309 #define NOT_BSD(code) code 310 #endif 311 312 #ifdef _WIN64 313 #define WIN64_ONLY(code) code 314 #define NOT_WIN64(code) 315 #else 316 #define WIN64_ONLY(code) 317 #define NOT_WIN64(code) code 318 #endif 319 320 #if defined(ZERO) 321 #define ZERO_ONLY(code) code 322 #define NOT_ZERO(code) 323 #else 324 #define ZERO_ONLY(code) 325 #define NOT_ZERO(code) code 326 #endif 327 328 #if defined(SHARK) 329 #define SHARK_ONLY(code) code 330 #define NOT_SHARK(code) 331 #else 332 #define SHARK_ONLY(code) 333 #define NOT_SHARK(code) code 334 #endif 335 336 #if defined(IA32) || defined(AMD64) 337 #define X86 338 #define X86_ONLY(code) code 339 #define NOT_X86(code) 340 #else 341 #undef X86 342 #define X86_ONLY(code) 343 #define NOT_X86(code) code 344 #endif 345 346 #ifdef IA32 347 #define IA32_ONLY(code) code 348 #define NOT_IA32(code) 349 #else 350 #define IA32_ONLY(code) 351 #define NOT_IA32(code) code 352 #endif 353 354 // This is a REALLY BIG HACK, but on AIX <sys/systemcfg.h> unconditionally defines IA64. 355 // At least on AIX 7.1 this is a real problem because 'systemcfg.h' is indirectly included 356 // by 'pthread.h' and other common system headers. 357 358 #if defined(IA64) && !defined(AIX) 359 #define IA64_ONLY(code) code 360 #define NOT_IA64(code) 361 #else 362 #define IA64_ONLY(code) 363 #define NOT_IA64(code) code 364 #endif 365 366 #ifdef AMD64 367 #define AMD64_ONLY(code) code 368 #define NOT_AMD64(code) 369 #else 370 #define AMD64_ONLY(code) 371 #define NOT_AMD64(code) code 372 #endif 373 374 #ifdef SPARC 375 #define SPARC_ONLY(code) code 376 #define NOT_SPARC(code) 377 #else 378 #define SPARC_ONLY(code) 379 #define NOT_SPARC(code) code 380 #endif 381 382 #if defined(PPC32) || defined(PPC64) 383 #ifndef PPC 384 #define PPC 385 #endif 386 #define PPC_ONLY(code) code 387 #define NOT_PPC(code) 388 #else 389 #undef PPC 390 #define PPC_ONLY(code) 391 #define NOT_PPC(code) code 392 #endif 393 394 #ifdef PPC32 395 #define PPC32_ONLY(code) code 396 #define NOT_PPC32(code) 397 #else 398 #define PPC32_ONLY(code) 399 #define NOT_PPC32(code) code 400 #endif 401 402 #ifdef PPC64 403 #define PPC64_ONLY(code) code 404 #define NOT_PPC64(code) 405 #else 406 #define PPC64_ONLY(code) 407 #define NOT_PPC64(code) code 408 #endif 409 410 #ifdef E500V2 411 #define E500V2_ONLY(code) code 412 #define NOT_E500V2(code) 413 #else 414 #define E500V2_ONLY(code) 415 #define NOT_E500V2(code) code 416 #endif 417 418 #ifdef ARM 419 #define ARM_ONLY(code) code 420 #define NOT_ARM(code) 421 #else 422 #define ARM_ONLY(code) 423 #define NOT_ARM(code) code 424 #endif 425 426 #ifdef ARM32 427 #define ARM32_ONLY(code) code 428 #define NOT_ARM32(code) 429 #else 430 #define ARM32_ONLY(code) 431 #define NOT_ARM32(code) code 432 #endif 433 434 #ifdef AARCH64 435 #define AARCH64_ONLY(code) code 436 #define NOT_AARCH64(code) 437 #else 438 #define AARCH64_ONLY(code) 439 #define NOT_AARCH64(code) code 440 #endif 441 442 #ifdef JAVASE_EMBEDDED 443 #define EMBEDDED_ONLY(code) code 444 #define NOT_EMBEDDED(code) 445 #else 446 #define EMBEDDED_ONLY(code) 447 #define NOT_EMBEDDED(code) code 448 #endif 449 450 #define define_pd_global(type, name, value) const type pd_##name = value; 451 452 #endif // SHARE_VM_UTILITIES_MACROS_HPP