1 /*
   2  * Copyright (c) 1997, 2019, 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_UTILITIES_MACROS_HPP
  26 #define SHARE_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 // Allow commas in macro arguments.
  38 #define COMMA ,
  39 
  40 // Apply pre-processor token pasting to the expansions of x and y.
  41 // The token pasting operator (##) prevents its arguments from being
  42 // expanded.  This macro allows expansion of its arguments before the
  43 // concatenation is performed.  Note: One auxilliary level ought to be
  44 // sufficient, but two are used because of bugs in some preprocesors.
  45 #define PASTE_TOKENS(x, y) PASTE_TOKENS_AUX(x, y)
  46 #define PASTE_TOKENS_AUX(x, y) PASTE_TOKENS_AUX2(x, y)
  47 #define PASTE_TOKENS_AUX2(x, y) x ## y
  48 
  49 // -DINCLUDE_<something>=0 | 1 can be specified on the command line to include
  50 // or exclude functionality.
  51 
  52 #ifndef INCLUDE_JVMTI
  53 #define INCLUDE_JVMTI 1
  54 #endif  // INCLUDE_JVMTI
  55 
  56 #if INCLUDE_JVMTI
  57 #define JVMTI_ONLY(x) x
  58 #define NOT_JVMTI(x)
  59 #define NOT_JVMTI_RETURN
  60 #define NOT_JVMTI_RETURN_(code) /* next token must be ; */
  61 #else
  62 #define JVMTI_ONLY(x)
  63 #define NOT_JVMTI(x) x
  64 #define NOT_JVMTI_RETURN { return; }
  65 #define NOT_JVMTI_RETURN_(code) { return code; }
  66 #endif // INCLUDE_JVMTI
  67 
  68 #ifndef INCLUDE_VM_STRUCTS
  69 #define INCLUDE_VM_STRUCTS 1
  70 #endif
  71 
  72 #if INCLUDE_VM_STRUCTS
  73 #define NOT_VM_STRUCTS_RETURN        /* next token must be ; */
  74 #define NOT_VM_STRUCTS_RETURN_(code) /* next token must be ; */
  75 #else
  76 #define NOT_VM_STRUCTS_RETURN           {}
  77 #define NOT_VM_STRUCTS_RETURN_(code) { return code; }
  78 #endif // INCLUDE_VM_STRUCTS
  79 
  80 #ifndef INCLUDE_JNI_CHECK
  81 #define INCLUDE_JNI_CHECK 1
  82 #endif
  83 
  84 #if INCLUDE_JNI_CHECK
  85 #define NOT_JNI_CHECK_RETURN        /* next token must be ; */
  86 #define NOT_JNI_CHECK_RETURN_(code) /* next token must be ; */
  87 #else
  88 #define NOT_JNI_CHECK_RETURN            {}
  89 #define NOT_JNI_CHECK_RETURN_(code) { return code; }
  90 #endif // INCLUDE_JNI_CHECK
  91 
  92 #ifndef INCLUDE_SERVICES
  93 #define INCLUDE_SERVICES 1
  94 #endif
  95 
  96 #if INCLUDE_SERVICES
  97 #define NOT_SERVICES_RETURN        /* next token must be ; */
  98 #define NOT_SERVICES_RETURN_(code) /* next token must be ; */
  99 #else
 100 #define NOT_SERVICES_RETURN             {}
 101 #define NOT_SERVICES_RETURN_(code) { return code; }
 102 #endif // INCLUDE_SERVICES
 103 
 104 #ifndef INCLUDE_CDS
 105 #define INCLUDE_CDS 1
 106 #endif
 107 
 108 #if INCLUDE_CDS
 109 #define CDS_ONLY(x) x
 110 #define NOT_CDS(x)
 111 #define NOT_CDS_RETURN        /* next token must be ; */
 112 #define NOT_CDS_RETURN0       /* next token must be ; */
 113 #define NOT_CDS_RETURN_(code) /* next token must be ; */
 114 #else
 115 #define CDS_ONLY(x)
 116 #define NOT_CDS(x) x
 117 #define NOT_CDS_RETURN        {}
 118 #define NOT_CDS_RETURN0       { return 0; }
 119 #define NOT_CDS_RETURN_(code) { return code; }
 120 #endif // INCLUDE_CDS
 121 
 122 #ifndef INCLUDE_MANAGEMENT
 123 #define INCLUDE_MANAGEMENT 1
 124 #endif // INCLUDE_MANAGEMENT
 125 
 126 #if INCLUDE_MANAGEMENT
 127 #define NOT_MANAGEMENT_RETURN        /* next token must be ; */
 128 #define NOT_MANAGEMENT_RETURN_(code) /* next token must be ; */
 129 #else
 130 #define NOT_MANAGEMENT_RETURN        {}
 131 #define NOT_MANAGEMENT_RETURN_(code) { return code; }
 132 #endif // INCLUDE_MANAGEMENT
 133 
 134 #ifndef INCLUDE_CMSGC
 135 #define INCLUDE_CMSGC 1
 136 #endif // INCLUDE_CMSGC
 137 
 138 #if INCLUDE_CMSGC
 139 #define CMSGC_ONLY(x) x
 140 #define CMSGC_ONLY_ARG(arg) arg,
 141 #define NOT_CMSGC(x)
 142 #define NOT_CMSGC_RETURN        /* next token must be ; */
 143 #define NOT_CMSGC_RETURN_(code) /* next token must be ; */
 144 #else
 145 #define CMSGC_ONLY(x)
 146 #define CMSGC_ONLY_ARG(x)
 147 #define NOT_CMSGC(x) x
 148 #define NOT_CMSGC_RETURN        {}
 149 #define NOT_CMSGC_RETURN_(code) { return code; }
 150 #endif // INCLUDE_CMSGC
 151 
 152 #ifndef INCLUDE_EPSILONGC
 153 #define INCLUDE_EPSILONGC 1
 154 #endif // INCLUDE_EPSILONGC
 155 
 156 #if INCLUDE_EPSILONGC
 157 #define EPSILONGC_ONLY(x) x
 158 #define EPSILONGC_ONLY_ARG(arg) arg,
 159 #define NOT_EPSILONGC(x)
 160 #define NOT_EPSILONGC_RETURN        /* next token must be ; */
 161 #define NOT_EPSILONGC_RETURN_(code) /* next token must be ; */
 162 #else
 163 #define EPSILONGC_ONLY(x)
 164 #define EPSILONGC_ONLY_ARG(arg)
 165 #define NOT_EPSILONGC(x) x
 166 #define NOT_EPSILONGC_RETURN        {}
 167 #define NOT_EPSILONGC_RETURN_(code) { return code; }
 168 #endif // INCLUDE_EPSILONGC
 169 
 170 #ifndef INCLUDE_G1GC
 171 #define INCLUDE_G1GC 1
 172 #endif // INCLUDE_G1GC
 173 
 174 #if INCLUDE_G1GC
 175 #define G1GC_ONLY(x) x
 176 #define G1GC_ONLY_ARG(arg) arg,
 177 #define NOT_G1GC(x)
 178 #define NOT_G1GC_RETURN        /* next token must be ; */
 179 #define NOT_G1GC_RETURN_(code) /* next token must be ; */
 180 #else
 181 #define G1GC_ONLY(x)
 182 #define G1GC_ONLY_ARG(arg)
 183 #define NOT_G1GC(x) x
 184 #define NOT_G1GC_RETURN        {}
 185 #define NOT_G1GC_RETURN_(code) { return code; }
 186 #endif // INCLUDE_G1GC
 187 
 188 #ifndef INCLUDE_PARALLELGC
 189 #define INCLUDE_PARALLELGC 1
 190 #endif // INCLUDE_PARALLELGC
 191 
 192 #if INCLUDE_PARALLELGC
 193 #define PARALLELGC_ONLY(x) x
 194 #define PARALLELGC_ONLY_ARG(arg) arg,
 195 #define NOT_PARALLELGC(x)
 196 #define NOT_PARALLELGC_RETURN        /* next token must be ; */
 197 #define NOT_PARALLELGC_RETURN_(code) /* next token must be ; */
 198 #else
 199 #define PARALLELGC_ONLY(x)
 200 #define PARALLELGC_ONLY_ARG(arg)
 201 #define NOT_PARALLELGC(x) x
 202 #define NOT_PARALLELGC_RETURN        {}
 203 #define NOT_PARALLELGC_RETURN_(code) { return code; }
 204 #endif // INCLUDE_PARALLELGC
 205 
 206 #ifndef INCLUDE_SERIALGC
 207 #define INCLUDE_SERIALGC 1
 208 #endif // INCLUDE_SERIALGC
 209 
 210 #if INCLUDE_SERIALGC
 211 #define SERIALGC_ONLY(x) x
 212 #define SERIALGC_ONLY_ARG(arg) arg,
 213 #define NOT_SERIALGC(x)
 214 #define NOT_SERIALGC_RETURN        /* next token must be ; */
 215 #define NOT_SERIALGC_RETURN_(code) /* next token must be ; */
 216 #else
 217 #define SERIALGC_ONLY(x)
 218 #define SERIALGC_ONLY_ARG(arg)
 219 #define NOT_SERIALGC(x) x
 220 #define NOT_SERIALGC_RETURN        {}
 221 #define NOT_SERIALGC_RETURN_(code) { return code; }
 222 #endif // INCLUDE_SERIALGC
 223 
 224 #ifndef INCLUDE_SHENANDOAHGC
 225 #define INCLUDE_SHENANDOAHGC 1
 226 #endif // INCLUDE_SHENANDOAHGC
 227 
 228 #if INCLUDE_SHENANDOAHGC
 229 #define SHENANDOAHGC_ONLY(x) x
 230 #define SHENANDOAHGC_ONLY_ARG(arg) arg,
 231 #define NOT_SHENANDOAHGC(x)
 232 #define NOT_SHENANDOAHGC_RETURN        /* next token must be ; */
 233 #define NOT_SHENANDOAHGC_RETURN_(code) /* next token must be ; */
 234 #else
 235 #define SHENANDOAHGC_ONLY(x)
 236 #define SHENANDOAHGC_ONLY_ARG(arg)
 237 #define NOT_SHENANDOAHGC(x) x
 238 #define NOT_SHENANDOAHGC_RETURN        {}
 239 #define NOT_SHENANDOAHGC_RETURN_(code) { return code; }
 240 #endif // INCLUDE_SHENANDOAHGC
 241 
 242 #ifndef INCLUDE_ZGC
 243 #define INCLUDE_ZGC 1
 244 #endif // INCLUDE_ZGC
 245 
 246 #if INCLUDE_ZGC
 247 #define ZGC_ONLY(x) x
 248 #define ZGC_ONLY_ARG(arg) arg,
 249 #define NOT_ZGC(x)
 250 #define NOT_ZGC_RETURN        /* next token must be ; */
 251 #define NOT_ZGC_RETURN_(code) /* next token must be ; */
 252 #else
 253 #define ZGC_ONLY(x)
 254 #define ZGC_ONLY_ARG(arg)
 255 #define NOT_ZGC(x) x
 256 #define NOT_ZGC_RETURN        {}
 257 #define NOT_ZGC_RETURN_(code) { return code; }
 258 #endif // INCLUDE_ZGC
 259 
 260 #ifndef INCLUDE_NMT
 261 #define INCLUDE_NMT 1
 262 #endif // INCLUDE_NMT
 263 
 264 #if INCLUDE_NMT
 265 #define NOT_NMT_RETURN        /* next token must be ; */
 266 #define NOT_NMT_RETURN_(code) /* next token must be ; */
 267 #define NMT_ONLY(x) x
 268 #define NOT_NMT(x)
 269 #else
 270 #define NOT_NMT_RETURN        {}
 271 #define NOT_NMT_RETURN_(code) { return code; }
 272 #define NMT_ONLY(x)
 273 #define NOT_NMT(x) x
 274 #endif // INCLUDE_NMT
 275 
 276 #ifndef INCLUDE_JFR
 277 #define INCLUDE_JFR 1
 278 #endif
 279 
 280 #if INCLUDE_JFR
 281 #define JFR_ONLY(code) code
 282 #define NOT_JFR_RETURN_(code) /* next token must be ; */
 283 #else
 284 #define JFR_ONLY(code)
 285 #define NOT_JFR_RETURN_(code) { return code; }
 286 #endif
 287 
 288 #ifndef INCLUDE_JVMCI
 289 #define INCLUDE_JVMCI 1
 290 #endif
 291 
 292 #ifndef INCLUDE_AOT
 293 #define INCLUDE_AOT 1
 294 #endif
 295 
 296 #if INCLUDE_AOT && !INCLUDE_JVMCI
 297 #  error "Must have JVMCI for AOT"
 298 #endif
 299 
 300 #if INCLUDE_JVMCI
 301 #define JVMCI_ONLY(code) code
 302 #define NOT_JVMCI(code)
 303 #define NOT_JVMCI_RETURN /* next token must be ; */
 304 #else
 305 #define JVMCI_ONLY(code)
 306 #define NOT_JVMCI(code) code
 307 #define NOT_JVMCI_RETURN {}
 308 #endif // INCLUDE_JVMCI
 309 
 310 #if INCLUDE_AOT
 311 #define AOT_ONLY(code) code
 312 #define NOT_AOT(code)
 313 #define NOT_AOT_RETURN /* next token must be ; */
 314 #else
 315 #define AOT_ONLY(code)
 316 #define NOT_AOT(code) code
 317 #define NOT_AOT_RETURN {}
 318 #endif // INCLUDE_AOT
 319 
 320 // COMPILER1 variant
 321 #ifdef COMPILER1
 322 #ifdef COMPILER2
 323   #define TIERED
 324 #endif
 325 #define COMPILER1_PRESENT(code) code
 326 #define NOT_COMPILER1(code)
 327 #else // COMPILER1
 328 #define COMPILER1_PRESENT(code)
 329 #define NOT_COMPILER1(code) code
 330 #endif // COMPILER1
 331 
 332 // COMPILER2 variant
 333 #ifdef COMPILER2
 334 #define COMPILER2_PRESENT(code) code
 335 #define NOT_COMPILER2(code)
 336 #else // COMPILER2
 337 #define COMPILER2_PRESENT(code)
 338 #define NOT_COMPILER2(code) code
 339 #endif // COMPILER2
 340 
 341 // COMPILER2 or JVMCI
 342 #if defined(COMPILER2) || INCLUDE_JVMCI
 343 #define COMPILER2_OR_JVMCI 1
 344 #define COMPILER2_OR_JVMCI_PRESENT(code) code
 345 #define NOT_COMPILER2_OR_JVMCI(code)
 346 #else
 347 #define COMPILER2_OR_JVMCI 0
 348 #define COMPILER2_OR_JVMCI_PRESENT(code)
 349 #define NOT_COMPILER2_OR_JVMCI(code) code
 350 #endif
 351 
 352 #ifdef TIERED
 353 #define TIERED_ONLY(code) code
 354 #define NOT_TIERED(code)
 355 #else // TIERED
 356 #define TIERED_ONLY(code)
 357 #define NOT_TIERED(code) code
 358 #endif // TIERED
 359 
 360 
 361 // PRODUCT variant
 362 #ifdef PRODUCT
 363 #define PRODUCT_ONLY(code) code
 364 #define NOT_PRODUCT(code)
 365 #define NOT_PRODUCT_ARG(arg)
 366 #define PRODUCT_RETURN  {}
 367 #define PRODUCT_RETURN0 { return 0; }
 368 #define PRODUCT_RETURN_(code) { code }
 369 #else // PRODUCT
 370 #define PRODUCT_ONLY(code)
 371 #define NOT_PRODUCT(code) code
 372 #define NOT_PRODUCT_ARG(arg) arg,
 373 #define PRODUCT_RETURN  /*next token must be ;*/
 374 #define PRODUCT_RETURN0 /*next token must be ;*/
 375 #define PRODUCT_RETURN_(code)  /*next token must be ;*/
 376 #endif // PRODUCT
 377 
 378 #ifdef CHECK_UNHANDLED_OOPS
 379 #define CHECK_UNHANDLED_OOPS_ONLY(code) code
 380 #define NOT_CHECK_UNHANDLED_OOPS(code)
 381 #else
 382 #define CHECK_UNHANDLED_OOPS_ONLY(code)
 383 #define NOT_CHECK_UNHANDLED_OOPS(code)  code
 384 #endif // CHECK_UNHANDLED_OOPS
 385 
 386 #ifdef CC_INTERP
 387 #define CC_INTERP_ONLY(code) code
 388 #define NOT_CC_INTERP(code)
 389 #else
 390 #define CC_INTERP_ONLY(code)
 391 #define NOT_CC_INTERP(code) code
 392 #endif // CC_INTERP
 393 
 394 #ifdef ASSERT
 395 #define DEBUG_ONLY(code) code
 396 #define NOT_DEBUG(code)
 397 #define NOT_DEBUG_RETURN  /*next token must be ;*/
 398 // Historical.
 399 #define debug_only(code) code
 400 #else // ASSERT
 401 #define DEBUG_ONLY(code)
 402 #define NOT_DEBUG(code) code
 403 #define NOT_DEBUG_RETURN {}
 404 #define debug_only(code)
 405 #endif // ASSERT
 406 
 407 #ifdef  _LP64
 408 #define LP64_ONLY(code) code
 409 #define NOT_LP64(code)
 410 #else  // !_LP64
 411 #define LP64_ONLY(code)
 412 #define NOT_LP64(code) code
 413 #endif // _LP64
 414 
 415 #ifdef LINUX
 416 #define LINUX_ONLY(code) code
 417 #define NOT_LINUX(code)
 418 #else
 419 #define LINUX_ONLY(code)
 420 #define NOT_LINUX(code) code
 421 #endif
 422 
 423 #ifdef AIX
 424 #define AIX_ONLY(code) code
 425 #define NOT_AIX(code)
 426 #else
 427 #define AIX_ONLY(code)
 428 #define NOT_AIX(code) code
 429 #endif
 430 
 431 #ifdef SOLARIS
 432 #define SOLARIS_ONLY(code) code
 433 #define NOT_SOLARIS(code)
 434 #else
 435 #define SOLARIS_ONLY(code)
 436 #define NOT_SOLARIS(code) code
 437 #endif
 438 
 439 #ifdef _WINDOWS
 440 #define WINDOWS_ONLY(code) code
 441 #define NOT_WINDOWS(code)
 442 #else
 443 #define WINDOWS_ONLY(code)
 444 #define NOT_WINDOWS(code) code
 445 #endif
 446 
 447 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
 448 #ifndef BSD
 449 #define BSD
 450 #endif // BSD defined in <sys/param.h>
 451 #define BSD_ONLY(code) code
 452 #define NOT_BSD(code)
 453 #else
 454 #define BSD_ONLY(code)
 455 #define NOT_BSD(code) code
 456 #endif
 457 
 458 #ifdef _WIN64
 459 #define WIN64_ONLY(code) code
 460 #define NOT_WIN64(code)
 461 #else
 462 #define WIN64_ONLY(code)
 463 #define NOT_WIN64(code) code
 464 #endif
 465 
 466 #if defined(ZERO)
 467 #define ZERO_ONLY(code) code
 468 #define NOT_ZERO(code)
 469 #else
 470 #define ZERO_ONLY(code)
 471 #define NOT_ZERO(code) code
 472 #endif
 473 
 474 #if defined(IA32) || defined(AMD64)
 475 #define X86
 476 #define X86_ONLY(code) code
 477 #define NOT_X86(code)
 478 #else
 479 #undef X86
 480 #define X86_ONLY(code)
 481 #define NOT_X86(code) code
 482 #endif
 483 
 484 #ifdef IA32
 485 #define IA32_ONLY(code) code
 486 #define NOT_IA32(code)
 487 #else
 488 #define IA32_ONLY(code)
 489 #define NOT_IA32(code) code
 490 #endif
 491 
 492 // This is a REALLY BIG HACK, but on AIX <sys/systemcfg.h> unconditionally defines IA64.
 493 // At least on AIX 7.1 this is a real problem because 'systemcfg.h' is indirectly included
 494 // by 'pthread.h' and other common system headers.
 495 
 496 #if defined(IA64) && !defined(AIX)
 497 #define IA64_ONLY(code) code
 498 #define NOT_IA64(code)
 499 #else
 500 #define IA64_ONLY(code)
 501 #define NOT_IA64(code) code
 502 #endif
 503 
 504 #ifdef AMD64
 505 #define AMD64_ONLY(code) code
 506 #define NOT_AMD64(code)
 507 #else
 508 #define AMD64_ONLY(code)
 509 #define NOT_AMD64(code) code
 510 #endif
 511 
 512 #ifdef S390
 513 #define S390_ONLY(code) code
 514 #define NOT_S390(code)
 515 #else
 516 #define S390_ONLY(code)
 517 #define NOT_S390(code) code
 518 #endif
 519 
 520 #ifdef SPARC
 521 #define SPARC_ONLY(code) code
 522 #define NOT_SPARC(code)
 523 #else
 524 #define SPARC_ONLY(code)
 525 #define NOT_SPARC(code) code
 526 #endif
 527 
 528 #if defined(PPC32) || defined(PPC64)
 529 #ifndef PPC
 530 #define PPC
 531 #endif
 532 #define PPC_ONLY(code) code
 533 #define NOT_PPC(code)
 534 #else
 535 #undef PPC
 536 #define PPC_ONLY(code)
 537 #define NOT_PPC(code) code
 538 #endif
 539 
 540 #ifdef PPC32
 541 #define PPC32_ONLY(code) code
 542 #define NOT_PPC32(code)
 543 #else
 544 #define PPC32_ONLY(code)
 545 #define NOT_PPC32(code) code
 546 #endif
 547 
 548 #ifdef PPC64
 549 #define PPC64_ONLY(code) code
 550 #define NOT_PPC64(code)
 551 #else
 552 #define PPC64_ONLY(code)
 553 #define NOT_PPC64(code) code
 554 #endif
 555 
 556 #ifdef E500V2
 557 #define E500V2_ONLY(code) code
 558 #define NOT_E500V2(code)
 559 #else
 560 #define E500V2_ONLY(code)
 561 #define NOT_E500V2(code) code
 562 #endif
 563 
 564 // Note: There are two ARM ports. They set the following in the makefiles:
 565 // 1. 32-bit port:   -DARM -DARM32 -DTARGET_ARCH_arm
 566 // 2. 64-bit port:   -DAARCH64 -D_LP64 -DTARGET_ARCH_aaarch64
 567 #ifdef ARM
 568 #define ARM_ONLY(code) code
 569 #define NOT_ARM(code)
 570 #else
 571 #define ARM_ONLY(code)
 572 #define NOT_ARM(code) code
 573 #endif
 574 
 575 #ifdef ARM32
 576 #define ARM32_ONLY(code) code
 577 #define NOT_ARM32(code)
 578 #else
 579 #define ARM32_ONLY(code)
 580 #define NOT_ARM32(code) code
 581 #endif
 582 
 583 #ifdef AARCH64
 584 #define AARCH64_ONLY(code) code
 585 #define NOT_AARCH64(code)
 586 #else
 587 #define AARCH64_ONLY(code)
 588 #define NOT_AARCH64(code) code
 589 #endif
 590 
 591 #ifdef VM_LITTLE_ENDIAN
 592 #define LITTLE_ENDIAN_ONLY(code) code
 593 #define BIG_ENDIAN_ONLY(code)
 594 #else
 595 #define LITTLE_ENDIAN_ONLY(code)
 596 #define BIG_ENDIAN_ONLY(code) code
 597 #endif
 598 
 599 #define define_pd_global(type, name, value) const type pd_##name = value;
 600 
 601 // Helper macros for constructing file names for includes.
 602 #define CPU_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_CPU)
 603 #define OS_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_OS)
 604 #define OS_CPU_HEADER_STEM(basename) PASTE_TOKENS(basename, PASTE_TOKENS(INCLUDE_SUFFIX_OS, INCLUDE_SUFFIX_CPU))
 605 #define COMPILER_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_COMPILER)
 606 
 607 // Include platform dependent files.
 608 //
 609 // This macro constructs from basename and INCLUDE_SUFFIX_OS /
 610 // INCLUDE_SUFFIX_CPU / INCLUDE_SUFFIX_COMPILER, which are set on
 611 // the command line, the name of platform dependent files to be included.
 612 // Example: INCLUDE_SUFFIX_OS=_linux / INCLUDE_SUFFIX_CPU=_sparc
 613 //   CPU_HEADER_INLINE(macroAssembler) --> macroAssembler_sparc.inline.hpp
 614 //   OS_CPU_HEADER(vmStructs)          --> vmStructs_linux_sparc.hpp
 615 //
 616 // basename<cpu>.hpp / basename<cpu>.inline.hpp
 617 #define CPU_HEADER_H(basename)         XSTR(CPU_HEADER_STEM(basename).h)
 618 #define CPU_HEADER(basename)           XSTR(CPU_HEADER_STEM(basename).hpp)
 619 #define CPU_HEADER_INLINE(basename)    XSTR(CPU_HEADER_STEM(basename).inline.hpp)
 620 // basename<os>.hpp / basename<os>.inline.hpp
 621 #define OS_HEADER_H(basename)          XSTR(OS_HEADER_STEM(basename).h)
 622 #define OS_HEADER(basename)            XSTR(OS_HEADER_STEM(basename).hpp)
 623 #define OS_HEADER_INLINE(basename)     XSTR(OS_HEADER_STEM(basename).inline.hpp)
 624 // basename<os><cpu>.hpp / basename<os><cpu>.inline.hpp
 625 #define OS_CPU_HEADER(basename)        XSTR(OS_CPU_HEADER_STEM(basename).hpp)
 626 #define OS_CPU_HEADER_INLINE(basename) XSTR(OS_CPU_HEADER_STEM(basename).inline.hpp)
 627 // basename<compiler>.hpp / basename<compiler>.inline.hpp
 628 #define COMPILER_HEADER(basename)        XSTR(COMPILER_HEADER_STEM(basename).hpp)
 629 #define COMPILER_HEADER_INLINE(basename) XSTR(COMPILER_HEADER_STEM(basename).inline.hpp)
 630 
 631 #if INCLUDE_CDS && INCLUDE_G1GC && defined(_LP64) && !defined(_WINDOWS)
 632 #define INCLUDE_CDS_JAVA_HEAP 1
 633 #define CDS_JAVA_HEAP_ONLY(x) x
 634 #define NOT_CDS_JAVA_HEAP(x)
 635 #define NOT_CDS_JAVA_HEAP_RETURN
 636 #define NOT_CDS_JAVA_HEAP_RETURN_(code)
 637 #else
 638 #define INCLUDE_CDS_JAVA_HEAP 0
 639 #define CDS_JAVA_HEAP_ONLY(x)
 640 #define NOT_CDS_JAVA_HEAP(x) x
 641 #define NOT_CDS_JAVA_HEAP_RETURN        {}
 642 #define NOT_CDS_JAVA_HEAP_RETURN_(code) { return code; }
 643 #endif
 644 
 645 #endif // SHARE_UTILITIES_MACROS_HPP