macros.hpp revision 0:a61af66fc99e
1/* 2 * Copyright 1997-2007 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 20 * CA 95054 USA or visit www.sun.com if you need additional information or 21 * have any 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#else // COMPILER2 69#define COMPILER2_PRESENT(code) 70#endif // COMPILER2 71 72 73// PRODUCT variant 74#ifdef PRODUCT 75#define PRODUCT_ONLY(code) code 76#define NOT_PRODUCT(code) 77#define PRODUCT_RETURN {} 78#define PRODUCT_RETURN0 { return 0; } 79#define PRODUCT_RETURN_(code) { code } 80#else // PRODUCT 81#define PRODUCT_ONLY(code) 82#define NOT_PRODUCT(code) code 83#define PRODUCT_RETURN /*next token must be ;*/ 84#define PRODUCT_RETURN0 /*next token must be ;*/ 85#define PRODUCT_RETURN_(code) /*next token must be ;*/ 86#endif // PRODUCT 87 88#ifdef CHECK_UNHANDLED_OOPS 89#define CHECK_UNHANDLED_OOPS_ONLY(code) code 90#define NOT_CHECK_UNHANDLED_OOPS(code) 91#else 92#define CHECK_UNHANDLED_OOPS_ONLY(code) 93#define NOT_CHECK_UNHANDLED_OOPS(code) code 94#endif // CHECK_UNHANDLED_OOPS 95 96#ifdef CC_INTERP 97#define CC_INTERP_ONLY(code) code 98#define NOT_CC_INTERP(code) 99#else 100#define CC_INTERP_ONLY(code) 101#define NOT_CC_INTERP(code) code 102#endif // CC_INTERP 103 104#ifdef ASSERT 105#define DEBUG_ONLY(code) code 106#define NOT_DEBUG(code) 107// Historical. 108#define debug_only(code) code 109#else // ASSERT 110#define DEBUG_ONLY(code) 111#define NOT_DEBUG(code) code 112#define debug_only(code) 113#endif // ASSERT 114 115#ifdef _LP64 116#define LP64_ONLY(code) code 117#define NOT_LP64(code) 118#else // !_LP64 119#define LP64_ONLY(code) 120#define NOT_LP64(code) code 121#endif // _LP64 122 123#ifdef LINUX 124#define LINUX_ONLY(code) code 125#define NOT_LINUX(code) 126#else 127#define LINUX_ONLY(code) 128#define NOT_LINUX(code) code 129#endif 130 131#ifdef SOLARIS 132#define SOLARIS_ONLY(code) code 133#define NOT_SOLARIS(code) 134#else 135#define SOLARIS_ONLY(code) 136#define NOT_SOLARIS(code) code 137#endif 138 139#ifdef _WINDOWS 140#define WINDOWS_ONLY(code) code 141#define NOT_WINDOWS(code) 142#else 143#define WINDOWS_ONLY(code) 144#define NOT_WINDOWS(code) code 145#endif 146 147#ifdef IA32 148#define IA32_ONLY(code) code 149#define NOT_IA32(code) 150#else 151#define IA32_ONLY(code) 152#define NOT_IA32(code) code 153#endif 154 155#ifdef IA64 156#define IA64_ONLY(code) code 157#define NOT_IA64(code) 158#else 159#define IA64_ONLY(code) 160#define NOT_IA64(code) code 161#endif 162 163#ifdef AMD64 164#define AMD64_ONLY(code) code 165#define NOT_AMD64(code) 166#else 167#define AMD64_ONLY(code) 168#define NOT_AMD64(code) code 169#endif 170 171#ifdef SPARC 172#define SPARC_ONLY(code) code 173#define NOT_SPARC(code) 174#else 175#define SPARC_ONLY(code) 176#define NOT_SPARC(code) code 177#endif 178 179#define FIX_THIS(code) report_assertion_failure("FIX_THIS",__FILE__, __LINE__, "") 180 181#define define_pd_global(type, name, value) const type pd_##name = value; 182