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