]> git.saurik.com Git - apple/objc4.git/blob - runtime/objc-config.h
objc4-493.11.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 #include <TargetConditionals.h>
25
26 // Define SUPPORT_GC=1 to enable garbage collection.
27 // Be sure to edit OBJC_NO_GC in objc-auto.h as well.
28 #if TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32
29 # define SUPPORT_GC 0
30 #else
31 # define SUPPORT_GC 1
32 #endif
33
34 // Define SUPPORT_ENVIRON=1 to enable getenv().
35 #if ((TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) && !TARGET_IPHONE_SIMULATOR) && defined(NDEBUG)
36 # define SUPPORT_ENVIRON 0
37 #else
38 # define SUPPORT_ENVIRON 1
39 #endif
40
41 // Define SUPPORT_ZONES=1 to enable malloc zone support in NXHashTable.
42 #if TARGET_OS_EMBEDDED || TARGET_OS_IPHONE
43 # define SUPPORT_ZONES 0
44 #else
45 # define SUPPORT_ZONES 1
46 #endif
47
48 // Define SUPPORT_MOD=1 to use the mod operator in NXHashTable and objc-sel-set
49 #if defined(__arm__)
50 # define SUPPORT_MOD 0
51 #else
52 # define SUPPORT_MOD 1
53 #endif
54
55 // Define SUPPORT_BUILTINS=1 to enable the builtin selector table from dyld
56 #if TARGET_OS_WIN32
57 # define SUPPORT_BUILTINS 0
58 #else
59 # define SUPPORT_BUILTINS 1
60 #endif
61
62 // Define SUPPORT_DEBUGGER_MODE=1 to enable lock-avoiding execution for debuggers
63 #if TARGET_OS_WIN32
64 # define SUPPORT_DEBUGGER_MODE 0
65 #else
66 # define SUPPORT_DEBUGGER_MODE 1
67 #endif
68
69 // Define SUPPORT_TAGGED_POINTERS=1 to enable tagged pointer objects
70 // Be sure to edit objc-internal.h as well (_objc_insert_tagged_isa)
71 #if !(__OBJC2__ && __LP64__)
72 # define SUPPORT_TAGGED_POINTERS 0
73 #else
74 # define SUPPORT_TAGGED_POINTERS 1
75 #endif
76
77 // Define SUPPORT_FIXUP=1 to use call-site fixup messaging for OBJC2.
78 // Be sure to edit objc-abi.h as well (objc_msgSend*_fixup)
79 #if !__OBJC2__ || !defined(__x86_64__)
80 # define SUPPORT_FIXUP 0
81 #else
82 # define SUPPORT_FIXUP 1
83 #endif
84
85 // Define SUPPORT_VTABLE=1 to enable vtable dispatch for OBJC2.
86 // Be sure to edit objc-gdb.h as well (gdb_objc_trampolines)
87 #if !SUPPORT_FIXUP
88 # define SUPPORT_VTABLE 0
89 #else
90 # define SUPPORT_VTABLE 1
91 #endif
92
93 // Define SUPPORT_IGNORED_SELECTOR_CONSTANT to remap GC-ignored selectors.
94 // Good: fast ignore in objc_msgSend. Bad: disable shared cache optimizations
95 // Non-GC does not remap. Fixup dispatch does not remap.
96 #if !SUPPORT_GC || SUPPORT_FIXUP
97 # define SUPPORT_IGNORED_SELECTOR_CONSTANT 0
98 #else
99 # define SUPPORT_IGNORED_SELECTOR_CONSTANT 1
100 # if defined(__i386__)
101 # define kIgnore 0xfffeb010
102 # else
103 # error unknown architecture
104 # endif
105 #endif
106
107 // Define SUPPORT_ZEROCOST_EXCEPTIONS to use "zero-cost" exceptions for OBJC2.
108 // Be sure to edit objc-exception.h as well (objc_add/removeExceptionHandler)
109 #if !__OBJC2__ || defined(__arm__)
110 # define SUPPORT_ZEROCOST_EXCEPTIONS 0
111 #else
112 # define SUPPORT_ZEROCOST_EXCEPTIONS 1
113 #endif
114
115 // Define SUPPORT_ALT_HANDLERS if you're using zero-cost exceptions
116 // but also need to support AppKit's alt-handler scheme
117 // Be sure to edit objc-exception.h as well (objc_add/removeExceptionHandler)
118 #if !SUPPORT_ZEROCOST_EXCEPTIONS || TARGET_OS_IPHONE || TARGET_OS_EMBEDDED
119 # define SUPPORT_ALT_HANDLERS 0
120 #else
121 # define SUPPORT_ALT_HANDLERS 1
122 #endif
123
124 // Define SUPPORT_RETURN_AUTORELEASE to optimize autoreleased return values
125 #if !__OBJC2__ || TARGET_OS_WIN32
126 # define SUPPORT_RETURN_AUTORELEASE 0
127 #else
128 # define SUPPORT_RETURN_AUTORELEASE 1
129 #endif
130
131
132 // OBJC_INSTRUMENTED controls whether message dispatching is dynamically
133 // monitored. Monitoring introduces substantial overhead.
134 // NOTE: To define this condition, do so in the build command, NOT by
135 // uncommenting the line here. This is because objc-class.h heeds this
136 // condition, but objc-class.h can not #include this file (objc-config.h)
137 // because objc-class.h is public and objc-config.h is not.
138 //#define OBJC_INSTRUMENTED
139
140 // Get the nice macros for subroutine calling, etc.
141 // Not available on all architectures. Not needed
142 // (by us) on some configurations.
143 #if defined (__i386__) || defined (i386)
144 # include <architecture/i386/asm_help.h>
145 #endif