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