1 /*
   2  * Copyright (c) 1997, 2018, 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 // -DINCLUDE_<something>=0 | 1 can be specified on the command line to include
  38 // or exclude functionality.
  39 
  40 #ifndef INCLUDE_JVMTI
  41 #define INCLUDE_JVMTI 1
  42 #endif  // INCLUDE_JVMTI
  43 
  44 #if INCLUDE_JVMTI
  45 #define JVMTI_ONLY(x) x
  46 #define NOT_JVMTI(x)
  47 #define NOT_JVMTI_RETURN
  48 #define NOT_JVMTI_RETURN_(code) /* next token must be ; */
  49 #else
  50 #define JVMTI_ONLY(x)
  51 #define NOT_JVMTI(x) x
  52 #define NOT_JVMTI_RETURN { return; }
  53 #define NOT_JVMTI_RETURN_(code) { return code; }
  54 #endif // INCLUDE_JVMTI
  55 
  56 #ifndef INCLUDE_FPROF
  57 #define INCLUDE_FPROF 1
  58 #endif
  59 
  60 #if INCLUDE_FPROF
  61 #define NOT_FPROF_RETURN        /* next token must be ; */
  62 #define NOT_FPROF_RETURN_(code) /* next token must be ; */
  63 #else
  64 #define NOT_FPROF_RETURN                {}
  65 #define NOT_FPROF_RETURN_(code) { return code; }
  66 #endif // INCLUDE_FPROF
  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_RETURN_(code) /* next token must be ; */
 113 #else
 114 #define CDS_ONLY(x)
 115 #define NOT_CDS(x) x
 116 #define NOT_CDS_RETURN          {}
 117 #define NOT_CDS_RETURN_(code) { return code; }
 118 #endif // INCLUDE_CDS
 119 
 120 #ifndef INCLUDE_MANAGEMENT
 121 #define INCLUDE_MANAGEMENT 1
 122 #endif // INCLUDE_MANAGEMENT
 123 
 124 #if INCLUDE_MANAGEMENT
 125 #define NOT_MANAGEMENT_RETURN        /* next token must be ; */
 126 #define NOT_MANAGEMENT_RETURN_(code) /* next token must be ; */
 127 #else
 128 #define NOT_MANAGEMENT_RETURN        {}
 129 #define NOT_MANAGEMENT_RETURN_(code) { return code; }
 130 #endif // INCLUDE_MANAGEMENT
 131 
 132 /*
 133  * When INCLUDE_ALL_GCS is false the only garbage collectors
 134  * included in the JVM are defaultNewGeneration and markCompact.
 135  *
 136  * When INCLUDE_ALL_GCS is true all garbage collectors are
 137  * included in the JVM.
 138  */
 139 #ifndef INCLUDE_ALL_GCS
 140 #define INCLUDE_ALL_GCS 1
 141 #endif // INCLUDE_ALL_GCS
 142 
 143 #if INCLUDE_ALL_GCS
 144 #define NOT_ALL_GCS_RETURN        /* next token must be ; */
 145 #define NOT_ALL_GCS_RETURN_(code) /* next token must be ; */
 146 #else
 147 #define NOT_ALL_GCS_RETURN        {}
 148 #define NOT_ALL_GCS_RETURN_(code) { return code; }
 149 #endif // INCLUDE_ALL_GCS
 150 
 151 #ifndef INCLUDE_NMT
 152 #define INCLUDE_NMT 1
 153 #endif // INCLUDE_NMT
 154 
 155 #if INCLUDE_NMT
 156 #define NOT_NMT_RETURN        /* next token must be ; */
 157 #define NOT_NMT_RETURN_(code) /* next token must be ; */
 158 #else
 159 #define NOT_NMT_RETURN        {}
 160 #define NOT_NMT_RETURN_(code) { return code; }
 161 #endif // INCLUDE_NMT
 162 
 163 #ifndef INCLUDE_JFR
 164 #define INCLUDE_JFR 1
 165 #endif
 166 
 167 #if INCLUDE_JFR
 168 #define JFR_ONLY(code) code
 169 #else
 170 #define JFR_ONLY(code)
 171 #endif
 172 
 173 // COMPILER1 variant
 174 #ifdef COMPILER1
 175 #ifdef COMPILER2
 176   #define TIERED
 177 #endif
 178 #define COMPILER1_PRESENT(code) code

 179 #else // COMPILER1
 180 #define COMPILER1_PRESENT(code)

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