1 /*
   2  * Copyright (c) 1997, 2010, 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 // On solaris _LP64 is setup in sys/types.h, all other OSes define _LP64 in the
  29 // make files. It's important that globalDefinitions_<compiler>.hpp has been
  30 // included before this file is included.
  31 
  32 // Use this to mark code that needs to be cleaned up (for development only)
  33 #define NEEDS_CLEANUP
  34 
  35 // Makes a string of the argument (which is not macro-expanded)
  36 #define STR(a)  #a
  37 
  38 // Makes a string of the macro expansion of a
  39 #define XSTR(a) STR(a)
  40 
  41 // KERNEL variant
  42 #ifdef KERNEL
  43 #define COMPILER1
  44 #define SERIALGC
  45 
  46 #define JVMTI_KERNEL
  47 #define FPROF_KERNEL
  48 #define VM_STRUCTS_KERNEL
  49 #define JNICHECK_KERNEL
  50 #define SERVICES_KERNEL
  51 
  52 #define KERNEL_RETURN        {}
  53 #define KERNEL_RETURN_(code) { code }
  54 
  55 #else  // KERNEL
  56 
  57 #define KERNEL_RETURN        /* next token must be ; */
  58 #define KERNEL_RETURN_(code) /* next token must be ; */
  59 
  60 #endif // KERNEL
  61 
  62 // COMPILER1 variant
  63 #ifdef COMPILER1
  64 #ifdef COMPILER2
  65   #define TIERED
  66 #endif
  67 #define COMPILER1_PRESENT(code) code
  68 #else // COMPILER1
  69 #define COMPILER1_PRESENT(code)
  70 #endif // COMPILER1
  71 
  72 // COMPILER2 variant
  73 #ifdef COMPILER2
  74 #define COMPILER2_PRESENT(code) code
  75 #define NOT_COMPILER2(code)
  76 #else // COMPILER2
  77 #define COMPILER2_PRESENT(code)
  78 #define NOT_COMPILER2(code) code
  79 #endif // COMPILER2
  80 
  81 #ifdef TIERED
  82 #define TIERED_ONLY(code) code
  83 #define NOT_TIERED(code)
  84 #else
  85 #define TIERED_ONLY(code)
  86 #define NOT_TIERED(code) code
  87 #endif // TIERED
  88 
  89 
  90 // PRODUCT variant
  91 #ifdef PRODUCT
  92 #define PRODUCT_ONLY(code) code
  93 #define NOT_PRODUCT(code)
  94 #define NOT_PRODUCT_ARG(arg)
  95 #define PRODUCT_RETURN  {}
  96 #define PRODUCT_RETURN0 { return 0; }
  97 #define PRODUCT_RETURN_(code) { code }
  98 #else // PRODUCT
  99 #define PRODUCT_ONLY(code)
 100 #define NOT_PRODUCT(code) code
 101 #define NOT_PRODUCT_ARG(arg) arg,
 102 #define PRODUCT_RETURN  /*next token must be ;*/
 103 #define PRODUCT_RETURN0 /*next token must be ;*/
 104 #define PRODUCT_RETURN_(code)  /*next token must be ;*/
 105 #endif // PRODUCT
 106 
 107 #ifdef CHECK_UNHANDLED_OOPS
 108 #define CHECK_UNHANDLED_OOPS_ONLY(code) code
 109 #define NOT_CHECK_UNHANDLED_OOPS(code)
 110 #else
 111 #define CHECK_UNHANDLED_OOPS_ONLY(code)
 112 #define NOT_CHECK_UNHANDLED_OOPS(code)  code
 113 #endif // CHECK_UNHANDLED_OOPS
 114 
 115 #ifdef CC_INTERP
 116 #define CC_INTERP_ONLY(code) code
 117 #define NOT_CC_INTERP(code)
 118 #else
 119 #define CC_INTERP_ONLY(code)
 120 #define NOT_CC_INTERP(code) code
 121 #endif // CC_INTERP
 122 
 123 #ifdef ASSERT
 124 #define DEBUG_ONLY(code) code
 125 #define NOT_DEBUG(code)
 126 #define NOT_DEBUG_RETURN  /*next token must be ;*/
 127 // Historical.
 128 #define debug_only(code) code
 129 #else // ASSERT
 130 #define DEBUG_ONLY(code)
 131 #define NOT_DEBUG(code) code
 132 #define NOT_DEBUG_RETURN {}
 133 #define debug_only(code)
 134 #endif // ASSERT
 135 
 136 #ifdef  _LP64
 137 #define LP64_ONLY(code) code
 138 #define NOT_LP64(code)
 139 #else  // !_LP64
 140 #define LP64_ONLY(code)
 141 #define NOT_LP64(code) code
 142 #endif // _LP64
 143 
 144 #ifdef LINUX
 145 #define LINUX_ONLY(code) code
 146 #define NOT_LINUX(code)
 147 #else
 148 #define LINUX_ONLY(code)
 149 #define NOT_LINUX(code) code
 150 #endif
 151 
 152 #ifdef SOLARIS
 153 #define SOLARIS_ONLY(code) code
 154 #define NOT_SOLARIS(code)
 155 #else
 156 #define SOLARIS_ONLY(code)
 157 #define NOT_SOLARIS(code) code
 158 #endif
 159 
 160 #ifdef _WINDOWS
 161 #define WINDOWS_ONLY(code) code
 162 #define NOT_WINDOWS(code)
 163 #else
 164 #define WINDOWS_ONLY(code)
 165 #define NOT_WINDOWS(code) code
 166 #endif
 167 
 168 #if defined(IA32) || defined(AMD64)
 169 #define X86
 170 #define X86_ONLY(code) code
 171 #define NOT_X86(code)
 172 #else
 173 #undef X86
 174 #define X86_ONLY(code)
 175 #define NOT_X86(code) code
 176 #endif
 177 
 178 #ifdef IA32
 179 #define IA32_ONLY(code) code
 180 #define NOT_IA32(code)
 181 #else
 182 #define IA32_ONLY(code)
 183 #define NOT_IA32(code) code
 184 #endif
 185 
 186 #ifdef IA64
 187 #define IA64_ONLY(code) code
 188 #define NOT_IA64(code)
 189 #else
 190 #define IA64_ONLY(code)
 191 #define NOT_IA64(code) code
 192 #endif
 193 
 194 #ifdef AMD64
 195 #define AMD64_ONLY(code) code
 196 #define NOT_AMD64(code)
 197 #else
 198 #define AMD64_ONLY(code)
 199 #define NOT_AMD64(code) code
 200 #endif
 201 
 202 #ifdef SPARC
 203 #define SPARC_ONLY(code) code
 204 #define NOT_SPARC(code)
 205 #else
 206 #define SPARC_ONLY(code)
 207 #define NOT_SPARC(code) code
 208 #endif
 209 
 210 #ifdef PPC
 211 #define PPC_ONLY(code) code
 212 #define NOT_PPC(code)
 213 #else
 214 #define PPC_ONLY(code)
 215 #define NOT_PPC(code) code
 216 #endif
 217 
 218 #ifdef E500V2
 219 #define E500V2_ONLY(code) code
 220 #define NOT_E500V2(code)
 221 #else
 222 #define E500V2_ONLY(code)
 223 #define NOT_E500V2(code) code
 224 #endif
 225 
 226 
 227 #ifdef ARM
 228 #define ARM_ONLY(code) code
 229 #define NOT_ARM(code)
 230 #else
 231 #define ARM_ONLY(code)
 232 #define NOT_ARM(code) code
 233 #endif
 234 
 235 #ifdef JAVASE_EMBEDDED
 236 #define EMBEDDED_ONLY(code) code
 237 #define NOT_EMBEDDED(code)
 238 #else
 239 #define EMBEDDED_ONLY(code)
 240 #define NOT_EMBEDDED(code) code
 241 #endif
 242 
 243 #define define_pd_global(type, name, value) const type pd_##name = value;
 244 
 245 #endif // SHARE_VM_UTILITIES_MACROS_HPP