1 /*
   2  * Copyright (c) 1997, 2017, 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 // 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_G1GC
 153 #define INCLUDE_G1GC 1
 154 #endif // INCLUDE_G1GC
 155 
 156 #if INCLUDE_G1GC
 157 #define G1GC_ONLY(x) x
 158 #define G1GC_ONLY_ARG(arg) arg,
 159 #define NOT_G1GC(x)
 160 #define NOT_G1GC_RETURN        /* next token must be ; */
 161 #define NOT_G1GC_RETURN_(code) /* next token must be ; */
 162 #else
 163 #define G1GC_ONLY(x)
 164 #define G1GC_ONLY_ARG(arg)
 165 #define NOT_G1GC(x) x
 166 #define NOT_G1GC_RETURN        {}
 167 #define NOT_G1GC_RETURN_(code) { return code; }
 168 #endif // INCLUDE_G1GC
 169 
 170 #ifndef INCLUDE_PARALLELGC
 171 #define INCLUDE_PARALLELGC 1
 172 #endif // INCLUDE_PARALLELGC
 173 
 174 #if INCLUDE_PARALLELGC
 175 #define PARALLELGC_ONLY(x) x
 176 #define PARALLELGC_ONLY_ARG(arg) arg,
 177 #define NOT_PARALLELGC(x)
 178 #define NOT_PARALLELGC_RETURN        /* next token must be ; */
 179 #define NOT_PARALLELGC_RETURN_(code) /* next token must be ; */
 180 #else
 181 #define PARALLELGC_ONLY(x)
 182 #define PARALLELGC_ONLY_ARG(arg)
 183 #define NOT_PARALLELGC(x) x
 184 #define NOT_PARALLELGC_RETURN        {}
 185 #define NOT_PARALLELGC_RETURN_(code) { return code; }
 186 #endif // INCLUDE_PARALLELGC
 187 
 188 #ifndef INCLUDE_SERIALGC
 189 #define INCLUDE_SERIALGC 1
 190 #endif // INCLUDE_SERIALGC
 191 
 192 #if INCLUDE_SERIALGC
 193 #define SERIALGC_ONLY(x) x
 194 #define SERIALGC_ONLY_ARG(arg) arg,
 195 #define NOT_SERIALGC(x)
 196 #define NOT_SERIALGC_RETURN        /* next token must be ; */
 197 #define NOT_SERIALGC_RETURN_(code) /* next token must be ; */
 198 #else
 199 #define SERIALGC_ONLY(x)
 200 #define SERIALGC_ONLY_ARG(arg)
 201 #define NOT_SERIALGC(x) x
 202 #define NOT_SERIALGC_RETURN        {}
 203 #define NOT_SERIALGC_RETURN_(code) { return code; }
 204 #endif // INCLUDE_SERIALGC
 205 
 206 #if INCLUDE_CMSGC || INCLUDE_G1GC || INCLUDE_PARALLELGC
 207 #define INCLUDE_NOT_ONLY_SERIALGC 1
 208 #else
 209 #define INCLUDE_NOT_ONLY_SERIALGC 0
 210 #endif
 211 
 212 #define INCLUDE_OOP_OOP_ITERATE_BACKWARDS INCLUDE_NOT_ONLY_SERIALGC
 213 
 214 #ifndef INCLUDE_NMT
 215 #define INCLUDE_NMT 1
 216 #endif // INCLUDE_NMT
 217 
 218 #if INCLUDE_NMT
 219 #define NOT_NMT_RETURN        /* next token must be ; */
 220 #define NOT_NMT_RETURN_(code) /* next token must be ; */
 221 #define NMT_ONLY(x) x
 222 #define NOT_NMT(x)
 223 #else
 224 #define NOT_NMT_RETURN        {}
 225 #define NOT_NMT_RETURN_(code) { return code; }
 226 #define NMT_ONLY(x)
 227 #define NOT_NMT(x) x
 228 #endif // INCLUDE_NMT
 229 
 230 #ifndef INCLUDE_TRACE
 231 #define INCLUDE_TRACE 1
 232 #endif // INCLUDE_TRACE
 233 
 234 #ifndef INCLUDE_JVMCI
 235 #define INCLUDE_JVMCI 1
 236 #endif
 237 
 238 #ifndef INCLUDE_AOT
 239 #define INCLUDE_AOT 1
 240 #endif
 241 
 242 #if INCLUDE_AOT && !INCLUDE_JVMCI
 243 #  error "Must have JVMCI for AOT"
 244 #endif
 245 
 246 #if INCLUDE_JVMCI
 247 #define JVMCI_ONLY(code) code
 248 #define NOT_JVMCI(code)
 249 #define NOT_JVMCI_RETURN /* next token must be ; */
 250 #else
 251 #define JVMCI_ONLY(code)
 252 #define NOT_JVMCI(code) code
 253 #define NOT_JVMCI_RETURN {}
 254 #endif // INCLUDE_JVMCI
 255 
 256 #if INCLUDE_AOT
 257 #define AOT_ONLY(code) code
 258 #define NOT_AOT(code)
 259 #define NOT_AOT_RETURN /* next token must be ; */
 260 #else
 261 #define AOT_ONLY(code)
 262 #define NOT_AOT(code) code
 263 #define NOT_AOT_RETURN {}
 264 #endif // INCLUDE_AOT
 265 
 266 // COMPILER1 variant
 267 #ifdef COMPILER1
 268 #ifdef COMPILER2
 269   #define TIERED
 270 #endif
 271 #define COMPILER1_PRESENT(code) code
 272 #define NOT_COMPILER1(code)
 273 #else // COMPILER1
 274 #define COMPILER1_PRESENT(code)
 275 #define NOT_COMPILER1(code) code
 276 #endif // COMPILER1
 277 
 278 // COMPILER2 variant
 279 #ifdef COMPILER2
 280 #define COMPILER2_PRESENT(code) code
 281 #define NOT_COMPILER2(code)
 282 #else // COMPILER2
 283 #define COMPILER2_PRESENT(code)
 284 #define NOT_COMPILER2(code) code
 285 #endif // COMPILER2
 286 
 287 // COMPILER2 or JVMCI
 288 #if defined(COMPILER2) || INCLUDE_JVMCI
 289 #define COMPILER2_OR_JVMCI 1
 290 #define COMPILER2_OR_JVMCI_PRESENT(code) code
 291 #define NOT_COMPILER2_OR_JVMCI(code)
 292 #else
 293 #define COMPILER2_OR_JVMCI 0
 294 #define COMPILER2_OR_JVMCI_PRESENT(code)
 295 #define NOT_COMPILER2_OR_JVMCI(code) code
 296 #endif
 297 
 298 #ifdef TIERED
 299 #define TIERED_ONLY(code) code
 300 #define NOT_TIERED(code)
 301 #else // TIERED
 302 #define TIERED_ONLY(code)
 303 #define NOT_TIERED(code) code
 304 #endif // TIERED
 305 
 306 
 307 // PRODUCT variant
 308 #ifdef PRODUCT
 309 #define PRODUCT_ONLY(code) code
 310 #define NOT_PRODUCT(code)
 311 #define NOT_PRODUCT_ARG(arg)
 312 #define PRODUCT_RETURN  {}
 313 #define PRODUCT_RETURN0 { return 0; }
 314 #define PRODUCT_RETURN_(code) { code }
 315 #else // PRODUCT
 316 #define PRODUCT_ONLY(code)
 317 #define NOT_PRODUCT(code) code
 318 #define NOT_PRODUCT_ARG(arg) arg,
 319 #define PRODUCT_RETURN  /*next token must be ;*/
 320 #define PRODUCT_RETURN0 /*next token must be ;*/
 321 #define PRODUCT_RETURN_(code)  /*next token must be ;*/
 322 #endif // PRODUCT
 323 
 324 #ifdef CHECK_UNHANDLED_OOPS
 325 #define CHECK_UNHANDLED_OOPS_ONLY(code) code
 326 #define NOT_CHECK_UNHANDLED_OOPS(code)
 327 #else
 328 #define CHECK_UNHANDLED_OOPS_ONLY(code)
 329 #define NOT_CHECK_UNHANDLED_OOPS(code)  code
 330 #endif // CHECK_UNHANDLED_OOPS
 331 
 332 #ifdef CC_INTERP
 333 #define CC_INTERP_ONLY(code) code
 334 #define NOT_CC_INTERP(code)
 335 #else
 336 #define CC_INTERP_ONLY(code)
 337 #define NOT_CC_INTERP(code) code
 338 #endif // CC_INTERP
 339 
 340 #ifdef ASSERT
 341 #define DEBUG_ONLY(code) code
 342 #define NOT_DEBUG(code)
 343 #define NOT_DEBUG_RETURN  /*next token must be ;*/
 344 // Historical.
 345 #define debug_only(code) code
 346 #else // ASSERT
 347 #define DEBUG_ONLY(code)
 348 #define NOT_DEBUG(code) code
 349 #define NOT_DEBUG_RETURN {}
 350 #define debug_only(code)
 351 #endif // ASSERT
 352 
 353 #ifdef  _LP64
 354 #define LP64_ONLY(code) code
 355 #define NOT_LP64(code)
 356 #else  // !_LP64
 357 #define LP64_ONLY(code)
 358 #define NOT_LP64(code) code
 359 #endif // _LP64
 360 
 361 #ifdef LINUX
 362 #define LINUX_ONLY(code) code
 363 #define NOT_LINUX(code)
 364 #else
 365 #define LINUX_ONLY(code)
 366 #define NOT_LINUX(code) code
 367 #endif
 368 
 369 #ifdef AIX
 370 #define AIX_ONLY(code) code
 371 #define NOT_AIX(code)
 372 #else
 373 #define AIX_ONLY(code)
 374 #define NOT_AIX(code) code
 375 #endif
 376 
 377 #ifdef SOLARIS
 378 #define SOLARIS_ONLY(code) code
 379 #define NOT_SOLARIS(code)
 380 #else
 381 #define SOLARIS_ONLY(code)
 382 #define NOT_SOLARIS(code) code
 383 #endif
 384 
 385 #ifdef _WINDOWS
 386 #define WINDOWS_ONLY(code) code
 387 #define NOT_WINDOWS(code)
 388 #else
 389 #define WINDOWS_ONLY(code)
 390 #define NOT_WINDOWS(code) code
 391 #endif
 392 
 393 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
 394 #ifndef BSD
 395 #define BSD
 396 #endif // BSD defined in <sys/param.h>
 397 #define BSD_ONLY(code) code
 398 #define NOT_BSD(code)
 399 #else
 400 #define BSD_ONLY(code)
 401 #define NOT_BSD(code) code
 402 #endif
 403 
 404 #ifdef _WIN64
 405 #define WIN64_ONLY(code) code
 406 #define NOT_WIN64(code)
 407 #else
 408 #define WIN64_ONLY(code)
 409 #define NOT_WIN64(code) code
 410 #endif
 411 
 412 #if defined(ZERO)
 413 #define ZERO_ONLY(code) code
 414 #define NOT_ZERO(code)
 415 #else
 416 #define ZERO_ONLY(code)
 417 #define NOT_ZERO(code) code
 418 #endif
 419 
 420 #if defined(IA32) || defined(AMD64)
 421 #define X86
 422 #define X86_ONLY(code) code
 423 #define NOT_X86(code)
 424 #else
 425 #undef X86
 426 #define X86_ONLY(code)
 427 #define NOT_X86(code) code
 428 #endif
 429 
 430 #ifdef IA32
 431 #define IA32_ONLY(code) code
 432 #define NOT_IA32(code)
 433 #else
 434 #define IA32_ONLY(code)
 435 #define NOT_IA32(code) code
 436 #endif
 437 
 438 // This is a REALLY BIG HACK, but on AIX <sys/systemcfg.h> unconditionally defines IA64.
 439 // At least on AIX 7.1 this is a real problem because 'systemcfg.h' is indirectly included
 440 // by 'pthread.h' and other common system headers.
 441 
 442 #if defined(IA64) && !defined(AIX)
 443 #define IA64_ONLY(code) code
 444 #define NOT_IA64(code)
 445 #else
 446 #define IA64_ONLY(code)
 447 #define NOT_IA64(code) code
 448 #endif
 449 
 450 #ifdef AMD64
 451 #define AMD64_ONLY(code) code
 452 #define NOT_AMD64(code)
 453 #else
 454 #define AMD64_ONLY(code)
 455 #define NOT_AMD64(code) code
 456 #endif
 457 
 458 #ifdef S390
 459 #define S390_ONLY(code) code
 460 #define NOT_S390(code)
 461 #else
 462 #define S390_ONLY(code)
 463 #define NOT_S390(code) code
 464 #endif
 465 
 466 #ifdef SPARC
 467 #define SPARC_ONLY(code) code
 468 #define NOT_SPARC(code)
 469 #else
 470 #define SPARC_ONLY(code)
 471 #define NOT_SPARC(code) code
 472 #endif
 473 
 474 #if defined(PPC32) || defined(PPC64)
 475 #ifndef PPC
 476 #define PPC
 477 #endif
 478 #define PPC_ONLY(code) code
 479 #define NOT_PPC(code)
 480 #else
 481 #undef PPC
 482 #define PPC_ONLY(code)
 483 #define NOT_PPC(code) code
 484 #endif
 485 
 486 #ifdef PPC32
 487 #define PPC32_ONLY(code) code
 488 #define NOT_PPC32(code)
 489 #else
 490 #define PPC32_ONLY(code)
 491 #define NOT_PPC32(code) code
 492 #endif
 493 
 494 #ifdef PPC64
 495 #define PPC64_ONLY(code) code
 496 #define NOT_PPC64(code)
 497 #else
 498 #define PPC64_ONLY(code)
 499 #define NOT_PPC64(code) code
 500 #endif
 501 
 502 #ifdef E500V2
 503 #define E500V2_ONLY(code) code
 504 #define NOT_E500V2(code)
 505 #else
 506 #define E500V2_ONLY(code)
 507 #define NOT_E500V2(code) code
 508 #endif
 509 
 510 // Note: There are three ARM ports. They set the following in the makefiles:
 511 // 1. Closed 32-bit port:   -DARM -DARM32           -DTARGET_ARCH_arm
 512 // 2. Closed 64-bit port:   -DARM -DAARCH64 -D_LP64 -DTARGET_ARCH_arm
 513 // 3. Open   64-bit port:         -DAARCH64 -D_LP64 -DTARGET_ARCH_aaarch64
 514 #ifdef ARM
 515 #define ARM_ONLY(code) code
 516 #define NOT_ARM(code)
 517 #else
 518 #define ARM_ONLY(code)
 519 #define NOT_ARM(code) code
 520 #endif
 521 
 522 #ifdef ARM32
 523 #define ARM32_ONLY(code) code
 524 #define NOT_ARM32(code)
 525 #else
 526 #define ARM32_ONLY(code)
 527 #define NOT_ARM32(code) code
 528 #endif
 529 
 530 #ifdef AARCH64
 531 #define AARCH64_ONLY(code) code
 532 #define NOT_AARCH64(code)
 533 #else
 534 #define AARCH64_ONLY(code)
 535 #define NOT_AARCH64(code) code
 536 #endif
 537 
 538 #define define_pd_global(type, name, value) const type pd_##name = value;
 539 
 540 // Helper macros for constructing file names for includes.
 541 #define CPU_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_CPU)
 542 #define OS_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_OS)
 543 #define OS_CPU_HEADER_STEM(basename) PASTE_TOKENS(basename, PASTE_TOKENS(INCLUDE_SUFFIX_OS, INCLUDE_SUFFIX_CPU))
 544 #define COMPILER_HEADER_STEM(basename) PASTE_TOKENS(basename, INCLUDE_SUFFIX_COMPILER)
 545 
 546 // Include platform dependent files.
 547 //
 548 // This macro constructs from basename and INCLUDE_SUFFIX_OS /
 549 // INCLUDE_SUFFIX_CPU / INCLUDE_SUFFIX_COMPILER, which are set on
 550 // the command line, the name of platform dependent files to be included.
 551 // Example: INCLUDE_SUFFIX_OS=_linux / INCLUDE_SUFFIX_CPU=_sparc
 552 //   CPU_HEADER_INLINE(macroAssembler) --> macroAssembler_sparc.inline.hpp
 553 //   OS_CPU_HEADER(vmStructs)          --> vmStructs_linux_sparc.hpp
 554 //
 555 // basename<cpu>.hpp / basename<cpu>.inline.hpp
 556 #define CPU_HEADER_H(basename)         XSTR(CPU_HEADER_STEM(basename).h)
 557 #define CPU_HEADER(basename)           XSTR(CPU_HEADER_STEM(basename).hpp)
 558 #define CPU_HEADER_INLINE(basename)    XSTR(CPU_HEADER_STEM(basename).inline.hpp)
 559 // basename<os>.hpp / basename<os>.inline.hpp
 560 #define OS_HEADER_H(basename)          XSTR(OS_HEADER_STEM(basename).h)
 561 #define OS_HEADER(basename)            XSTR(OS_HEADER_STEM(basename).hpp)
 562 #define OS_HEADER_INLINE(basename)     XSTR(OS_HEADER_STEM(basename).inline.hpp)
 563 // basename<os><cpu>.hpp / basename<os><cpu>.inline.hpp
 564 #define OS_CPU_HEADER(basename)        XSTR(OS_CPU_HEADER_STEM(basename).hpp)
 565 #define OS_CPU_HEADER_INLINE(basename) XSTR(OS_CPU_HEADER_STEM(basename).inline.hpp)
 566 // basename<compiler>.hpp / basename<compiler>.inline.hpp
 567 #define COMPILER_HEADER(basename)        XSTR(COMPILER_HEADER_STEM(basename).hpp)
 568 #define COMPILER_HEADER_INLINE(basename) XSTR(COMPILER_HEADER_STEM(basename).inline.hpp)
 569 
 570 // To use Atomic::inc(jshort* dest) and Atomic::dec(jshort* dest), the address must be specially
 571 // aligned, such that (*dest) occupies the upper 16 bits of an aligned 32-bit word. The best way to
 572 // achieve is to place your short value next to another short value, which doesn't need atomic ops.
 573 //
 574 // Example
 575 //  ATOMIC_SHORT_PAIR(
 576 //    volatile short _refcount,  // needs atomic operation
 577 //    unsigned short _length     // number of UTF8 characters in the symbol (does not need atomic op)
 578 //  );
 579 
 580 #ifdef VM_LITTLE_ENDIAN
 581   #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl)  \
 582     non_atomic_decl;                                       \
 583     atomic_decl
 584 #else
 585   #define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl)  \
 586     atomic_decl;                                           \
 587     non_atomic_decl
 588 #endif
 589 
 590 #if INCLUDE_CDS && INCLUDE_G1GC && defined(_LP64) && !defined(_WINDOWS)
 591 #define INCLUDE_CDS_JAVA_HEAP 1
 592 #define CDS_JAVA_HEAP_ONLY(x) x
 593 #define NOT_CDS_JAVA_HEAP(x)
 594 #define NOT_CDS_JAVA_HEAP_RETURN
 595 #define NOT_CDS_JAVA_HEAP_RETURN_(code)
 596 #else
 597 #define INCLUDE_CDS_JAVA_HEAP 0
 598 #define CDS_JAVA_HEAP_ONLY(x)
 599 #define NOT_CDS_JAVA_HEAP(x) x
 600 #define NOT_CDS_JAVA_HEAP_RETURN        {}
 601 #define NOT_CDS_JAVA_HEAP_RETURN_(code) { return code; }
 602 #endif
 603 
 604 #endif // SHARE_VM_UTILITIES_MACROS_HPP