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 
  75 // PRODUCT variant
  76 #ifdef PRODUCT
  77 #define PRODUCT_ONLY(code) code
  78 #define NOT_PRODUCT(code)
  79 #define NOT_PRODUCT_ARG(arg)
  80 #define PRODUCT_RETURN  {}
  81 #define PRODUCT_RETURN0 { return 0; }
  82 #define PRODUCT_RETURN_(code) { code }
  83 #else // PRODUCT
  84 #define PRODUCT_ONLY(code)
  85 #define NOT_PRODUCT(code) code
  86 #define NOT_PRODUCT_ARG(arg) arg,
  87 #define PRODUCT_RETURN  /*next token must be ;*/
  88 #define PRODUCT_RETURN0 /*next token must be ;*/
  89 #define PRODUCT_RETURN_(code)  /*next token must be ;*/
  90 #endif // PRODUCT
  91 
  92 #ifdef CHECK_UNHANDLED_OOPS
  93 #define CHECK_UNHANDLED_OOPS_ONLY(code) code
  94 #define NOT_CHECK_UNHANDLED_OOPS(code)
  95 #else
  96 #define CHECK_UNHANDLED_OOPS_ONLY(code)
  97 #define NOT_CHECK_UNHANDLED_OOPS(code)  code
  98 #endif // CHECK_UNHANDLED_OOPS
  99 
 100 #ifdef CC_INTERP
 101 #define CC_INTERP_ONLY(code) code
 102 #define NOT_CC_INTERP(code)
 103 #else
 104 #define CC_INTERP_ONLY(code)
 105 #define NOT_CC_INTERP(code) code
 106 #endif // CC_INTERP
 107 
 108 #ifdef ASSERT
 109 #define DEBUG_ONLY(code) code
 110 #define NOT_DEBUG(code)
 111 #define NOT_DEBUG_RETURN  /*next token must be ;*/
 112 // Historical.
 113 #define debug_only(code) code
 114 #else // ASSERT
 115 #define DEBUG_ONLY(code)
 116 #define NOT_DEBUG(code) code
 117 #define NOT_DEBUG_RETURN {}
 118 #define debug_only(code)
 119 #endif // ASSERT
 120 
 121 #ifdef  _LP64
 122 #define LP64_ONLY(code) code
 123 #define NOT_LP64(code)
 124 #else  // !_LP64
 125 #define LP64_ONLY(code)
 126 #define NOT_LP64(code) code
 127 #endif // _LP64
 128 
 129 #ifdef LINUX
 130 #define LINUX_ONLY(code) code
 131 #define NOT_LINUX(code)
 132 #else
 133 #define LINUX_ONLY(code)
 134 #define NOT_LINUX(code) code
 135 #endif
 136 
 137 #ifdef SOLARIS
 138 #define SOLARIS_ONLY(code) code
 139 #define NOT_SOLARIS(code)
 140 #else
 141 #define SOLARIS_ONLY(code)
 142 #define NOT_SOLARIS(code) code
 143 #endif
 144 
 145 #ifdef _WINDOWS
 146 #define WINDOWS_ONLY(code) code
 147 #define NOT_WINDOWS(code)
 148 #else
 149 #define WINDOWS_ONLY(code)
 150 #define NOT_WINDOWS(code) code
 151 #endif
 152 
 153 #if defined(IA32) || defined(AMD64)
 154 #define X86
 155 #define X86_ONLY(code) code
 156 #define NOT_X86(code)
 157 #else
 158 #undef X86
 159 #define X86_ONLY(code)
 160 #define NOT_X86(code) code
 161 #endif
 162 
 163 #ifdef IA32
 164 #define IA32_ONLY(code) code
 165 #define NOT_IA32(code)
 166 #else
 167 #define IA32_ONLY(code)
 168 #define NOT_IA32(code) code
 169 #endif
 170 
 171 #ifdef IA64
 172 #define IA64_ONLY(code) code
 173 #define NOT_IA64(code)
 174 #else
 175 #define IA64_ONLY(code)
 176 #define NOT_IA64(code) code
 177 #endif
 178 
 179 #ifdef AMD64
 180 #define AMD64_ONLY(code) code
 181 #define NOT_AMD64(code)
 182 #else
 183 #define AMD64_ONLY(code)
 184 #define NOT_AMD64(code) code
 185 #endif
 186 
 187 #ifdef SPARC
 188 #define SPARC_ONLY(code) code
 189 #define NOT_SPARC(code)
 190 #else
 191 #define SPARC_ONLY(code)
 192 #define NOT_SPARC(code) code
 193 #endif
 194 
 195 #ifdef PPC
 196 #define PPC_ONLY(code) code
 197 #define NOT_PPC(code)
 198 #else
 199 #define PPC_ONLY(code)
 200 #define NOT_PPC(code) code
 201 #endif
 202 
 203 #ifdef E500V2
 204 #define E500V2_ONLY(code) code
 205 #define NOT_E500V2(code)
 206 #else
 207 #define E500V2_ONLY(code)
 208 #define NOT_E500V2(code) code
 209 #endif
 210 
 211 
 212 #ifdef ARM
 213 #define ARM_ONLY(code) code
 214 #define NOT_ARM(code)
 215 #else
 216 #define ARM_ONLY(code)
 217 #define NOT_ARM(code) code
 218 #endif
 219 
 220 #ifdef JAVASE_EMBEDDED
 221 #define EMBEDDED_ONLY(code) code
 222 #define NOT_EMBEDDED(code)
 223 #else
 224 #define EMBEDDED_ONLY(code)
 225 #define NOT_EMBEDDED(code) code
 226 #endif
 227 
 228 #define define_pd_global(type, name, value) const type pd_##name = value;