]>
git.saurik.com Git - apple/objc4.git/blob - runtime/objc-config.h
2 * Copyright (c) 1999-2002, 2005-2008 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
24 #ifndef _OBJC_CONFIG_H_
25 #define _OBJC_CONFIG_H_
27 #include <TargetConditionals.h>
29 // Define SUPPORT_GC=1 to enable garbage collection.
30 // Be sure to edit OBJC_NO_GC in objc-auto.h as well.
31 #if TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32
37 // Define SUPPORT_ENVIRON=1 to enable getenv().
38 #if ((TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) && !TARGET_IPHONE_SIMULATOR) && defined(NDEBUG)
39 # define SUPPORT_ENVIRON 0
41 # define SUPPORT_ENVIRON 1
44 // Define SUPPORT_ZONES=1 to enable malloc zone support in NXHashTable.
45 #if TARGET_OS_EMBEDDED || TARGET_OS_IPHONE
46 # define SUPPORT_ZONES 0
48 # define SUPPORT_ZONES 1
51 // Define SUPPORT_MOD=1 to use the mod operator in NXHashTable and objc-sel-set
53 # define SUPPORT_MOD 0
55 # define SUPPORT_MOD 1
58 // Define SUPPORT_PREOPT=1 to enable dyld shared cache optimizations
59 #if TARGET_OS_WIN32 || TARGET_IPHONE_SIMULATOR
60 # define SUPPORT_PREOPT 0
62 # define SUPPORT_PREOPT 1
65 // Define SUPPORT_DEBUGGER_MODE=1 to enable lock-avoiding execution for debuggers
67 # define SUPPORT_DEBUGGER_MODE 0
69 # define SUPPORT_DEBUGGER_MODE 1
72 // Define SUPPORT_TAGGED_POINTERS=1 to enable tagged pointer objects
73 // Be sure to edit objc-internal.h as well (_objc_insert_tagged_isa)
74 #if !(__OBJC2__ && __LP64__)
75 # define SUPPORT_TAGGED_POINTERS 0
77 # define SUPPORT_TAGGED_POINTERS 1
80 // Define SUPPORT_FIXUP=1 to use call-site fixup messaging for OBJC2.
81 // Be sure to edit objc-abi.h as well (objc_msgSend*_fixup)
82 #if !__OBJC2__ || !defined(__x86_64__)
83 # define SUPPORT_FIXUP 0
85 # define SUPPORT_FIXUP 1
88 // Define SUPPORT_VTABLE=1 to enable vtable dispatch for OBJC2.
89 // Be sure to edit objc-gdb.h as well (gdb_objc_trampolines)
91 # define SUPPORT_VTABLE 0
93 # define SUPPORT_VTABLE 1
96 // Define SUPPORT_IGNORED_SELECTOR_CONSTANT to remap GC-ignored selectors.
97 // Good: fast ignore in objc_msgSend. Bad: disable shared cache optimizations
98 // Non-GC does not remap. Fixup dispatch does not remap.
99 #if !SUPPORT_GC || SUPPORT_FIXUP
100 # define SUPPORT_IGNORED_SELECTOR_CONSTANT 0
102 # define SUPPORT_IGNORED_SELECTOR_CONSTANT 1
103 # if defined(__i386__)
104 # define kIgnore 0xfffeb010
106 # error unknown architecture
110 // Define SUPPORT_ZEROCOST_EXCEPTIONS to use "zero-cost" exceptions for OBJC2.
111 // Be sure to edit objc-exception.h as well (objc_add/removeExceptionHandler)
112 #if !__OBJC2__ || defined(__arm__)
113 # define SUPPORT_ZEROCOST_EXCEPTIONS 0
115 # define SUPPORT_ZEROCOST_EXCEPTIONS 1
118 // Define SUPPORT_ALT_HANDLERS if you're using zero-cost exceptions
119 // but also need to support AppKit's alt-handler scheme
120 // Be sure to edit objc-exception.h as well (objc_add/removeExceptionHandler)
121 #if !SUPPORT_ZEROCOST_EXCEPTIONS || TARGET_OS_IPHONE || TARGET_OS_EMBEDDED
122 # define SUPPORT_ALT_HANDLERS 0
124 # define SUPPORT_ALT_HANDLERS 1
127 // Define SUPPORT_RETURN_AUTORELEASE to optimize autoreleased return values
128 #if !__OBJC2__ || TARGET_OS_WIN32
129 # define SUPPORT_RETURN_AUTORELEASE 0
131 # define SUPPORT_RETURN_AUTORELEASE 1
135 // OBJC_INSTRUMENTED controls whether message dispatching is dynamically
136 // monitored. Monitoring introduces substantial overhead.
137 // NOTE: To define this condition, do so in the build command, NOT by
138 // uncommenting the line here. This is because objc-class.h heeds this
139 // condition, but objc-class.h can not #include this file (objc-config.h)
140 // because objc-class.h is public and objc-config.h is not.
141 //#define OBJC_INSTRUMENTED