1 /* 2 * Copyright (c) 1997, 2016, 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 // COMPILER2 or JVMCI 210 #if defined(COMPILER2) || INCLUDE_JVMCI 211 #define COMPILER2_OR_JVMCI 1 212 #define COMPILER2_OR_JVMCI_PRESENT(code) code 213 #define NOT_COMPILER2_OR_JVMCI(code) 214 #else 215 #define COMPILER2_OR_JVMCI 0 216 #define COMPILER2_OR_JVMCI_PRESENT(code) 217 #define NOT_COMPILER2_OR_JVMCI(code) code 218 #endif 219 220 #ifdef TIERED 221 #define TIERED_ONLY(code) code 222 #define NOT_TIERED(code) 223 #else // TIERED 224 #define TIERED_ONLY(code) 225 #define NOT_TIERED(code) code 226 #endif // TIERED 227 228 229 // PRODUCT variant 230 #ifdef PRODUCT 231 #define PRODUCT_ONLY(code) code 232 #define NOT_PRODUCT(code) 233 #define NOT_PRODUCT_ARG(arg) 234 #define PRODUCT_RETURN {} 235 #define PRODUCT_RETURN0 { return 0; } 236 #define PRODUCT_RETURN_(code) { code } 237 #else // PRODUCT 238 #define PRODUCT_ONLY(code) 239 #define NOT_PRODUCT(code) code 240 #define NOT_PRODUCT_ARG(arg) arg, 241 #define PRODUCT_RETURN /*next token must be ;*/ 242 #define PRODUCT_RETURN0 /*next token must be ;*/ 243 #define PRODUCT_RETURN_(code) /*next token must be ;*/ 244 #endif // PRODUCT 245 246 #ifdef CHECK_UNHANDLED_OOPS 247 #define CHECK_UNHANDLED_OOPS_ONLY(code) code 248 #define NOT_CHECK_UNHANDLED_OOPS(code) 249 #else 250 #define CHECK_UNHANDLED_OOPS_ONLY(code) 251 #define NOT_CHECK_UNHANDLED_OOPS(code) code 252 #endif // CHECK_UNHANDLED_OOPS 253 254 #ifdef CC_INTERP 255 #define CC_INTERP_ONLY(code) code 256 #define NOT_CC_INTERP(code) 257 #else 258 #define CC_INTERP_ONLY(code) 259 #define NOT_CC_INTERP(code) code 260 #endif // CC_INTERP 261 262 #ifdef ASSERT 263 #define DEBUG_ONLY(code) code 264 #define NOT_DEBUG(code) 265 #define NOT_DEBUG_RETURN /*next token must be ;*/ 266 // Historical. 267 #define debug_only(code) code 268 #else // ASSERT 269 #define DEBUG_ONLY(code) 270 #define NOT_DEBUG(code) code 271 #define NOT_DEBUG_RETURN {} 272 #define debug_only(code) 273 #endif // ASSERT 274 275 #ifdef _LP64 276 #define LP64_ONLY(code) code 277 #define NOT_LP64(code) 278 #else // !_LP64 279 #define LP64_ONLY(code) 280 #define NOT_LP64(code) code 281 #endif // _LP64 282 283 #ifdef LINUX 284 #define LINUX_ONLY(code) code 285 #define NOT_LINUX(code) 286 #else 287 #define LINUX_ONLY(code) 288 #define NOT_LINUX(code) code 289 #endif 290 291 #ifdef AIX 292 #define AIX_ONLY(code) code 293 #define NOT_AIX(code) 294 #else 295 #define AIX_ONLY(code) 296 #define NOT_AIX(code) code 297 #endif 298 299 #ifdef SOLARIS 300 #define SOLARIS_ONLY(code) code 301 #define NOT_SOLARIS(code) 302 #else 303 #define SOLARIS_ONLY(code) 304 #define NOT_SOLARIS(code) code 305 #endif 306 307 #ifdef _WINDOWS 308 #define WINDOWS_ONLY(code) code 309 #define NOT_WINDOWS(code) 310 #else 311 #define WINDOWS_ONLY(code) 312 #define NOT_WINDOWS(code) code 313 #endif 314 315 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) 316 #define BSD_ONLY(code) code 317 #define NOT_BSD(code) 318 #else 319 #define BSD_ONLY(code) 320 #define NOT_BSD(code) code 321 #endif 322 323 #ifdef _WIN64 324 #define WIN64_ONLY(code) code 325 #define NOT_WIN64(code) 326 #else 327 #define WIN64_ONLY(code) 328 #define NOT_WIN64(code) code 329 #endif 330 331 #if defined(ZERO) 332 #define ZERO_ONLY(code) code 333 #define NOT_ZERO(code) 334 #else 335 #define ZERO_ONLY(code) 336 #define NOT_ZERO(code) code 337 #endif 338 339 #if defined(SHARK) 340 #define SHARK_ONLY(code) code 341 #define NOT_SHARK(code) 342 #else 343 #define SHARK_ONLY(code) 344 #define NOT_SHARK(code) code 345 #endif 346 347 #if defined(IA32) || defined(AMD64) 348 #define X86 349 #define X86_ONLY(code) code 350 #define NOT_X86(code) 351 #else 352 #undef X86 353 #define X86_ONLY(code) 354 #define NOT_X86(code) code 355 #endif 356 357 #ifdef IA32 358 #define IA32_ONLY(code) code 359 #define NOT_IA32(code) 360 #else 361 #define IA32_ONLY(code) 362 #define NOT_IA32(code) code 363 #endif 364 365 // This is a REALLY BIG HACK, but on AIX <sys/systemcfg.h> unconditionally defines IA64. 366 // At least on AIX 7.1 this is a real problem because 'systemcfg.h' is indirectly included 367 // by 'pthread.h' and other common system headers. 368 369 #if defined(IA64) && !defined(AIX) 370 #define IA64_ONLY(code) code 371 #define NOT_IA64(code) 372 #else 373 #define IA64_ONLY(code) 374 #define NOT_IA64(code) code 375 #endif 376 377 #ifdef AMD64 378 #define AMD64_ONLY(code) code 379 #define NOT_AMD64(code) 380 #else 381 #define AMD64_ONLY(code) 382 #define NOT_AMD64(code) code 383 #endif 384 385 #ifdef SPARC 386 #define SPARC_ONLY(code) code 387 #define NOT_SPARC(code) 388 #else 389 #define SPARC_ONLY(code) 390 #define NOT_SPARC(code) code 391 #endif 392 393 #if defined(PPC32) || defined(PPC64) 394 #ifndef PPC 395 #define PPC 396 #endif 397 #define PPC_ONLY(code) code 398 #define NOT_PPC(code) 399 #else 400 #undef PPC 401 #define PPC_ONLY(code) 402 #define NOT_PPC(code) code 403 #endif 404 405 #ifdef PPC32 406 #define PPC32_ONLY(code) code 407 #define NOT_PPC32(code) 408 #else 409 #define PPC32_ONLY(code) 410 #define NOT_PPC32(code) code 411 #endif 412 413 #ifdef PPC64 414 #define PPC64_ONLY(code) code 415 #define NOT_PPC64(code) 416 #else 417 #define PPC64_ONLY(code) 418 #define NOT_PPC64(code) code 419 #endif 420 421 #ifdef E500V2 422 #define E500V2_ONLY(code) code 423 #define NOT_E500V2(code) 424 #else 425 #define E500V2_ONLY(code) 426 #define NOT_E500V2(code) code 427 #endif 428 429 #ifdef ARM 430 #define ARM_ONLY(code) code 431 #define NOT_ARM(code) 432 #else 433 #define ARM_ONLY(code) 434 #define NOT_ARM(code) code 435 #endif 436 437 #ifdef ARM32 438 #define ARM32_ONLY(code) code 439 #define NOT_ARM32(code) 440 #else 441 #define ARM32_ONLY(code) 442 #define NOT_ARM32(code) code 443 #endif 444 445 #ifdef AARCH64 446 #define AARCH64_ONLY(code) code 447 #define NOT_AARCH64(code) 448 #else 449 #define AARCH64_ONLY(code) 450 #define NOT_AARCH64(code) code 451 #endif 452 453 #ifdef JAVASE_EMBEDDED 454 #define EMBEDDED_ONLY(code) code 455 #define NOT_EMBEDDED(code) 456 #else 457 #define EMBEDDED_ONLY(code) 458 #define NOT_EMBEDDED(code) code 459 #endif 460 461 #define define_pd_global(type, name, value) const type pd_##name = value; 462 463 #endif // SHARE_VM_UTILITIES_MACROS_HPP