]> git.saurik.com Git - apple/objc4.git/blob - runtime/objc-config.h
objc4-709.tar.gz
[apple/objc4.git] / runtime / objc-config.h
1 /*
2 * Copyright (c) 1999-2002, 2005-2008 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef _OBJC_CONFIG_H_
25 #define _OBJC_CONFIG_H_
26
27 #include <TargetConditionals.h>
28
29 // Avoid the !NDEBUG double negative.
30 #if !NDEBUG
31 # define DEBUG 1
32 #else
33 # define DEBUG 0
34 #endif
35
36 // Define SUPPORT_GC_COMPAT=1 to enable compatibility where GC once was.
37 // OBJC_NO_GC and OBJC_NO_GC_API in objc-api.h mean something else.
38 #if !TARGET_OS_OSX
39 # define SUPPORT_GC_COMPAT 0
40 #else
41 # define SUPPORT_GC_COMPAT 1
42 #endif
43
44 // Define SUPPORT_ZONES=1 to enable malloc zone support in NXHashTable.
45 #if !TARGET_OS_OSX
46 # define SUPPORT_ZONES 0
47 #else
48 # define SUPPORT_ZONES 1
49 #endif
50
51 // Define SUPPORT_MOD=1 to use the mod operator in NXHashTable and objc-sel-set
52 #if defined(__arm__)
53 # define SUPPORT_MOD 0
54 #else
55 # define SUPPORT_MOD 1
56 #endif
57
58 // Define SUPPORT_PREOPT=1 to enable dyld shared cache optimizations
59 #if TARGET_OS_WIN32 || TARGET_OS_SIMULATOR
60 # define SUPPORT_PREOPT 0
61 #else
62 # define SUPPORT_PREOPT 1
63 #endif
64
65 // Define SUPPORT_TAGGED_POINTERS=1 to enable tagged pointer objects
66 // Be sure to edit tagged pointer SPI in objc-internal.h as well.
67 #if !(__OBJC2__ && __LP64__)
68 # define SUPPORT_TAGGED_POINTERS 0
69 #else
70 # define SUPPORT_TAGGED_POINTERS 1
71 #endif
72
73 // Define SUPPORT_MSB_TAGGED_POINTERS to use the MSB
74 // as the tagged pointer marker instead of the LSB.
75 // Be sure to edit tagged pointer SPI in objc-internal.h as well.
76 #if !SUPPORT_TAGGED_POINTERS || !TARGET_OS_IPHONE
77 # define SUPPORT_MSB_TAGGED_POINTERS 0
78 #else
79 # define SUPPORT_MSB_TAGGED_POINTERS 1
80 #endif
81
82 // Define SUPPORT_INDEXED_ISA=1 on platforms that store the class in the isa
83 // field as an index into a class table.
84 // Note, keep this in sync with any .s files which also define it.
85 // Be sure to edit objc-abi.h as well.
86 #if __ARM_ARCH_7K__ >= 2
87 # define SUPPORT_INDEXED_ISA 1
88 #else
89 # define SUPPORT_INDEXED_ISA 0
90 #endif
91
92 // Define SUPPORT_PACKED_ISA=1 on platforms that store the class in the isa
93 // field as a maskable pointer with other data around it.
94 #if (!__LP64__ || TARGET_OS_WIN32 || TARGET_OS_SIMULATOR)
95 # define SUPPORT_PACKED_ISA 0
96 #else
97 # define SUPPORT_PACKED_ISA 1
98 #endif
99
100 // Define SUPPORT_NONPOINTER_ISA=1 on any platform that may store something
101 // in the isa field that is not a raw pointer.
102 #if !SUPPORT_INDEXED_ISA && !SUPPORT_PACKED_ISA
103 # define SUPPORT_NONPOINTER_ISA 0
104 #else
105 # define SUPPORT_NONPOINTER_ISA 1
106 #endif
107
108 // Define SUPPORT_FIXUP=1 to repair calls sites for fixup dispatch.
109 // Fixup messaging itself is no longer supported.
110 // Be sure to edit objc-abi.h as well (objc_msgSend*_fixup)
111 #if !(defined(__x86_64__) && (TARGET_OS_OSX || TARGET_OS_SIMULATOR))
112 # define SUPPORT_FIXUP 0
113 #else
114 # define SUPPORT_FIXUP 1
115 #endif
116
117 // Define SUPPORT_ZEROCOST_EXCEPTIONS to use "zero-cost" exceptions for OBJC2.
118 // Be sure to edit objc-exception.h as well (objc_add/removeExceptionHandler)
119 #if !__OBJC2__ || (defined(__arm__) && __USING_SJLJ_EXCEPTIONS__)
120 # define SUPPORT_ZEROCOST_EXCEPTIONS 0
121 #else
122 # define SUPPORT_ZEROCOST_EXCEPTIONS 1
123 #endif
124
125 // Define SUPPORT_ALT_HANDLERS if you're using zero-cost exceptions
126 // but also need to support AppKit's alt-handler scheme
127 // Be sure to edit objc-exception.h as well (objc_add/removeExceptionHandler)
128 #if !SUPPORT_ZEROCOST_EXCEPTIONS || TARGET_OS_IPHONE || TARGET_OS_EMBEDDED
129 # define SUPPORT_ALT_HANDLERS 0
130 #else
131 # define SUPPORT_ALT_HANDLERS 1
132 #endif
133
134 // Define SUPPORT_RETURN_AUTORELEASE to optimize autoreleased return values
135 #if TARGET_OS_WIN32
136 # define SUPPORT_RETURN_AUTORELEASE 0
137 #else
138 # define SUPPORT_RETURN_AUTORELEASE 1
139 #endif
140
141 // Define SUPPORT_STRET on architectures that need separate struct-return ABI.
142 #if defined(__arm64__)
143 # define SUPPORT_STRET 0
144 #else
145 # define SUPPORT_STRET 1
146 #endif
147
148 // Define SUPPORT_MESSAGE_LOGGING to enable NSObjCMessageLoggingEnabled
149 #if TARGET_OS_WIN32 || TARGET_OS_EMBEDDED
150 # define SUPPORT_MESSAGE_LOGGING 0
151 #else
152 # define SUPPORT_MESSAGE_LOGGING 1
153 #endif
154
155 // Define SUPPORT_QOS_HACK to work around deadlocks due to QoS bugs.
156 #if !__OBJC2__ || TARGET_OS_WIN32
157 # define SUPPORT_QOS_HACK 0
158 #else
159 # define SUPPORT_QOS_HACK 1
160 #endif
161
162 // OBJC_INSTRUMENTED controls whether message dispatching is dynamically
163 // monitored. Monitoring introduces substantial overhead.
164 // NOTE: To define this condition, do so in the build command, NOT by
165 // uncommenting the line here. This is because objc-class.h heeds this
166 // condition, but objc-class.h can not #include this file (objc-config.h)
167 // because objc-class.h is public and objc-config.h is not.
168 //#define OBJC_INSTRUMENTED
169
170 #endif