1 /*
   2  * Copyright (c) 1997, 2009, 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 PRODUCT_RETURN  {}
  80 #define PRODUCT_RETURN0 { return 0; }
  81 #define PRODUCT_RETURN_(code) { code }
  82 #else // PRODUCT
  83 #define PRODUCT_ONLY(code)
  84 #define NOT_PRODUCT(code) code
  85 #define PRODUCT_RETURN  /*next token must be ;*/
  86 #define PRODUCT_RETURN0 /*next token must be ;*/
  87 #define PRODUCT_RETURN_(code)  /*next token must be ;*/
  88 #endif // PRODUCT
  89 
  90 #ifdef CHECK_UNHANDLED_OOPS
  91 #define CHECK_UNHANDLED_OOPS_ONLY(code) code
  92 #define NOT_CHECK_UNHANDLED_OOPS(code)
  93 #else
  94 #define CHECK_UNHANDLED_OOPS_ONLY(code)
  95 #define NOT_CHECK_UNHANDLED_OOPS(code)  code
  96 #endif // CHECK_UNHANDLED_OOPS
  97 
  98 #ifdef CC_INTERP
  99 #define CC_INTERP_ONLY(code) code
 100 #define NOT_CC_INTERP(code)
 101 #else
 102 #define CC_INTERP_ONLY(code)
 103 #define NOT_CC_INTERP(code) code
 104 #endif // CC_INTERP
 105 
 106 #ifdef ASSERT
 107 #define DEBUG_ONLY(code) code
 108 #define NOT_DEBUG(code)
 109 #define NOT_DEBUG_RETURN  /*next token must be ;*/
 110 // Historical.
 111 #define debug_only(code) code
 112 #else // ASSERT
 113 #define DEBUG_ONLY(code)
 114 #define NOT_DEBUG(code) code
 115 #define NOT_DEBUG_RETURN {}
 116 #define debug_only(code)
 117 #endif // ASSERT
 118 
 119 #ifdef  _LP64
 120 #define LP64_ONLY(code) code
 121 #define NOT_LP64(code)
 122 #else  // !_LP64
 123 #define LP64_ONLY(code)
 124 #define NOT_LP64(code) code
 125 #endif // _LP64
 126 
 127 #ifdef LINUX
 128 #define LINUX_ONLY(code) code
 129 #define NOT_LINUX(code)
 130 #else
 131 #define LINUX_ONLY(code)
 132 #define NOT_LINUX(code) code
 133 #endif
 134 
 135 #ifdef SOLARIS
 136 #define SOLARIS_ONLY(code) code
 137 #define NOT_SOLARIS(code)
 138 #else
 139 #define SOLARIS_ONLY(code)
 140 #define NOT_SOLARIS(code) code
 141 #endif
 142 
 143 #ifdef _WINDOWS
 144 #define WINDOWS_ONLY(code) code
 145 #define NOT_WINDOWS(code)
 146 #else
 147 #define WINDOWS_ONLY(code)
 148 #define NOT_WINDOWS(code) code
 149 #endif
 150 
 151 #if defined(IA32) || defined(AMD64)
 152 #define X86
 153 #define X86_ONLY(code) code
 154 #else
 155 #undef X86
 156 #define X86_ONLY(code)
 157 #endif
 158 
 159 #ifdef IA32
 160 #define IA32_ONLY(code) code
 161 #define NOT_IA32(code)
 162 #else
 163 #define IA32_ONLY(code)
 164 #define NOT_IA32(code) code
 165 #endif
 166 
 167 #ifdef IA64
 168 #define IA64_ONLY(code) code
 169 #define NOT_IA64(code)
 170 #else
 171 #define IA64_ONLY(code)
 172 #define NOT_IA64(code) code
 173 #endif
 174 
 175 #ifdef AMD64
 176 #define AMD64_ONLY(code) code
 177 #define NOT_AMD64(code)
 178 #else
 179 #define AMD64_ONLY(code)
 180 #define NOT_AMD64(code) code
 181 #endif
 182 
 183 #ifdef SPARC
 184 #define SPARC_ONLY(code) code
 185 #define NOT_SPARC(code)
 186 #else
 187 #define SPARC_ONLY(code)
 188 #define NOT_SPARC(code) code
 189 #endif
 190 
 191 #define define_pd_global(type, name, value) const type pd_##name = value;