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