├── .gitignore ├── README.md └── objc4-750 ├── APPLE_LICENSE ├── ReleaseNotes.rtf ├── include ├── Block_private.h ├── CrashReporterClient.h ├── System │ ├── machine │ │ └── cpu_capabilities.h │ └── pthread_machdep.h ├── _simple.h ├── mach-o │ └── dyld_priv.h ├── objc-shared-cache.h ├── os │ ├── base_private.h │ ├── lock_private.h │ └── tsd.h ├── pthread │ ├── spinlock_private.h │ └── tsd_private.h └── sys │ └── reason.h ├── interposable.txt ├── libobjc.order ├── markgc.cpp ├── myTest └── main.m ├── objc.sln ├── objc.vcproj ├── objc.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── objcrt └── objcrt.vcproj ├── prebuild.bat ├── runtime ├── Messengers.subproj │ ├── objc-msg-arm.s │ ├── objc-msg-arm64.s │ ├── objc-msg-i386.s │ ├── objc-msg-simulator-i386.s │ ├── objc-msg-simulator-x86_64.s │ ├── objc-msg-win32.m │ └── objc-msg-x86_64.s ├── Module │ ├── ObjectiveC.apinotes │ └── module.modulemap ├── NSObjCRuntime.h ├── NSObject.h ├── NSObject.mm ├── Object.h ├── Object.mm ├── OldClasses.subproj │ ├── List.h │ └── List.m ├── Protocol.h ├── Protocol.mm ├── arm64-asm.h ├── hashtable.h ├── hashtable2.h ├── hashtable2.mm ├── isa.h ├── llvm-AlignOf.h ├── llvm-DenseMap.h ├── llvm-DenseMapInfo.h ├── llvm-MathExtras.h ├── llvm-type_traits.h ├── maptable.h ├── maptable.mm ├── message.h ├── objc-abi.h ├── objc-accessors.mm ├── objc-api.h ├── objc-auto.h ├── objc-auto.mm ├── objc-block-trampolines.h ├── objc-block-trampolines.mm ├── objc-blocktramps-arm.s ├── objc-blocktramps-arm64.s ├── objc-blocktramps-i386.s ├── objc-blocktramps-x86_64.s ├── objc-cache-old.h ├── objc-cache-old.mm ├── objc-cache.h ├── objc-cache.mm ├── objc-class-old.mm ├── objc-class.h ├── objc-class.mm ├── objc-config.h ├── objc-env.h ├── objc-errors.mm ├── objc-exception.h ├── objc-exception.mm ├── objc-file-old.h ├── objc-file-old.mm ├── objc-file.h ├── objc-file.mm ├── objc-gdb.h ├── objc-initialize.h ├── objc-initialize.mm ├── objc-internal.h ├── objc-layout.mm ├── objc-load.h ├── objc-load.mm ├── objc-loadmethod.h ├── objc-loadmethod.mm ├── objc-lockdebug.h ├── objc-lockdebug.mm ├── objc-locks-new.h ├── objc-locks-old.h ├── objc-locks.h ├── objc-object.h ├── objc-opt.mm ├── objc-os.h ├── objc-os.mm ├── objc-private.h ├── objc-probes.d ├── objc-ptrauth.h ├── objc-references.h ├── objc-references.mm ├── objc-runtime-new.h ├── objc-runtime-new.mm ├── objc-runtime-old.h ├── objc-runtime-old.mm ├── objc-runtime.h ├── objc-runtime.mm ├── objc-sel-old.mm ├── objc-sel-set.h ├── objc-sel-set.mm ├── objc-sel-table.s ├── objc-sel.mm ├── objc-sync.h ├── objc-sync.mm ├── objc-typeencoding.mm ├── objc-weak.h ├── objc-weak.mm ├── objc.h ├── objcrt.c ├── objcrt.h └── runtime.h ├── unexported_symbols ├── version.bat └── version.rc /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots/**/*.png 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 详见:[配置运行objc4-750和使用](https://www.jianshu.com/p/bbafd02ad0bb) 2 | -------------------------------------------------------------------------------- /objc4-750/APPLE_LICENSE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flyingDandelionYD/Objc4--750/2e7bb81540ae07fd6f3791ee85138842179cf765/objc4-750/APPLE_LICENSE -------------------------------------------------------------------------------- /objc4-750/include/CrashReporterClient.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 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 | /*********************************************************************** 25 | * Not to be installed in /usr/local/include 26 | ***********************************************************************/ 27 | 28 | #ifndef _LIBC_CRASHREPORTERCLIENT_H 29 | #define _LIBC_CRASHREPORTERCLIENT_H 30 | 31 | #ifdef LIBC_NO_LIBCRASHREPORTERCLIENT 32 | 33 | /* Fake the CrashReporterClient API */ 34 | #define CRGetCrashLogMessage() 0 35 | #define CRSetCrashLogMessage(x) /* nothing */ 36 | 37 | #else /* !LIBC_NO_LIBCRASHREPORTERCLIENT */ 38 | 39 | /* Include the real CrashReporterClient.h */ 40 | #include_next 41 | 42 | #endif /* !LIBC_NO_LIBCRASHREPORTERCLIENT */ 43 | 44 | #endif /* _LIBC_CRASHREPORTERCLIENT_H */ 45 | -------------------------------------------------------------------------------- /objc4-750/include/System/machine/cpu_capabilities.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_OSREFERENCE_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. The rights granted to you under the License 10 | * may not be used to create, or enable the creation or redistribution of, 11 | * unlawful or unlicensed copies of an Apple operating system, or to 12 | * circumvent, violate, or enable the circumvention or violation of, any 13 | * terms of an Apple operating system software license agreement. 14 | * 15 | * Please obtain a copy of the License at 16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 | * 18 | * The Original Code and all software distributed under the License are 19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 | * Please see the License for the specific language governing rights and 24 | * limitations under the License. 25 | * 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 | */ 28 | #ifdef PRIVATE 29 | 30 | #ifndef _MACHINE_CPU_CAPABILITIES_H 31 | #define _MACHINE_CPU_CAPABILITIES_H 32 | 33 | #ifdef KERNEL_PRIVATE 34 | #if defined (__i386__) || defined (__x86_64__) 35 | #include "i386/cpu_capabilities.h" 36 | #elif defined (__arm__) || defined (__arm64__) 37 | #include "arm/cpu_capabilities.h" 38 | #else 39 | #error architecture not supported 40 | #endif 41 | 42 | #else /* !KERNEL_PRIVATE -- System Framework header */ 43 | #if defined (__i386__) || defined(__x86_64__) 44 | #include 45 | #elif defined (__arm__) || defined(__arm64__) 46 | #include 47 | #else 48 | #error architecture not supported 49 | #endif 50 | #endif /* KERNEL_PRIVATE */ 51 | 52 | #endif /* _MACHINE_CPU_CAPABILITIES_H */ 53 | #endif /* PRIVATE */ 54 | -------------------------------------------------------------------------------- /objc4-750/include/_simple.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006, 2010, 2013 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 _SYSTEM_SIMPLE_H_ 25 | #define _SYSTEM_SIMPLE_H_ 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | typedef void *_SIMPLE_STRING; 33 | typedef const char *_esc_func(unsigned char); 34 | 35 | __BEGIN_DECLS 36 | /* 37 | * A simplified vfprintf variant. The format string is interpreted with 38 | * arguments from the va_list, and the results are written to the given 39 | * file descriptor. 40 | */ 41 | void _simple_vdprintf(int __fd, const char *__fmt, va_list __ap) __printflike(2, 0); 42 | 43 | /* 44 | * A simplified fprintf variant. The format string is interpreted with 45 | * arguments from the variable argument list, and the results are written 46 | * to the given file descriptor. 47 | */ 48 | void _simple_dprintf(int __fd, const char *__fmt, ...) __printflike(2, 3); 49 | 50 | /* 51 | * A simplified string allocate routine. Pass the opaque pointer to structure 52 | * to _simple_*sprintf() routines. Use _simple_string() to retrieve the 53 | * current string (the string is guaranteed to be null terminated only on 54 | * the call to _simple_string()). Use _simple_sfree() to free the structure 55 | * and string memory. 56 | */ 57 | _SIMPLE_STRING _simple_salloc(void); 58 | 59 | /* 60 | * The format string is interpreted with arguments from the va_list, and the 61 | * results are appended to the string maintained by the opaque structure, as 62 | * returned by a previous call to _simple_salloc(). Non-zero is returned on 63 | * out-of-memory error. 64 | */ 65 | int _simple_vsprintf(_SIMPLE_STRING __b, const char *__fmt, va_list __ap) __printflike(2, 0); 66 | 67 | /* 68 | * The format string is interpreted with arguments from the variable argument 69 | * list, and the results are appended to the string maintained by the opaque 70 | * structure, as returned by a previous call to _simple_salloc(). Non-zero is 71 | * returned on out-of-memory error. 72 | */ 73 | int _simple_sprintf(_SIMPLE_STRING __b, const char *__fmt, ...) __printflike(2, 3); 74 | 75 | /* 76 | * Like _simple_vsprintf(), except __esc is a function to call on each 77 | * character; the function returns NULL if the character should be passed 78 | * as is, otherwise, the returned character string is used instead. 79 | */ 80 | int _simple_vesprintf(_SIMPLE_STRING __b, _esc_func __esc, const char *__fmt, va_list __ap) __printflike(3, 0); 81 | 82 | /* 83 | * Like _simple_sprintf(), except __esc is a function to call on each 84 | * character; the function returns NULL if the character should be passed 85 | * as is, otherwise, the returned character string is used instead. 86 | */ 87 | int _simple_esprintf(_SIMPLE_STRING __b, _esc_func __esc, const char *__fmt, ...) __printflike(3, 4); 88 | 89 | /* 90 | * Return the null terminated string from the opaque structure, as returned 91 | * by a previous call to _simple_salloc(). 92 | */ 93 | char *_simple_string(_SIMPLE_STRING __b); 94 | 95 | /* 96 | * Reposition the pointer to the first null in the buffer. After a call to 97 | * _simple_string, the buffer can be modified, and shrunk. 98 | */ 99 | void _simple_sresize(_SIMPLE_STRING __b); 100 | 101 | /* 102 | * Append the null-terminated string to the string associated with the opaque 103 | * structure. Non-zero is returned on out-of-memory error. 104 | */ 105 | int _simple_sappend(_SIMPLE_STRING __b, const char *__str); 106 | 107 | /* 108 | * Like _simple_sappend(), except __esc is a function to call on each 109 | * character; the function returns NULL if the character should be passed 110 | * as is, otherwise, the returned character string is used instead. 111 | */ 112 | int _simple_esappend(_SIMPLE_STRING __b, _esc_func __esc, const char *__str); 113 | 114 | /* 115 | * Write the string associated with the opaque structure to the file descriptor. 116 | */ 117 | void _simple_put(_SIMPLE_STRING __b, int __fd); 118 | 119 | /* 120 | * Write the string associated with the opaque structure and a trailing newline, 121 | * to the file descriptor. 122 | */ 123 | void _simple_putline(_SIMPLE_STRING __b, int __fd); 124 | 125 | /* 126 | * Free the opaque structure, and the associated string. 127 | */ 128 | void _simple_sfree(_SIMPLE_STRING __b); 129 | 130 | /* 131 | * Simplified ASL log interface; does not use malloc. Unfortunately, this 132 | * requires knowledge of the format used by ASL. 133 | */ 134 | #ifndef ASL_LEVEL_DEBUG 135 | #define ASL_LEVEL_EMERG 0 136 | #define ASL_LEVEL_ALERT 1 137 | #define ASL_LEVEL_CRIT 2 138 | #define ASL_LEVEL_ERR 3 139 | #define ASL_LEVEL_WARNING 4 140 | #define ASL_LEVEL_NOTICE 5 141 | #define ASL_LEVEL_INFO 6 142 | #define ASL_LEVEL_DEBUG 7 143 | #endif 144 | 145 | void _simple_asl_log(int __level, const char *__facility, const char *__message); 146 | void _simple_asl_log_prog(int level, const char *facility, const char *message, const char *progname); 147 | 148 | __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0) 149 | _SIMPLE_STRING _simple_asl_msg_new(void); 150 | 151 | __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0) 152 | void _simple_asl_msg_set(_SIMPLE_STRING __b, const char *__key, const char *__val); 153 | 154 | __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0) 155 | void _simple_asl_send(_SIMPLE_STRING __b); 156 | 157 | __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_7_0) 158 | const char *_simple_getenv(const char *envp[], const char *var); 159 | 160 | __END_DECLS 161 | 162 | #endif /* _SYSTEM_SIMPLE_H_ */ 163 | -------------------------------------------------------------------------------- /objc4-750/include/os/base_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008-2013 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_APACHE_LICENSE_HEADER_START@ 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * @APPLE_APACHE_LICENSE_HEADER_END@ 19 | */ 20 | 21 | #ifndef __OS_BASE_PRIVATE__ 22 | #define __OS_BASE_PRIVATE__ 23 | 24 | #include 25 | 26 | #ifndef os_fastpath 27 | #define os_fastpath(x) ((__typeof__(x))OS_EXPECT((long)(x), ~0l)) 28 | #endif 29 | #ifndef os_slowpath 30 | #define os_slowpath(x) ((__typeof__(x))OS_EXPECT((long)(x), 0l)) 31 | #endif 32 | #ifndef os_likely 33 | #define os_likely(x) OS_EXPECT(!!(x), 1) 34 | #endif 35 | #ifndef os_unlikely 36 | #define os_unlikely(x) OS_EXPECT(!!(x), 0) 37 | #endif 38 | 39 | #endif // __OS_BASE_PRIVATE__ 40 | -------------------------------------------------------------------------------- /objc4-750/include/os/tsd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_OSREFERENCE_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. The rights granted to you under the License 10 | * may not be used to create, or enable the creation or redistribution of, 11 | * unlawful or unlicensed copies of an Apple operating system, or to 12 | * circumvent, violate, or enable the circumvention or violation of, any 13 | * terms of an Apple operating system software license agreement. 14 | * 15 | * Please obtain a copy of the License at 16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 | * 18 | * The Original Code and all software distributed under the License are 19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 | * Please see the License for the specific language governing rights and 24 | * limitations under the License. 25 | * 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 | */ 28 | 29 | #ifndef OS_TSD_H 30 | #define OS_TSD_H 31 | 32 | /* The low nine slots of the TSD are reserved for libsyscall usage. */ 33 | #define __TSD_RESERVED_BASE 0 34 | #define __TSD_RESERVED_MAX 9 35 | 36 | #define __TSD_THREAD_SELF 0 37 | #define __TSD_ERRNO 1 38 | #define __TSD_MIG_REPLY 2 39 | #define __TSD_MACH_THREAD_SELF 3 40 | #define __TSD_THREAD_QOS_CLASS 4 41 | #define __TSD_RETURN_TO_KERNEL 5 42 | /* slot 6 is reserved for Windows/WINE compatibility reasons */ 43 | #define __TSD_PTR_MUNGE 7 44 | #define __TSD_MACH_SPECIAL_REPLY 8 45 | #define __TSD_SEMAPHORE_CACHE 9 46 | 47 | #ifndef __ASSEMBLER__ 48 | 49 | #include 50 | 51 | #ifdef __arm__ 52 | #include 53 | #endif 54 | 55 | extern void _thread_set_tsd_base(void *tsd_base); 56 | 57 | __attribute__((always_inline)) 58 | static __inline__ unsigned int 59 | _os_cpu_number(void) 60 | { 61 | #if defined(__arm__) && defined(_ARM_ARCH_6) 62 | uintptr_t p; 63 | __asm__("mrc p15, 0, %[p], c13, c0, 3" : [p] "=&r" (p)); 64 | return (unsigned int)(p & 0x3ul); 65 | #elif defined(__arm64__) 66 | uint64_t p; 67 | __asm__("mrs %[p], TPIDRRO_EL0" : [p] "=&r" (p)); 68 | return (unsigned int)p & 0x7; 69 | #elif defined(__x86_64__) || defined(__i386__) 70 | struct { uintptr_t p1, p2; } p; 71 | __asm__("sidt %[p]" : [p] "=&m" (p)); 72 | return (unsigned int)(p.p1 & 0xfff); 73 | #else 74 | #error _os_cpu_number not implemented on this architecture 75 | #endif 76 | } 77 | 78 | #if defined(__i386__) || defined(__x86_64__) 79 | 80 | #if defined(__has_attribute) 81 | #if __has_attribute(address_space) 82 | #define OS_GS_RELATIVE __attribute__((address_space(256))) 83 | #endif 84 | #endif 85 | 86 | #ifdef OS_GS_RELATIVE 87 | #define _os_tsd_get_base() ((void * OS_GS_RELATIVE *)0) 88 | #else 89 | __attribute__((always_inline)) 90 | static __inline__ void* 91 | _os_tsd_get_direct(unsigned long slot) 92 | { 93 | void *ret; 94 | __asm__("mov %%gs:%1, %0" : "=r" (ret) : "m" (*(void **)(slot * sizeof(void *)))); 95 | return ret; 96 | } 97 | 98 | __attribute__((always_inline)) 99 | static __inline__ int 100 | _os_tsd_set_direct(unsigned long slot, void *val) 101 | { 102 | #if defined(__i386__) && defined(__PIC__) 103 | __asm__("movl %1, %%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "rn" (val)); 104 | #elif defined(__i386__) && !defined(__PIC__) 105 | __asm__("movl %1, %%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "ri" (val)); 106 | #else 107 | __asm__("movq %1, %%gs:%0" : "=m" (*(void **)(slot * sizeof(void *))) : "rn" (val)); 108 | #endif 109 | return 0; 110 | } 111 | #endif 112 | 113 | #elif defined(__arm__) || defined(__arm64__) 114 | 115 | __attribute__((always_inline, pure)) 116 | static __inline__ void** 117 | _os_tsd_get_base(void) 118 | { 119 | #if defined(__arm__) && defined(_ARM_ARCH_6) 120 | uintptr_t tsd; 121 | __asm__("mrc p15, 0, %0, c13, c0, 3" : "=r" (tsd)); 122 | tsd &= ~0x3ul; /* lower 2-bits contain CPU number */ 123 | #elif defined(__arm__) && defined(_ARM_ARCH_5) 124 | register uintptr_t tsd asm ("r9"); 125 | #elif defined(__arm64__) 126 | uint64_t tsd; 127 | __asm__("mrs %0, TPIDRRO_EL0" : "=r" (tsd)); 128 | tsd &= ~0x7ull; 129 | #endif 130 | 131 | return (void**)(uintptr_t)tsd; 132 | } 133 | #define _os_tsd_get_base() _os_tsd_get_base() 134 | 135 | #else 136 | #error _os_tsd_get_base not implemented on this architecture 137 | #endif 138 | 139 | #ifdef _os_tsd_get_base 140 | __attribute__((always_inline)) 141 | static __inline__ void* 142 | _os_tsd_get_direct(unsigned long slot) 143 | { 144 | return _os_tsd_get_base()[slot]; 145 | } 146 | 147 | __attribute__((always_inline)) 148 | static __inline__ int 149 | _os_tsd_set_direct(unsigned long slot, void *val) 150 | { 151 | _os_tsd_get_base()[slot] = val; 152 | return 0; 153 | } 154 | #endif 155 | 156 | __attribute__((always_inline, pure)) 157 | static __inline__ uintptr_t 158 | _os_ptr_munge_token(void) 159 | { 160 | return (uintptr_t)_os_tsd_get_direct(__TSD_PTR_MUNGE); 161 | } 162 | 163 | __attribute__((always_inline, pure)) 164 | static __inline__ uintptr_t 165 | _os_ptr_munge(uintptr_t ptr) 166 | { 167 | return ptr ^ _os_ptr_munge_token(); 168 | } 169 | #define _OS_PTR_MUNGE(_ptr) _os_ptr_munge((uintptr_t)(_ptr)) 170 | #define _OS_PTR_UNMUNGE(_ptr) _os_ptr_munge((uintptr_t)(_ptr)) 171 | 172 | #else // __ASSEMBLER__ 173 | 174 | #define _OS_TSD_OFFSET(_key) \ 175 | ((__POINTER_WIDTH__/__CHAR_BIT__)*_key) 176 | 177 | #if defined(__i386__) || defined(__x86_64__) 178 | 179 | #define _OS_PTR_MUNGE(_reg) \ 180 | xor %gs:_OS_TSD_OFFSET(__TSD_PTR_MUNGE), _reg 181 | 182 | #define _OS_PTR_UNMUNGE(_reg) \ 183 | _OS_PTR_MUNGE(_reg) 184 | 185 | #elif defined(__arm__) || defined(__arm64__) 186 | 187 | #if defined(__arm__) 188 | 189 | #define _OS_PTR_MUNGE_TOKEN(_reg, _token) \ 190 | mrc p15, 0, _reg, c13, c0, 3; \ 191 | bic _reg, _reg, #3; \ 192 | ldr _token, [ _reg, #_OS_TSD_OFFSET(__TSD_PTR_MUNGE) ] 193 | 194 | #elif defined(__arm64__) 195 | 196 | #define _OS_PTR_MUNGE_TOKEN(_reg, _token) \ 197 | mrs _reg, TPIDRRO_EL0 %% \ 198 | and _reg, _reg, #~0x7 %% \ 199 | ldr _token, [ _reg, #_OS_TSD_OFFSET(__TSD_PTR_MUNGE) ] 200 | 201 | #endif // defined(__arm64__) 202 | 203 | #define _OS_PTR_MUNGE(_regdest, _regsrc, _token) \ 204 | eor _regdest, _regsrc, _token 205 | 206 | #define _OS_PTR_UNMUNGE(_regdest, _regsrc, _token) \ 207 | _OS_PTR_MUNGE(_regdest, _regsrc, _token) 208 | 209 | #endif // defined(__arm__) || defined(__arm64__) 210 | 211 | #endif // __ASSEMBLER__ 212 | 213 | #endif // OS_TSD_H 214 | -------------------------------------------------------------------------------- /objc4-750/include/pthread/spinlock_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003, 2013 Apple Computer, 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 | * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991 25 | * All Rights Reserved 26 | * 27 | * Permission to use, copy, modify, and distribute this software and 28 | * its documentation for any purpose and without fee is hereby granted, 29 | * provided that the above copyright notice appears in all copies and 30 | * that both the copyright notice and this permission notice appear in 31 | * supporting documentation. 32 | * 33 | * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 34 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 35 | * FOR A PARTICULAR PURPOSE. 36 | * 37 | * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 38 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 39 | * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 40 | * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 41 | * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 42 | * 43 | */ 44 | /* 45 | * MkLinux 46 | */ 47 | 48 | /* 49 | * POSIX Threads - IEEE 1003.1c 50 | */ 51 | 52 | #ifndef _POSIX_PTHREAD_SPINLOCK_H 53 | #define _POSIX_PTHREAD_SPINLOCK_H 54 | 55 | #include 56 | #include 57 | #include 58 | 59 | typedef volatile OSSpinLock pthread_lock_t __deprecated_msg("Use instead"); 60 | 61 | #define LOCK_INIT(l) ((l) = OS_SPINLOCK_INIT) 62 | #define LOCK_INITIALIZER OS_SPINLOCK_INIT 63 | 64 | #define _DO_SPINLOCK_LOCK(v) OSSpinLockLock(v) 65 | #define _DO_SPINLOCK_UNLOCK(v) OSSpinLockUnlock(v) 66 | 67 | #define TRY_LOCK(v) OSSpinLockTry((volatile OSSpinLock *)&(v)) 68 | #define LOCK(v) OSSpinLockLock((volatile OSSpinLock *)&(v)) 69 | #define UNLOCK(v) OSSpinLockUnlock((volatile OSSpinLock *)&(v)) 70 | 71 | extern void _spin_lock(pthread_lock_t *lockp) __deprecated_msg("Use instead"); 72 | extern int _spin_lock_try(pthread_lock_t *lockp) __deprecated_msg("Use instead"); 73 | extern void _spin_unlock(pthread_lock_t *lockp) __deprecated_msg("Use instead"); 74 | 75 | extern void spin_lock(pthread_lock_t *lockp) __deprecated_msg("Use instead"); 76 | extern int spin_lock_try(pthread_lock_t *lockp) __deprecated_msg("Use instead"); 77 | extern void spin_unlock(pthread_lock_t *lockp) __deprecated_msg("Use instead"); 78 | 79 | #endif /* _POSIX_PTHREAD_SPINLOCK_H */ 80 | -------------------------------------------------------------------------------- /objc4-750/interposable.txt: -------------------------------------------------------------------------------- 1 | _objc_release 2 | -------------------------------------------------------------------------------- /objc4-750/myTest/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // myTest 4 | // 5 | // Created by Smile on 2018/12/19. 6 | // 7 | 8 | #import 9 | #import 10 | #import 11 | 12 | int main(int argc, const char * argv[]) { 13 | @autoreleasepool { 14 | NSObject *obj = [[NSObject alloc] init]; 15 | 16 | //获得NSObject实例对象的成员变量所占用的大小 >> 8 17 | NSLog(@"%zd", class_getInstanceSize([NSObject class])); 18 | 19 | //获得obj指针所指向内存的大小 >> 16 20 | //malloc_size(const void *ptr):Returns size of given ptr 21 | NSLog(@"%zd", malloc_size((__bridge const void *)obj)); 22 | } 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /objc4-750/objc.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual C++ Express 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "objc", "objc.vcproj", "{B3408263-0CF1-47BE-83CC-56070EFC9BC1}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "objcrt", "objcrt\objcrt.vcproj", "{E38C1996-8B3D-4050-A4B2-DC85957B047D}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {B3408263-0CF1-47BE-83CC-56070EFC9BC1} = {B3408263-0CF1-47BE-83CC-56070EFC9BC1} 9 | EndProjectSection 10 | EndProject 11 | Global 12 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 13 | Debug|Win32 = Debug|Win32 14 | DebugDLL|Win32 = DebugDLL|Win32 15 | Release|Win32 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {B3408263-0CF1-47BE-83CC-56070EFC9BC1}.Debug|Win32.ActiveCfg = Debug|Win32 19 | {B3408263-0CF1-47BE-83CC-56070EFC9BC1}.Debug|Win32.Build.0 = Debug|Win32 20 | {B3408263-0CF1-47BE-83CC-56070EFC9BC1}.DebugDLL|Win32.ActiveCfg = DebugDLL|Win32 21 | {B3408263-0CF1-47BE-83CC-56070EFC9BC1}.DebugDLL|Win32.Build.0 = DebugDLL|Win32 22 | {B3408263-0CF1-47BE-83CC-56070EFC9BC1}.Release|Win32.ActiveCfg = Release|Win32 23 | {B3408263-0CF1-47BE-83CC-56070EFC9BC1}.Release|Win32.Build.0 = Release|Win32 24 | {E38C1996-8B3D-4050-A4B2-DC85957B047D}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {E38C1996-8B3D-4050-A4B2-DC85957B047D}.Debug|Win32.Build.0 = Debug|Win32 26 | {E38C1996-8B3D-4050-A4B2-DC85957B047D}.DebugDLL|Win32.ActiveCfg = Debug|Win32 27 | {E38C1996-8B3D-4050-A4B2-DC85957B047D}.DebugDLL|Win32.Build.0 = Debug|Win32 28 | {E38C1996-8B3D-4050-A4B2-DC85957B047D}.Release|Win32.ActiveCfg = Release|Win32 29 | {E38C1996-8B3D-4050-A4B2-DC85957B047D}.Release|Win32.Build.0 = Release|Win32 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /objc4-750/objc.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /objc4-750/objc.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /objc4-750/objcrt/objcrt.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 14 | 15 | 16 | 17 | 24 | 28 | 31 | 34 | 38 | 39 | 47 | 51 | 54 | 57 | 61 | 62 | 63 | 64 | 65 | 66 | 71 | 74 | 75 | 76 | 81 | 84 | 85 | 86 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /objc4-750/prebuild.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo prebuild: installing headers 4 | xcopy /Y "%ProjectDir%runtime\objc.h" "%DSTROOT%\AppleInternal\include\objc\" 5 | xcopy /Y "%ProjectDir%runtime\objc-api.h" "%DSTROOT%\AppleInternal\include\objc\" 6 | xcopy /Y "%ProjectDir%runtime\objc-auto.h" "%DSTROOT%\AppleInternal\include\objc\" 7 | xcopy /Y "%ProjectDir%runtime\objc-exception.h" "%DSTROOT%\AppleInternal\include\objc\" 8 | xcopy /Y "%ProjectDir%runtime\message.h" "%DSTROOT%\AppleInternal\include\objc\" 9 | xcopy /Y "%ProjectDir%runtime\runtime.h" "%DSTROOT%\AppleInternal\include\objc\" 10 | xcopy /Y "%ProjectDir%runtime\hashtable.h" "%DSTROOT%\AppleInternal\include\objc\" 11 | xcopy /Y "%ProjectDir%runtime\hashtable2.h" "%DSTROOT%\AppleInternal\include\objc\" 12 | xcopy /Y "%ProjectDir%runtime\maptable.h" "%DSTROOT%\AppleInternal\include\objc\" 13 | 14 | echo prebuild: setting version 15 | version 16 | -------------------------------------------------------------------------------- /objc4-750/runtime/Module/module.modulemap: -------------------------------------------------------------------------------- 1 | module ObjectiveC [system] [extern_c] { 2 | umbrella "." 3 | export * 4 | module * { 5 | export * 6 | } 7 | 8 | module NSObject { 9 | requires objc 10 | header "NSObject.h" 11 | export * 12 | } 13 | 14 | #if defined(BUILD_FOR_OSX) 15 | module List { 16 | // Uses @defs, which does not work in ObjC++ or non-ARC. 17 | requires objc, !objc_arc, !cplusplus 18 | header "List.h" 19 | export * 20 | } 21 | 22 | module Object { 23 | requires objc 24 | header "Object.h" 25 | export * 26 | } 27 | 28 | module Protocol { 29 | requires objc 30 | header "Protocol.h" 31 | export * 32 | } 33 | #endif 34 | 35 | #if !defined(BUILD_FOR_OSX) 36 | // These file are not available outside macOS. 37 | exclude header "hashtable.h" 38 | exclude header "hashtable2.h" 39 | #endif 40 | } 41 | -------------------------------------------------------------------------------- /objc4-750/runtime/NSObjCRuntime.h: -------------------------------------------------------------------------------- 1 | /* NSObjCRuntime.h 2 | Copyright (c) 1994-2012, Apple Inc. All rights reserved. 3 | */ 4 | 5 | #ifndef _OBJC_NSOBJCRUNTIME_H_ 6 | #define _OBJC_NSOBJCRUNTIME_H_ 7 | 8 | #include 9 | #include 10 | 11 | #if __LP64__ || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64 12 | typedef long NSInteger; 13 | typedef unsigned long NSUInteger; 14 | #else 15 | typedef int NSInteger; 16 | typedef unsigned int NSUInteger; 17 | #endif 18 | 19 | #define NSIntegerMax LONG_MAX 20 | #define NSIntegerMin LONG_MIN 21 | #define NSUIntegerMax ULONG_MAX 22 | 23 | #define NSINTEGER_DEFINED 1 24 | 25 | #ifndef NS_DESIGNATED_INITIALIZER 26 | #if __has_attribute(objc_designated_initializer) 27 | #define NS_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) 28 | #else 29 | #define NS_DESIGNATED_INITIALIZER 30 | #endif 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /objc4-750/runtime/NSObject.h: -------------------------------------------------------------------------------- 1 | /* NSObject.h 2 | Copyright (c) 1994-2012, Apple Inc. All rights reserved. 3 | */ 4 | 5 | #ifndef _OBJC_NSOBJECT_H_ 6 | #define _OBJC_NSOBJECT_H_ 7 | 8 | #if __OBJC__ 9 | 10 | #include 11 | #include 12 | 13 | @class NSString, NSMethodSignature, NSInvocation; 14 | 15 | @protocol NSObject 16 | 17 | - (BOOL)isEqual:(id)object; 18 | @property (readonly) NSUInteger hash; 19 | 20 | @property (readonly) Class superclass; 21 | - (Class)class OBJC_SWIFT_UNAVAILABLE("use 'type(of: anObject)' instead"); 22 | - (instancetype)self; 23 | 24 | - (id)performSelector:(SEL)aSelector; 25 | - (id)performSelector:(SEL)aSelector withObject:(id)object; 26 | - (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2; 27 | 28 | - (BOOL)isProxy; 29 | 30 | - (BOOL)isKindOfClass:(Class)aClass; 31 | - (BOOL)isMemberOfClass:(Class)aClass; 32 | - (BOOL)conformsToProtocol:(Protocol *)aProtocol; 33 | 34 | - (BOOL)respondsToSelector:(SEL)aSelector; 35 | 36 | - (instancetype)retain OBJC_ARC_UNAVAILABLE; 37 | - (oneway void)release OBJC_ARC_UNAVAILABLE; 38 | - (instancetype)autorelease OBJC_ARC_UNAVAILABLE; 39 | - (NSUInteger)retainCount OBJC_ARC_UNAVAILABLE; 40 | 41 | - (struct _NSZone *)zone OBJC_ARC_UNAVAILABLE; 42 | 43 | @property (readonly, copy) NSString *description; 44 | @optional 45 | @property (readonly, copy) NSString *debugDescription; 46 | 47 | @end 48 | 49 | 50 | OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0) 51 | OBJC_ROOT_CLASS 52 | OBJC_EXPORT 53 | @interface NSObject { 54 | #pragma clang diagnostic push 55 | #pragma clang diagnostic ignored "-Wobjc-interface-ivars" 56 | Class isa OBJC_ISA_AVAILABILITY; 57 | #pragma clang diagnostic pop 58 | } 59 | 60 | + (void)load; 61 | 62 | + (void)initialize; 63 | - (instancetype)init 64 | #if NS_ENFORCE_NSOBJECT_DESIGNATED_INITIALIZER 65 | NS_DESIGNATED_INITIALIZER 66 | #endif 67 | ; 68 | 69 | + (instancetype)new OBJC_SWIFT_UNAVAILABLE("use object initializers instead"); 70 | + (instancetype)allocWithZone:(struct _NSZone *)zone OBJC_SWIFT_UNAVAILABLE("use object initializers instead"); 71 | + (instancetype)alloc OBJC_SWIFT_UNAVAILABLE("use object initializers instead"); 72 | - (void)dealloc OBJC_SWIFT_UNAVAILABLE("use 'deinit' to define a de-initializer"); 73 | 74 | - (void)finalize OBJC_DEPRECATED("Objective-C garbage collection is no longer supported"); 75 | 76 | - (id)copy; 77 | - (id)mutableCopy; 78 | 79 | + (id)copyWithZone:(struct _NSZone *)zone OBJC_ARC_UNAVAILABLE; 80 | + (id)mutableCopyWithZone:(struct _NSZone *)zone OBJC_ARC_UNAVAILABLE; 81 | 82 | + (BOOL)instancesRespondToSelector:(SEL)aSelector; 83 | + (BOOL)conformsToProtocol:(Protocol *)protocol; 84 | - (IMP)methodForSelector:(SEL)aSelector; 85 | + (IMP)instanceMethodForSelector:(SEL)aSelector; 86 | - (void)doesNotRecognizeSelector:(SEL)aSelector; 87 | 88 | - (id)forwardingTargetForSelector:(SEL)aSelector OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0); 89 | - (void)forwardInvocation:(NSInvocation *)anInvocation OBJC_SWIFT_UNAVAILABLE(""); 90 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector OBJC_SWIFT_UNAVAILABLE(""); 91 | 92 | + (NSMethodSignature *)instanceMethodSignatureForSelector:(SEL)aSelector OBJC_SWIFT_UNAVAILABLE(""); 93 | 94 | - (BOOL)allowsWeakReference UNAVAILABLE_ATTRIBUTE; 95 | - (BOOL)retainWeakReference UNAVAILABLE_ATTRIBUTE; 96 | 97 | + (BOOL)isSubclassOfClass:(Class)aClass; 98 | 99 | + (BOOL)resolveClassMethod:(SEL)sel OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0); 100 | + (BOOL)resolveInstanceMethod:(SEL)sel OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0); 101 | 102 | + (NSUInteger)hash; 103 | + (Class)superclass; 104 | + (Class)class OBJC_SWIFT_UNAVAILABLE("use 'aClass.self' instead"); 105 | + (NSString *)description; 106 | + (NSString *)debugDescription; 107 | 108 | @end 109 | 110 | #endif 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /objc4-750/runtime/Object.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2003, 2005-2007 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 | Object.h 25 | Copyright 1988-1996 NeXT Software, Inc. 26 | 27 | DEFINED AS: A common class 28 | HEADER FILES: 29 | 30 | */ 31 | 32 | #ifndef _OBJC_OBJECT_H_ 33 | #define _OBJC_OBJECT_H_ 34 | 35 | #include 36 | #include 37 | 38 | #if __OBJC__ && !__OBJC2__ 39 | 40 | __OSX_AVAILABLE(10.0) 41 | __IOS_UNAVAILABLE __TVOS_UNAVAILABLE 42 | __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE 43 | OBJC_ROOT_CLASS 44 | @interface Object 45 | { 46 | Class isa; /* A pointer to the instance's class structure */ 47 | } 48 | 49 | /* Initializing classes and instances */ 50 | 51 | + (id)initialize; 52 | - (id)init; 53 | 54 | /* Creating, copying, and freeing instances */ 55 | 56 | + (id)new; 57 | + (id)free; 58 | - (id)free; 59 | + (id)alloc; 60 | - (id)copy; 61 | + (id)allocFromZone:(void *)zone; 62 | - (id)copyFromZone:(void *)zone; 63 | - (void *)zone; 64 | 65 | /* Identifying classes */ 66 | 67 | + (id)class; 68 | + (id)superclass; 69 | + (const char *) name; 70 | - (id)class; 71 | - (id)superclass; 72 | - (const char *) name; 73 | 74 | /* Identifying and comparing instances */ 75 | 76 | - (id)self; 77 | - (unsigned int) hash; 78 | - (BOOL) isEqual:anObject; 79 | 80 | /* Testing inheritance relationships */ 81 | 82 | - (BOOL) isKindOf: aClassObject; 83 | - (BOOL) isMemberOf: aClassObject; 84 | - (BOOL) isKindOfClassNamed: (const char *)aClassName; 85 | - (BOOL) isMemberOfClassNamed: (const char *)aClassName; 86 | 87 | /* Testing class functionality */ 88 | 89 | + (BOOL) instancesRespondTo:(SEL)aSelector; 90 | - (BOOL) respondsTo:(SEL)aSelector; 91 | 92 | /* Testing protocol conformance */ 93 | 94 | - (BOOL) conformsTo: (Protocol *)aProtocolObject; 95 | + (BOOL) conformsTo: (Protocol *)aProtocolObject; 96 | 97 | /* Obtaining method descriptors from protocols */ 98 | 99 | - (struct objc_method_description *) descriptionForMethod:(SEL)aSel; 100 | + (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel; 101 | 102 | /* Obtaining method handles */ 103 | 104 | - (IMP) methodFor:(SEL)aSelector; 105 | + (IMP) instanceMethodFor:(SEL)aSelector; 106 | 107 | /* Sending messages determined at run time */ 108 | 109 | - (id)perform:(SEL)aSelector; 110 | - (id)perform:(SEL)aSelector with:anObject; 111 | - (id)perform:(SEL)aSelector with:object1 with:object2; 112 | 113 | /* Posing */ 114 | 115 | + (id)poseAs: aClassObject; 116 | 117 | /* Enforcing intentions */ 118 | 119 | - (id)subclassResponsibility:(SEL)aSelector; 120 | - (id)notImplemented:(SEL)aSelector; 121 | 122 | /* Error handling */ 123 | 124 | - (id)doesNotRecognize:(SEL)aSelector; 125 | - (id)error:(const char *)aString, ...; 126 | 127 | /* Debugging */ 128 | 129 | - (void) printForDebugger:(void *)stream; 130 | 131 | /* Archiving */ 132 | 133 | - (id)awake; 134 | - (id)write:(void *)stream; 135 | - (id)read:(void *)stream; 136 | + (int) version; 137 | + (id)setVersion: (int) aVersion; 138 | 139 | /* Forwarding */ 140 | 141 | - (id)forward: (SEL)sel : (marg_list)args; 142 | - (id)performv: (SEL)sel : (marg_list)args; 143 | 144 | @end 145 | 146 | /* Abstract Protocol for Archiving */ 147 | 148 | @interface Object (Archiving) 149 | 150 | - (id)startArchiving: (void *)stream; 151 | - (id)finishUnarchiving; 152 | 153 | @end 154 | 155 | /* Abstract Protocol for Dynamic Loading */ 156 | 157 | @interface Object (DynamicLoading) 158 | 159 | //+ finishLoading:(headerType *)header; 160 | struct mach_header; 161 | + (id)finishLoading:(struct mach_header *)header; 162 | + (id)startUnloading; 163 | 164 | @end 165 | 166 | #endif 167 | 168 | #endif /* _OBJC_OBJECT_H_ */ 169 | -------------------------------------------------------------------------------- /objc4-750/runtime/OldClasses.subproj/List.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2002, 2005-2007 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 | List.h 25 | Copyright 1988-1996 NeXT Software, Inc. 26 | 27 | DEFINED AS: A common class 28 | HEADER FILES: objc/List.h 29 | 30 | */ 31 | 32 | #ifndef _OBJC_LIST_H_ 33 | #define _OBJC_LIST_H_ 34 | 35 | #if __OBJC__ && !__OBJC2__ && !__cplusplus && !__has_feature(objc_arc) 36 | 37 | #include 38 | #include 39 | 40 | DEPRECATED_ATTRIBUTE 41 | @interface List : Object 42 | { 43 | @public 44 | id *dataPtr DEPRECATED_ATTRIBUTE; /* data of the List object */ 45 | unsigned numElements DEPRECATED_ATTRIBUTE; /* Actual number of elements */ 46 | unsigned maxElements DEPRECATED_ATTRIBUTE; /* Total allocated elements */ 47 | } 48 | 49 | /* Creating, freeing */ 50 | 51 | - (id)free DEPRECATED_ATTRIBUTE; 52 | - (id)freeObjects DEPRECATED_ATTRIBUTE; 53 | - (id)copyFromZone:(void *)z DEPRECATED_ATTRIBUTE; 54 | 55 | /* Initializing */ 56 | 57 | - (id)init DEPRECATED_ATTRIBUTE; 58 | - (id)initCount:(unsigned)numSlots DEPRECATED_ATTRIBUTE; 59 | 60 | /* Comparing two lists */ 61 | 62 | - (BOOL)isEqual: anObject DEPRECATED_ATTRIBUTE; 63 | 64 | /* Managing the storage capacity */ 65 | 66 | - (unsigned)capacity DEPRECATED_ATTRIBUTE; 67 | - (id)setAvailableCapacity:(unsigned)numSlots DEPRECATED_ATTRIBUTE; 68 | 69 | /* Manipulating objects by index */ 70 | 71 | - (unsigned)count DEPRECATED_ATTRIBUTE; 72 | - (id)objectAt:(unsigned)index DEPRECATED_ATTRIBUTE; 73 | - (id)lastObject DEPRECATED_ATTRIBUTE; 74 | - (id)addObject:anObject DEPRECATED_ATTRIBUTE; 75 | - (id)insertObject:anObject at:(unsigned)index DEPRECATED_ATTRIBUTE; 76 | - (id)removeObjectAt:(unsigned)index DEPRECATED_ATTRIBUTE; 77 | - (id)removeLastObject DEPRECATED_ATTRIBUTE; 78 | - (id)replaceObjectAt:(unsigned)index with:newObject DEPRECATED_ATTRIBUTE; 79 | - (id)appendList: (List *)otherList DEPRECATED_ATTRIBUTE; 80 | 81 | /* Manipulating objects by id */ 82 | 83 | - (unsigned)indexOf:anObject DEPRECATED_ATTRIBUTE; 84 | - (id)addObjectIfAbsent:anObject DEPRECATED_ATTRIBUTE; 85 | - (id)removeObject:anObject DEPRECATED_ATTRIBUTE; 86 | - (id)replaceObject:anObject with:newObject DEPRECATED_ATTRIBUTE; 87 | 88 | /* Emptying the list */ 89 | 90 | - (id)empty DEPRECATED_ATTRIBUTE; 91 | 92 | /* Sending messages to elements of the list */ 93 | 94 | - (id)makeObjectsPerform:(SEL)aSelector DEPRECATED_ATTRIBUTE; 95 | - (id)makeObjectsPerform:(SEL)aSelector with:anObject DEPRECATED_ATTRIBUTE; 96 | 97 | /* 98 | * The following new... methods are now obsolete. They remain in this 99 | * interface file for backward compatibility only. Use Object's alloc method 100 | * and the init... methods defined in this class instead. 101 | */ 102 | 103 | + (id)new DEPRECATED_ATTRIBUTE; 104 | + (id)newCount:(unsigned)numSlots DEPRECATED_ATTRIBUTE; 105 | 106 | @end 107 | 108 | typedef struct { 109 | @defs(List); 110 | } NXListId DEPRECATED_ATTRIBUTE; 111 | 112 | #define NX_ADDRESS(x) (((NXListId *)(x))->dataPtr) 113 | 114 | #define NX_NOT_IN_LIST 0xffffffff 115 | 116 | #endif 117 | 118 | #endif /* _OBJC_LIST_H_ */ 119 | -------------------------------------------------------------------------------- /objc4-750/runtime/OldClasses.subproj/List.m: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2001, 2005-2006 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 | List.m 25 | Copyright 1988-1996 NeXT Software, Inc. 26 | Written by: Bryan Yamamoto 27 | Responsibility: Bertrand Serlet 28 | */ 29 | 30 | #ifndef __OBJC2__ 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | #include 37 | 38 | #define DATASIZE(count) ((count) * sizeof(id)) 39 | 40 | @implementation List 41 | 42 | + (id)initialize 43 | { 44 | [self setVersion: 1]; 45 | return self; 46 | } 47 | 48 | - (id)initCount:(unsigned)numSlots 49 | { 50 | maxElements = numSlots; 51 | if (maxElements) 52 | dataPtr = (id *)malloc(DATASIZE(maxElements)); 53 | return self; 54 | } 55 | 56 | + (id)newCount:(unsigned)numSlots 57 | { 58 | return [[self alloc] initCount:numSlots]; 59 | } 60 | 61 | + (id)new 62 | { 63 | return [self newCount:0]; 64 | } 65 | 66 | - (id)init 67 | { 68 | return [self initCount:0]; 69 | } 70 | 71 | - (id)free 72 | { 73 | free(dataPtr); 74 | return [super free]; 75 | } 76 | 77 | - (id)freeObjects 78 | { 79 | id element; 80 | while ((element = [self removeLastObject])) 81 | [element free]; 82 | return self; 83 | } 84 | 85 | - (id)copyFromZone:(void *)z 86 | { 87 | List *new = [[[self class] alloc] initCount: numElements]; 88 | new->numElements = numElements; 89 | bcopy ((const char*)dataPtr, (char*)new->dataPtr, DATASIZE(numElements)); 90 | return new; 91 | } 92 | 93 | - (BOOL) isEqual: anObject 94 | { 95 | List *other; 96 | if (! [anObject isKindOf: [self class]]) return NO; 97 | other = (List *) anObject; 98 | return (numElements == other->numElements) 99 | && (bcmp ((const char*)dataPtr, (const char*)other->dataPtr, DATASIZE(numElements)) == 0); 100 | } 101 | 102 | - (unsigned)capacity 103 | { 104 | return maxElements; 105 | } 106 | 107 | - (unsigned)count 108 | { 109 | return numElements; 110 | } 111 | 112 | - (id)objectAt:(unsigned)index 113 | { 114 | if (index >= numElements) 115 | return nil; 116 | return dataPtr[index]; 117 | } 118 | 119 | - (unsigned)indexOf:anObject 120 | { 121 | register id *this = dataPtr; 122 | register id *last = this + numElements; 123 | while (this < last) { 124 | if (*this == anObject) 125 | return this - dataPtr; 126 | this++; 127 | } 128 | return NX_NOT_IN_LIST; 129 | } 130 | 131 | - (id)lastObject 132 | { 133 | if (! numElements) 134 | return nil; 135 | return dataPtr[numElements - 1]; 136 | } 137 | 138 | - (id)setAvailableCapacity:(unsigned)numSlots 139 | { 140 | volatile id *tempDataPtr; 141 | if (numSlots < numElements) return nil; 142 | tempDataPtr = (id *) realloc (dataPtr, DATASIZE(numSlots)); 143 | dataPtr = (id *)tempDataPtr; 144 | maxElements = numSlots; 145 | return self; 146 | } 147 | 148 | - (id)insertObject:anObject at:(unsigned)index 149 | { 150 | register id *this, *last, *prev; 151 | if (! anObject) return nil; 152 | if (index > numElements) 153 | return nil; 154 | if ((numElements + 1) > maxElements) { 155 | volatile id *tempDataPtr; 156 | /* we double the capacity, also a good size for malloc */ 157 | maxElements += maxElements + 1; 158 | tempDataPtr = (id *) realloc (dataPtr, DATASIZE(maxElements)); 159 | dataPtr = (id*)tempDataPtr; 160 | } 161 | this = dataPtr + numElements; 162 | prev = this - 1; 163 | last = dataPtr + index; 164 | while (this > last) 165 | *this-- = *prev--; 166 | *last = anObject; 167 | numElements++; 168 | return self; 169 | } 170 | 171 | - (id)addObject:anObject 172 | { 173 | return [self insertObject:anObject at:numElements]; 174 | 175 | } 176 | 177 | 178 | - (id)addObjectIfAbsent:anObject 179 | { 180 | register id *this, *last; 181 | if (! anObject) return nil; 182 | this = dataPtr; 183 | last = dataPtr + numElements; 184 | while (this < last) { 185 | if (*this == anObject) 186 | return self; 187 | this++; 188 | } 189 | return [self insertObject:anObject at:numElements]; 190 | 191 | } 192 | 193 | 194 | - (id)removeObjectAt:(unsigned)index 195 | { 196 | register id *this, *last, *next; 197 | id retval; 198 | if (index >= numElements) 199 | return nil; 200 | this = dataPtr + index; 201 | last = dataPtr + numElements; 202 | next = this + 1; 203 | retval = *this; 204 | while (next < last) 205 | *this++ = *next++; 206 | numElements--; 207 | return retval; 208 | } 209 | 210 | - (id)removeObject:anObject 211 | { 212 | register id *this, *last; 213 | this = dataPtr; 214 | last = dataPtr + numElements; 215 | while (this < last) { 216 | if (*this == anObject) 217 | return [self removeObjectAt:this - dataPtr]; 218 | this++; 219 | } 220 | return nil; 221 | } 222 | 223 | - (id)removeLastObject 224 | { 225 | if (! numElements) 226 | return nil; 227 | return [self removeObjectAt: numElements - 1]; 228 | } 229 | 230 | - (id)empty 231 | { 232 | numElements = 0; 233 | return self; 234 | } 235 | 236 | - (id)replaceObject:anObject with:newObject 237 | { 238 | register id *this, *last; 239 | if (! newObject) 240 | return nil; 241 | this = dataPtr; 242 | last = dataPtr + numElements; 243 | while (this < last) { 244 | if (*this == anObject) { 245 | *this = newObject; 246 | return anObject; 247 | } 248 | this++; 249 | } 250 | return nil; 251 | } 252 | 253 | - (id)replaceObjectAt:(unsigned)index with:newObject 254 | { 255 | register id *this; 256 | id retval; 257 | if (! newObject) 258 | return nil; 259 | if (index >= numElements) 260 | return nil; 261 | this = dataPtr + index; 262 | retval = *this; 263 | *this = newObject; 264 | return retval; 265 | } 266 | 267 | - (id)makeObjectsPerform:(SEL)aSelector 268 | { 269 | unsigned count = numElements; 270 | while (count--) 271 | [dataPtr[count] perform: aSelector]; 272 | return self; 273 | } 274 | 275 | - (id)makeObjectsPerform:(SEL)aSelector with:anObject 276 | { 277 | unsigned count = numElements; 278 | while (count--) 279 | [dataPtr[count] perform: aSelector with: anObject]; 280 | return self; 281 | } 282 | 283 | -(id)appendList: (List *)otherList 284 | { 285 | unsigned i, count; 286 | 287 | for (i = 0, count = [otherList count]; i < count; i++) 288 | [self addObject: [otherList objectAt: i]]; 289 | return self; 290 | } 291 | 292 | @end 293 | 294 | #endif 295 | -------------------------------------------------------------------------------- /objc4-750/runtime/Protocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2003, 2006-2007 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 | Protocol.h 25 | Copyright 1991-1996 NeXT Software, Inc. 26 | */ 27 | 28 | #ifndef _OBJC_PROTOCOL_H_ 29 | #define _OBJC_PROTOCOL_H_ 30 | 31 | #if !__OBJC__ 32 | 33 | // typedef Protocol is here: 34 | #include 35 | 36 | 37 | #elif __OBJC2__ 38 | 39 | #include 40 | 41 | // All methods of class Protocol are unavailable. 42 | // Use the functions in objc/runtime.h instead. 43 | 44 | OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0) 45 | @interface Protocol : NSObject 46 | @end 47 | 48 | 49 | #else 50 | 51 | #include 52 | 53 | OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0) 54 | @interface Protocol : Object 55 | { 56 | @private 57 | char *protocol_name OBJC2_UNAVAILABLE; 58 | struct objc_protocol_list *protocol_list OBJC2_UNAVAILABLE; 59 | struct objc_method_description_list *instance_methods OBJC2_UNAVAILABLE; 60 | struct objc_method_description_list *class_methods OBJC2_UNAVAILABLE; 61 | } 62 | 63 | /* Obtaining attributes intrinsic to the protocol */ 64 | 65 | - (const char *)name OBJC2_UNAVAILABLE; 66 | 67 | /* Testing protocol conformance */ 68 | 69 | - (BOOL) conformsTo: (Protocol *)aProtocolObject OBJC2_UNAVAILABLE; 70 | 71 | /* Looking up information specific to a protocol */ 72 | 73 | - (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel 74 | __OSX_DEPRECATED(10.0, 10.5, "use protocol_getMethodDescription instead") 75 | __IOS_DEPRECATED(2.0, 2.0, "use protocol_getMethodDescription instead") 76 | __TVOS_DEPRECATED(9.0, 9.0, "use protocol_getMethodDescription instead") 77 | __WATCHOS_DEPRECATED(1.0, 1.0, "use protocol_getMethodDescription instead") 78 | __BRIDGEOS_DEPRECATED(2.0, 2.0, "use protocol_getMethodDescription instead"); 79 | - (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel 80 | __OSX_DEPRECATED(10.0, 10.5, "use protocol_getMethodDescription instead") 81 | __IOS_DEPRECATED(2.0, 2.0, "use protocol_getMethodDescription instead") 82 | __TVOS_DEPRECATED(9.0, 9.0, "use protocol_getMethodDescription instead") 83 | __WATCHOS_DEPRECATED(1.0, 1.0, "use protocol_getMethodDescription instead") 84 | __BRIDGEOS_DEPRECATED(2.0, 2.0, "use protocol_getMethodDescription instead"); 85 | 86 | @end 87 | 88 | #endif 89 | 90 | #endif /* _OBJC_PROTOCOL_H_ */ 91 | -------------------------------------------------------------------------------- /objc4-750/runtime/Protocol.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2001, 2005-2007 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 | Protocol.h 25 | Copyright 1991-1996 NeXT Software, Inc. 26 | */ 27 | 28 | #include "objc-private.h" 29 | 30 | #undef id 31 | #undef Class 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include "Protocol.h" 39 | #include "NSObject.h" 40 | 41 | // __IncompleteProtocol is used as the return type of objc_allocateProtocol(). 42 | 43 | // Old ABI uses NSObject as the superclass even though Protocol uses Object 44 | // because the R/R implementation for class Protocol is added at runtime 45 | // by CF, so __IncompleteProtocol would be left without an R/R implementation 46 | // otherwise, which would break ARC. 47 | 48 | @interface __IncompleteProtocol : NSObject @end 49 | @implementation __IncompleteProtocol 50 | #if __OBJC2__ 51 | // fixme hack - make __IncompleteProtocol a non-lazy class 52 | + (void) load { } 53 | #endif 54 | @end 55 | 56 | 57 | @implementation Protocol 58 | 59 | #if __OBJC2__ 60 | // fixme hack - make Protocol a non-lazy class 61 | + (void) load { } 62 | #endif 63 | 64 | 65 | - (BOOL) conformsTo: (Protocol *)aProtocolObj 66 | { 67 | return protocol_conformsToProtocol(self, aProtocolObj); 68 | } 69 | 70 | - (struct objc_method_description *) descriptionForInstanceMethod:(SEL)aSel 71 | { 72 | #if !__OBJC2__ 73 | return lookup_protocol_method((struct old_protocol *)self, aSel, 74 | YES/*required*/, YES/*instance*/, 75 | YES/*recursive*/); 76 | #else 77 | return method_getDescription(protocol_getMethod((struct protocol_t *)self, 78 | aSel, YES, YES, YES)); 79 | #endif 80 | } 81 | 82 | - (struct objc_method_description *) descriptionForClassMethod:(SEL)aSel 83 | { 84 | #if !__OBJC2__ 85 | return lookup_protocol_method((struct old_protocol *)self, aSel, 86 | YES/*required*/, NO/*instance*/, 87 | YES/*recursive*/); 88 | #else 89 | return method_getDescription(protocol_getMethod((struct protocol_t *)self, 90 | aSel, YES, NO, YES)); 91 | #endif 92 | } 93 | 94 | - (const char *)name 95 | { 96 | return protocol_getName(self); 97 | } 98 | 99 | - (BOOL)isEqual:other 100 | { 101 | #if __OBJC2__ 102 | // check isKindOf: 103 | Class cls; 104 | Class protoClass = objc_getClass("Protocol"); 105 | for (cls = object_getClass(other); cls; cls = cls->superclass) { 106 | if (cls == protoClass) break; 107 | } 108 | if (!cls) return NO; 109 | // check equality 110 | return protocol_isEqual(self, other); 111 | #else 112 | return [other isKindOf:[Protocol class]] && [self conformsTo: other] && [other conformsTo: self]; 113 | #endif 114 | } 115 | 116 | #if __OBJC2__ 117 | - (NSUInteger)hash 118 | { 119 | return 23; 120 | } 121 | #else 122 | - (unsigned)hash 123 | { 124 | return 23; 125 | } 126 | #endif 127 | 128 | @end 129 | -------------------------------------------------------------------------------- /objc4-750/runtime/arm64-asm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @APPLE_LICENSE_HEADER_START@ 3 | * 4 | * Copyright (c) 2018 Apple Inc. All Rights Reserved. 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 | * 25 | * arm64-asm.h - asm tools for arm64/arm64_32 and ROP/JOP 26 | * 27 | ********************************************************************/ 28 | 29 | #if __arm64__ 30 | 31 | #if __LP64__ 32 | // true arm64 33 | 34 | #define SUPPORT_TAGGED_POINTERS 1 35 | #define PTR .quad 36 | #define PTRSIZE 8 37 | #define PTRSHIFT 3 // 1< 2 | 3 | -------------------------------------------------------------------------------- /objc4-750/runtime/isa.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @APPLE_LICENSE_HEADER_START@ 3 | * 4 | * Copyright (c) 2018 Apple Inc. All Rights Reserved. 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 | * 25 | * isa.h - Definitions of isa fields for C and assembly code. 26 | * 27 | ********************************************************************/ 28 | 29 | #ifndef _OBJC_ISA_H_ 30 | #define _OBJC_ISA_H_ 31 | 32 | #include "objc-config.h" 33 | 34 | 35 | #if (!SUPPORT_NONPOINTER_ISA && !SUPPORT_PACKED_ISA && !SUPPORT_INDEXED_ISA) ||\ 36 | ( SUPPORT_NONPOINTER_ISA && SUPPORT_PACKED_ISA && !SUPPORT_INDEXED_ISA) ||\ 37 | ( SUPPORT_NONPOINTER_ISA && !SUPPORT_PACKED_ISA && SUPPORT_INDEXED_ISA) 38 | // good config 39 | #else 40 | # error bad config 41 | #endif 42 | 43 | 44 | #if SUPPORT_PACKED_ISA 45 | 46 | // extra_rc must be the MSB-most field (so it matches carry/overflow flags) 47 | // nonpointer must be the LSB (fixme or get rid of it) 48 | // shiftcls must occupy the same bits that a real class pointer would 49 | // bits + RC_ONE is equivalent to extra_rc + 1 50 | // RC_HALF is the high bit of extra_rc (i.e. half of its range) 51 | 52 | // future expansion: 53 | // uintptr_t fast_rr : 1; // no r/r overrides 54 | // uintptr_t lock : 2; // lock for atomic property, @synch 55 | // uintptr_t extraBytes : 1; // allocated with extra bytes 56 | 57 | # if __arm64__ 58 | # define ISA_MASK 0x0000000ffffffff8ULL 59 | # define ISA_MAGIC_MASK 0x000003f000000001ULL 60 | # define ISA_MAGIC_VALUE 0x000001a000000001ULL 61 | # define ISA_BITFIELD \ 62 | uintptr_t nonpointer : 1; \ 63 | uintptr_t has_assoc : 1; \ 64 | uintptr_t has_cxx_dtor : 1; \ 65 | uintptr_t shiftcls : 33; /*MACH_VM_MAX_ADDRESS 0x1000000000*/ \ 66 | uintptr_t magic : 6; \ 67 | uintptr_t weakly_referenced : 1; \ 68 | uintptr_t deallocating : 1; \ 69 | uintptr_t has_sidetable_rc : 1; \ 70 | uintptr_t extra_rc : 19 71 | # define RC_ONE (1ULL<<45) 72 | # define RC_HALF (1ULL<<18) 73 | 74 | # elif __x86_64__ 75 | # define ISA_MASK 0x00007ffffffffff8ULL 76 | # define ISA_MAGIC_MASK 0x001f800000000001ULL 77 | # define ISA_MAGIC_VALUE 0x001d800000000001ULL 78 | # define ISA_BITFIELD \ 79 | uintptr_t nonpointer : 1; \ 80 | uintptr_t has_assoc : 1; \ 81 | uintptr_t has_cxx_dtor : 1; \ 82 | uintptr_t shiftcls : 44; /*MACH_VM_MAX_ADDRESS 0x7fffffe00000*/ \ 83 | uintptr_t magic : 6; \ 84 | uintptr_t weakly_referenced : 1; \ 85 | uintptr_t deallocating : 1; \ 86 | uintptr_t has_sidetable_rc : 1; \ 87 | uintptr_t extra_rc : 8 88 | # define RC_ONE (1ULL<<56) 89 | # define RC_HALF (1ULL<<7) 90 | 91 | # else 92 | # error unknown architecture for packed isa 93 | # endif 94 | 95 | // SUPPORT_PACKED_ISA 96 | #endif 97 | 98 | 99 | #if SUPPORT_INDEXED_ISA 100 | 101 | # if __ARM_ARCH_7K__ >= 2 || (__arm64__ && !__LP64__) 102 | // armv7k or arm64_32 103 | 104 | # define ISA_INDEX_IS_NPI_BIT 0 105 | # define ISA_INDEX_IS_NPI_MASK 0x00000001 106 | # define ISA_INDEX_MASK 0x0001FFFC 107 | # define ISA_INDEX_SHIFT 2 108 | # define ISA_INDEX_BITS 15 109 | # define ISA_INDEX_COUNT (1 << ISA_INDEX_BITS) 110 | # define ISA_INDEX_MAGIC_MASK 0x001E0001 111 | # define ISA_INDEX_MAGIC_VALUE 0x001C0001 112 | # define ISA_BITFIELD \ 113 | uintptr_t nonpointer : 1; \ 114 | uintptr_t has_assoc : 1; \ 115 | uintptr_t indexcls : 15; \ 116 | uintptr_t magic : 4; \ 117 | uintptr_t has_cxx_dtor : 1; \ 118 | uintptr_t weakly_referenced : 1; \ 119 | uintptr_t deallocating : 1; \ 120 | uintptr_t has_sidetable_rc : 1; \ 121 | uintptr_t extra_rc : 7 122 | # define RC_ONE (1ULL<<25) 123 | # define RC_HALF (1ULL<<6) 124 | 125 | # else 126 | # error unknown architecture for indexed isa 127 | # endif 128 | 129 | // SUPPORT_INDEXED_ISA 130 | #endif 131 | 132 | 133 | // _OBJC_ISA_H_ 134 | #endif 135 | -------------------------------------------------------------------------------- /objc4-750/runtime/llvm-AlignOf.h: -------------------------------------------------------------------------------- 1 | //===--- AlignOf.h - Portable calculation of type alignment -----*- C++ -*-===// 2 | // 3 | // The LLVM Compiler Infrastructure 4 | // 5 | // This file is distributed under the University of Illinois Open Source 6 | // License. See LICENSE.TXT for details. 7 | // 8 | //===----------------------------------------------------------------------===// 9 | // 10 | // This file defines the AlignOf function that computes alignments for 11 | // arbitrary types. 12 | // 13 | //===----------------------------------------------------------------------===// 14 | 15 | // Taken from llvmCore-3425.0.31. 16 | 17 | #ifndef LLVM_SUPPORT_ALIGNOF_H 18 | #define LLVM_SUPPORT_ALIGNOF_H 19 | 20 | #include 21 | 22 | namespace objc { 23 | 24 | template 25 | struct AlignmentCalcImpl { 26 | char x; 27 | T t; 28 | private: 29 | AlignmentCalcImpl() {} // Never instantiate. 30 | }; 31 | 32 | /// AlignOf - A templated class that contains an enum value representing 33 | /// the alignment of the template argument. For example, 34 | /// AlignOf::Alignment represents the alignment of type "int". The 35 | /// alignment calculated is the minimum alignment, and not necessarily 36 | /// the "desired" alignment returned by GCC's __alignof__ (for example). Note 37 | /// that because the alignment is an enum value, it can be used as a 38 | /// compile-time constant (e.g., for template instantiation). 39 | template 40 | struct AlignOf { 41 | enum { Alignment = 42 | static_cast(sizeof(AlignmentCalcImpl) - sizeof(T)) }; 43 | 44 | enum { Alignment_GreaterEqual_2Bytes = Alignment >= 2 ? 1 : 0 }; 45 | enum { Alignment_GreaterEqual_4Bytes = Alignment >= 4 ? 1 : 0 }; 46 | enum { Alignment_GreaterEqual_8Bytes = Alignment >= 8 ? 1 : 0 }; 47 | enum { Alignment_GreaterEqual_16Bytes = Alignment >= 16 ? 1 : 0 }; 48 | 49 | enum { Alignment_LessEqual_2Bytes = Alignment <= 2 ? 1 : 0 }; 50 | enum { Alignment_LessEqual_4Bytes = Alignment <= 4 ? 1 : 0 }; 51 | enum { Alignment_LessEqual_8Bytes = Alignment <= 8 ? 1 : 0 }; 52 | enum { Alignment_LessEqual_16Bytes = Alignment <= 16 ? 1 : 0 }; 53 | 54 | }; 55 | 56 | /// alignOf - A templated function that returns the minimum alignment of 57 | /// of a type. This provides no extra functionality beyond the AlignOf 58 | /// class besides some cosmetic cleanliness. Example usage: 59 | /// alignOf() returns the alignment of an int. 60 | template 61 | inline unsigned alignOf() { return AlignOf::Alignment; } 62 | 63 | 64 | /// \brief Helper for building an aligned character array type. 65 | /// 66 | /// This template is used to explicitly build up a collection of aligned 67 | /// character types. We have to build these up using a macro and explicit 68 | /// specialization to cope with old versions of MSVC and GCC where only an 69 | /// integer literal can be used to specify an alignment constraint. Once built 70 | /// up here, we can then begin to indirect between these using normal C++ 71 | /// template parameters. 72 | template struct AlignedCharArrayImpl; 73 | 74 | // MSVC requires special handling here. 75 | #ifndef _MSC_VER 76 | 77 | #if __has_feature(cxx_alignas) 78 | #define LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \ 79 | template <> struct AlignedCharArrayImpl { \ 80 | char aligned alignas(x); \ 81 | } 82 | #elif defined(__GNUC__) 83 | #define LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \ 84 | template <> struct AlignedCharArrayImpl { \ 85 | char aligned __attribute__((aligned(x))); \ 86 | } 87 | #else 88 | # error No supported align as directive. 89 | #endif 90 | 91 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(1); 92 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(2); 93 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(4); 94 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(8); 95 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(16); 96 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(32); 97 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(64); 98 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(128); 99 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(512); 100 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(1024); 101 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(2048); 102 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(4096); 103 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(8192); 104 | 105 | #undef LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT 106 | 107 | #else // _MSC_VER 108 | 109 | // We provide special variations of this template for the most common 110 | // alignments because __declspec(align(...)) doesn't actually work when it is 111 | // a member of a by-value function argument in MSVC, even if the alignment 112 | // request is something reasonably like 8-byte or 16-byte. 113 | template <> struct AlignedCharArrayImpl<1> { char aligned; }; 114 | template <> struct AlignedCharArrayImpl<2> { short aligned; }; 115 | template <> struct AlignedCharArrayImpl<4> { int aligned; }; 116 | template <> struct AlignedCharArrayImpl<8> { double aligned; }; 117 | 118 | #define LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \ 119 | template <> struct AlignedCharArrayImpl { \ 120 | __declspec(align(x)) char aligned; \ 121 | } 122 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(16); 123 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(32); 124 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(64); 125 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(128); 126 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(512); 127 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(1024); 128 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(2048); 129 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(4096); 130 | LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(8192); 131 | // Any larger and MSVC complains. 132 | #undef LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT 133 | 134 | #endif // _MSC_VER 135 | 136 | /// \brief This union template exposes a suitably aligned and sized character 137 | /// array member which can hold elements of any of up to four types. 138 | /// 139 | /// These types may be arrays, structs, or any other types. The goal is to 140 | /// produce a union type containing a character array which, when used, forms 141 | /// storage suitable to placement new any of these types over. Support for more 142 | /// than four types can be added at the cost of more boiler plate. 143 | template 145 | union AlignedCharArrayUnion { 146 | private: 147 | class AlignerImpl { 148 | T1 t1; T2 t2; T3 t3; T4 t4; 149 | 150 | AlignerImpl(); // Never defined or instantiated. 151 | }; 152 | union SizerImpl { 153 | char arr1[sizeof(T1)], arr2[sizeof(T2)], arr3[sizeof(T3)], arr4[sizeof(T4)]; 154 | }; 155 | 156 | public: 157 | /// \brief The character array buffer for use by clients. 158 | /// 159 | /// No other member of this union should be referenced. The exist purely to 160 | /// constrain the layout of this character array. 161 | char buffer[sizeof(SizerImpl)]; 162 | 163 | private: 164 | // Tests seem to indicate that both Clang and GCC will properly register the 165 | // alignment of a struct containing an aligned member, and this alignment 166 | // should carry over to the character array in the union. 167 | AlignedCharArrayImpl::Alignment> nonce_member; 168 | }; 169 | 170 | } // end namespace objc 171 | #endif 172 | -------------------------------------------------------------------------------- /objc4-750/runtime/llvm-DenseMapInfo.h: -------------------------------------------------------------------------------- 1 | //===- llvm/ADT/DenseMapInfo.h - Type traits for DenseMap -------*- C++ -*-===// 2 | // 3 | // The LLVM Compiler Infrastructure 4 | // 5 | // This file is distributed under the University of Illinois Open Source 6 | // License. See LICENSE.TXT for details. 7 | // 8 | //===----------------------------------------------------------------------===// 9 | // 10 | // This file defines DenseMapInfo traits for DenseMap. 11 | // 12 | //===----------------------------------------------------------------------===// 13 | 14 | // Taken from llvmCore-3425.0.31. 15 | 16 | #ifndef LLVM_ADT_DENSEMAPINFO_H 17 | #define LLVM_ADT_DENSEMAPINFO_H 18 | 19 | #include "objc-private.h" 20 | #include "llvm-type_traits.h" 21 | 22 | namespace objc { 23 | 24 | template 25 | struct DenseMapInfo { 26 | //static inline T getEmptyKey(); 27 | //static inline T getTombstoneKey(); 28 | //static unsigned getHashValue(const T &Val); 29 | //static bool isEqual(const T &LHS, const T &RHS); 30 | }; 31 | 32 | // Provide DenseMapInfo for all pointers. 33 | template 34 | struct DenseMapInfo { 35 | static inline T* getEmptyKey() { 36 | uintptr_t Val = static_cast(-1); 37 | return reinterpret_cast(Val); 38 | } 39 | static inline T* getTombstoneKey() { 40 | uintptr_t Val = static_cast(-2); 41 | return reinterpret_cast(Val); 42 | } 43 | static unsigned getHashValue(const T *PtrVal) { 44 | return ptr_hash((uintptr_t)PtrVal); 45 | } 46 | static bool isEqual(const T *LHS, const T *RHS) { return LHS == RHS; } 47 | }; 48 | 49 | // Provide DenseMapInfo for disguised pointers. 50 | template 51 | struct DenseMapInfo> { 52 | static inline DisguisedPtr getEmptyKey() { 53 | return DisguisedPtr((T*)(uintptr_t)-1); 54 | } 55 | static inline DisguisedPtr getTombstoneKey() { 56 | return DisguisedPtr((T*)(uintptr_t)-2); 57 | } 58 | static unsigned getHashValue(const T *PtrVal) { 59 | return ptr_hash((uintptr_t)PtrVal); 60 | } 61 | static bool isEqual(const DisguisedPtr &LHS, const DisguisedPtr &RHS) { 62 | return LHS == RHS; 63 | } 64 | }; 65 | 66 | // Provide DenseMapInfo for cstrings. 67 | template<> struct DenseMapInfo { 68 | static inline const char* getEmptyKey() { 69 | return reinterpret_cast((intptr_t)-1); 70 | } 71 | static inline const char* getTombstoneKey() { 72 | return reinterpret_cast((intptr_t)-2); 73 | } 74 | static unsigned getHashValue(const char* const &Val) { 75 | return _objc_strhash(Val); 76 | } 77 | static bool isEqual(const char* const &LHS, const char* const &RHS) { 78 | return 0 == strcmp(LHS, RHS); 79 | } 80 | }; 81 | 82 | // Provide DenseMapInfo for chars. 83 | template<> struct DenseMapInfo { 84 | static inline char getEmptyKey() { return ~0; } 85 | static inline char getTombstoneKey() { return ~0 - 1; } 86 | static unsigned getHashValue(const char& Val) { return Val * 37U; } 87 | static bool isEqual(const char &LHS, const char &RHS) { 88 | return LHS == RHS; 89 | } 90 | }; 91 | 92 | // Provide DenseMapInfo for unsigned ints. 93 | template<> struct DenseMapInfo { 94 | static inline unsigned getEmptyKey() { return ~0U; } 95 | static inline unsigned getTombstoneKey() { return ~0U - 1; } 96 | static unsigned getHashValue(const unsigned& Val) { return Val * 37U; } 97 | static bool isEqual(const unsigned& LHS, const unsigned& RHS) { 98 | return LHS == RHS; 99 | } 100 | }; 101 | 102 | // Provide DenseMapInfo for unsigned longs. 103 | template<> struct DenseMapInfo { 104 | static inline unsigned long getEmptyKey() { return ~0UL; } 105 | static inline unsigned long getTombstoneKey() { return ~0UL - 1L; } 106 | static unsigned getHashValue(const unsigned long& Val) { 107 | return (unsigned)(Val * 37UL); 108 | } 109 | static bool isEqual(const unsigned long& LHS, const unsigned long& RHS) { 110 | return LHS == RHS; 111 | } 112 | }; 113 | 114 | // Provide DenseMapInfo for unsigned long longs. 115 | template<> struct DenseMapInfo { 116 | static inline unsigned long long getEmptyKey() { return ~0ULL; } 117 | static inline unsigned long long getTombstoneKey() { return ~0ULL - 1ULL; } 118 | static unsigned getHashValue(const unsigned long long& Val) { 119 | return (unsigned)(Val * 37ULL); 120 | } 121 | static bool isEqual(const unsigned long long& LHS, 122 | const unsigned long long& RHS) { 123 | return LHS == RHS; 124 | } 125 | }; 126 | 127 | // Provide DenseMapInfo for ints. 128 | template<> struct DenseMapInfo { 129 | static inline int getEmptyKey() { return 0x7fffffff; } 130 | static inline int getTombstoneKey() { return -0x7fffffff - 1; } 131 | static unsigned getHashValue(const int& Val) { return (unsigned)(Val * 37U); } 132 | static bool isEqual(const int& LHS, const int& RHS) { 133 | return LHS == RHS; 134 | } 135 | }; 136 | 137 | // Provide DenseMapInfo for longs. 138 | template<> struct DenseMapInfo { 139 | static inline long getEmptyKey() { 140 | return (1UL << (sizeof(long) * 8 - 1)) - 1UL; 141 | } 142 | static inline long getTombstoneKey() { return getEmptyKey() - 1L; } 143 | static unsigned getHashValue(const long& Val) { 144 | return (unsigned)(Val * 37UL); 145 | } 146 | static bool isEqual(const long& LHS, const long& RHS) { 147 | return LHS == RHS; 148 | } 149 | }; 150 | 151 | // Provide DenseMapInfo for long longs. 152 | template<> struct DenseMapInfo { 153 | static inline long long getEmptyKey() { return 0x7fffffffffffffffLL; } 154 | static inline long long getTombstoneKey() { return -0x7fffffffffffffffLL-1; } 155 | static unsigned getHashValue(const long long& Val) { 156 | return (unsigned)(Val * 37ULL); 157 | } 158 | static bool isEqual(const long long& LHS, 159 | const long long& RHS) { 160 | return LHS == RHS; 161 | } 162 | }; 163 | 164 | // Provide DenseMapInfo for all pairs whose members have info. 165 | template 166 | struct DenseMapInfo > { 167 | typedef std::pair Pair; 168 | typedef DenseMapInfo FirstInfo; 169 | typedef DenseMapInfo SecondInfo; 170 | 171 | static inline Pair getEmptyKey() { 172 | return std::make_pair(FirstInfo::getEmptyKey(), 173 | SecondInfo::getEmptyKey()); 174 | } 175 | static inline Pair getTombstoneKey() { 176 | return std::make_pair(FirstInfo::getTombstoneKey(), 177 | SecondInfo::getTombstoneKey()); 178 | } 179 | static unsigned getHashValue(const Pair& PairVal) { 180 | uint64_t key = (uint64_t)FirstInfo::getHashValue(PairVal.first) << 32 181 | | (uint64_t)SecondInfo::getHashValue(PairVal.second); 182 | key += ~(key << 32); 183 | key ^= (key >> 22); 184 | key += ~(key << 13); 185 | key ^= (key >> 8); 186 | key += (key << 3); 187 | key ^= (key >> 15); 188 | key += ~(key << 27); 189 | key ^= (key >> 31); 190 | return (unsigned)key; 191 | } 192 | static bool isEqual(const Pair &LHS, const Pair &RHS) { 193 | return FirstInfo::isEqual(LHS.first, RHS.first) && 194 | SecondInfo::isEqual(LHS.second, RHS.second); 195 | } 196 | }; 197 | 198 | } // end namespace objc 199 | 200 | #endif 201 | -------------------------------------------------------------------------------- /objc4-750/runtime/maptable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2003, 2006-2007 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 | /* maptable.h 24 | Scalable hash table of mappings. 25 | Bertrand, August 1990 26 | Copyright 1990-1996 NeXT Software, Inc. 27 | */ 28 | 29 | #ifndef _OBJC_MAPTABLE_H_ 30 | #define _OBJC_MAPTABLE_H_ 31 | 32 | #ifndef _OBJC_PRIVATE_H_ 33 | # define OBJC_MAP_AVAILABILITY \ 34 | __OSX_DEPRECATED(10.0, 10.1, "NXMapTable is deprecated") \ 35 | __IOS_UNAVAILABLE __TVOS_UNAVAILABLE \ 36 | __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE 37 | #else 38 | # define OBJC_MAP_AVAILABILITY 39 | #endif 40 | 41 | #include 42 | 43 | __BEGIN_DECLS 44 | 45 | /*************** Definitions ***************/ 46 | 47 | /* This module allows hashing of arbitrary associations [key -> value]. Keys and values must be pointers or integers, and client is responsible for allocating/deallocating this data. A deallocation call-back is provided. 48 | NX_MAPNOTAKEY (-1) is used internally as a marker, and therefore keys must always be different from -1. 49 | As well-behaved scalable data structures, hash tables double in size when they start becoming full, thus guaranteeing both average constant time access and linear size. */ 50 | 51 | typedef struct _NXMapTable { 52 | /* private data structure; may change */ 53 | const struct _NXMapTablePrototype * _Nonnull prototype; 54 | unsigned count; 55 | unsigned nbBucketsMinusOne; 56 | void * _Nullable buckets; 57 | } NXMapTable OBJC_MAP_AVAILABILITY; 58 | 59 | typedef struct _NXMapTablePrototype { 60 | unsigned (* _Nonnull hash)(NXMapTable * _Nonnull, 61 | const void * _Nullable key); 62 | int (* _Nonnull isEqual)(NXMapTable * _Nonnull, 63 | const void * _Nullable key1, 64 | const void * _Nullable key2); 65 | void (* _Nonnull free)(NXMapTable * _Nonnull, 66 | void * _Nullable key, 67 | void * _Nullable value); 68 | int style; /* reserved for future expansion; currently 0 */ 69 | } NXMapTablePrototype OBJC_MAP_AVAILABILITY; 70 | 71 | /* invariants assumed by the implementation: 72 | A - key != -1 73 | B - key1 == key2 => hash(key1) == hash(key2) 74 | when key varies over time, hash(key) must remain invariant 75 | e.g. if string key, the string must not be changed 76 | C - isEqual(key1, key2) => key1 == key2 77 | */ 78 | 79 | #define NX_MAPNOTAKEY ((void * _Nonnull)(-1)) 80 | 81 | /*************** Functions ***************/ 82 | 83 | OBJC_EXPORT NXMapTable * _Nonnull 84 | NXCreateMapTableFromZone(NXMapTablePrototype prototype, 85 | unsigned capacity, void * _Nullable z) 86 | OBJC_MAP_AVAILABILITY; 87 | 88 | OBJC_EXPORT NXMapTable * _Nonnull 89 | NXCreateMapTable(NXMapTablePrototype prototype, unsigned capacity) 90 | OBJC_MAP_AVAILABILITY; 91 | /* capacity is only a hint; 0 creates a small table */ 92 | 93 | OBJC_EXPORT void 94 | NXFreeMapTable(NXMapTable * _Nonnull table) 95 | OBJC_MAP_AVAILABILITY; 96 | /* call free for each pair, and recovers table */ 97 | 98 | OBJC_EXPORT void 99 | NXResetMapTable(NXMapTable * _Nonnull table) 100 | OBJC_MAP_AVAILABILITY; 101 | /* free each pair; keep current capacity */ 102 | 103 | OBJC_EXPORT BOOL 104 | NXCompareMapTables(NXMapTable * _Nonnull table1, NXMapTable * _Nonnull table2) 105 | OBJC_MAP_AVAILABILITY; 106 | /* Returns YES if the two sets are equal (each member of table1 in table2, and table have same size) */ 107 | 108 | OBJC_EXPORT unsigned 109 | NXCountMapTable(NXMapTable * _Nonnull table) 110 | OBJC_MAP_AVAILABILITY; 111 | /* current number of data in table */ 112 | 113 | OBJC_EXPORT void * _Nullable 114 | NXMapMember(NXMapTable * _Nonnull table, const void * _Nullable key, 115 | void * _Nullable * _Nonnull value) OBJC_MAP_AVAILABILITY; 116 | /* return original table key or NX_MAPNOTAKEY. If key is found, value is set */ 117 | 118 | OBJC_EXPORT void * _Nullable 119 | NXMapGet(NXMapTable * _Nonnull table, const void * _Nullable key) 120 | OBJC_MAP_AVAILABILITY; 121 | /* return original corresponding value or NULL. When NULL need be stored as value, NXMapMember can be used to test for presence */ 122 | 123 | OBJC_EXPORT void * _Nullable 124 | NXMapInsert(NXMapTable * _Nonnull table, const void * _Nullable key, 125 | const void * _Nullable value) 126 | OBJC_MAP_AVAILABILITY; 127 | /* override preexisting pair; Return previous value or NULL. */ 128 | 129 | OBJC_EXPORT void * _Nullable 130 | NXMapRemove(NXMapTable * _Nonnull table, const void * _Nullable key) 131 | OBJC_MAP_AVAILABILITY; 132 | /* previous value or NULL is returned */ 133 | 134 | /* Iteration over all elements of a table consists in setting up an iteration state and then to progress until all entries have been visited. An example of use for counting elements in a table is: 135 | unsigned count = 0; 136 | const MyKey *key; 137 | const MyValue *value; 138 | NXMapState state = NXInitMapState(table); 139 | while(NXNextMapState(table, &state, &key, &value)) { 140 | count++; 141 | } 142 | */ 143 | 144 | typedef struct {int index;} NXMapState OBJC_MAP_AVAILABILITY; 145 | /* callers should not rely on actual contents of the struct */ 146 | 147 | OBJC_EXPORT NXMapState 148 | NXInitMapState(NXMapTable * _Nonnull table) 149 | OBJC_MAP_AVAILABILITY; 150 | 151 | OBJC_EXPORT int 152 | NXNextMapState(NXMapTable * _Nonnull table, NXMapState * _Nonnull state, 153 | const void * _Nullable * _Nonnull key, 154 | const void * _Nullable * _Nonnull value) 155 | OBJC_MAP_AVAILABILITY; 156 | /* returns 0 when all elements have been visited */ 157 | 158 | /*************** Conveniences ***************/ 159 | 160 | OBJC_EXPORT const NXMapTablePrototype NXPtrValueMapPrototype 161 | OBJC_MAP_AVAILABILITY; 162 | /* hashing is pointer/integer hashing; 163 | isEqual is identity; 164 | free is no-op. */ 165 | OBJC_EXPORT const NXMapTablePrototype NXStrValueMapPrototype 166 | OBJC_MAP_AVAILABILITY; 167 | /* hashing is string hashing; 168 | isEqual is strcmp; 169 | free is no-op. */ 170 | OBJC_EXPORT const NXMapTablePrototype NXObjectMapPrototype 171 | OBJC2_UNAVAILABLE; 172 | /* for objects; uses methods: hash, isEqual:, free, all for key. */ 173 | 174 | __END_DECLS 175 | 176 | #endif /* _OBJC_MAPTABLE_H_ */ 177 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-accessors.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-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 25 | #include 26 | 27 | #include 28 | 29 | #include "objc-private.h" 30 | #include "runtime.h" 31 | 32 | // stub interface declarations to make compiler happy. 33 | 34 | @interface __NSCopyable 35 | - (id)copyWithZone:(void *)zone; 36 | @end 37 | 38 | @interface __NSMutableCopyable 39 | - (id)mutableCopyWithZone:(void *)zone; 40 | @end 41 | 42 | StripedMap PropertyLocks; 43 | StripedMap StructLocks; 44 | StripedMap CppObjectLocks; 45 | 46 | #define MUTABLE_COPY 2 47 | 48 | id objc_getProperty(id self, SEL _cmd, ptrdiff_t offset, BOOL atomic) { 49 | if (offset == 0) { 50 | return object_getClass(self); 51 | } 52 | 53 | // Retain release world 54 | id *slot = (id*) ((char*)self + offset); 55 | if (!atomic) return *slot; 56 | 57 | // Atomic retain release world 58 | spinlock_t& slotlock = PropertyLocks[slot]; 59 | slotlock.lock(); 60 | id value = objc_retain(*slot); 61 | slotlock.unlock(); 62 | 63 | // for performance, we (safely) issue the autorelease OUTSIDE of the spinlock. 64 | return objc_autoreleaseReturnValue(value); 65 | } 66 | 67 | 68 | static inline void reallySetProperty(id self, SEL _cmd, id newValue, ptrdiff_t offset, bool atomic, bool copy, bool mutableCopy) __attribute__((always_inline)); 69 | 70 | static inline void reallySetProperty(id self, SEL _cmd, id newValue, ptrdiff_t offset, bool atomic, bool copy, bool mutableCopy) 71 | { 72 | if (offset == 0) { 73 | object_setClass(self, newValue); 74 | return; 75 | } 76 | 77 | id oldValue; 78 | id *slot = (id*) ((char*)self + offset); 79 | 80 | if (copy) { 81 | newValue = [newValue copyWithZone:nil]; 82 | } else if (mutableCopy) { 83 | newValue = [newValue mutableCopyWithZone:nil]; 84 | } else { 85 | if (*slot == newValue) return; 86 | newValue = objc_retain(newValue); 87 | } 88 | 89 | if (!atomic) { 90 | oldValue = *slot; 91 | *slot = newValue; 92 | } else { 93 | spinlock_t& slotlock = PropertyLocks[slot]; 94 | slotlock.lock(); 95 | oldValue = *slot; 96 | *slot = newValue; 97 | slotlock.unlock(); 98 | } 99 | 100 | objc_release(oldValue); 101 | } 102 | 103 | void objc_setProperty(id self, SEL _cmd, ptrdiff_t offset, id newValue, BOOL atomic, signed char shouldCopy) 104 | { 105 | bool copy = (shouldCopy && shouldCopy != MUTABLE_COPY); 106 | bool mutableCopy = (shouldCopy == MUTABLE_COPY); 107 | reallySetProperty(self, _cmd, newValue, offset, atomic, copy, mutableCopy); 108 | } 109 | 110 | void objc_setProperty_atomic(id self, SEL _cmd, id newValue, ptrdiff_t offset) 111 | { 112 | reallySetProperty(self, _cmd, newValue, offset, true, false, false); 113 | } 114 | 115 | void objc_setProperty_nonatomic(id self, SEL _cmd, id newValue, ptrdiff_t offset) 116 | { 117 | reallySetProperty(self, _cmd, newValue, offset, false, false, false); 118 | } 119 | 120 | 121 | void objc_setProperty_atomic_copy(id self, SEL _cmd, id newValue, ptrdiff_t offset) 122 | { 123 | reallySetProperty(self, _cmd, newValue, offset, true, true, false); 124 | } 125 | 126 | void objc_setProperty_nonatomic_copy(id self, SEL _cmd, id newValue, ptrdiff_t offset) 127 | { 128 | reallySetProperty(self, _cmd, newValue, offset, false, true, false); 129 | } 130 | 131 | 132 | // This entry point was designed wrong. When used as a getter, src needs to be locked so that 133 | // if simultaneously used for a setter then there would be contention on src. 134 | // So we need two locks - one of which will be contended. 135 | void objc_copyStruct(void *dest, const void *src, ptrdiff_t size, BOOL atomic, BOOL hasStrong __unused) { 136 | spinlock_t *srcLock = nil; 137 | spinlock_t *dstLock = nil; 138 | if (atomic) { 139 | srcLock = &StructLocks[src]; 140 | dstLock = &StructLocks[dest]; 141 | spinlock_t::lockTwo(srcLock, dstLock); 142 | } 143 | 144 | memmove(dest, src, size); 145 | 146 | if (atomic) { 147 | spinlock_t::unlockTwo(srcLock, dstLock); 148 | } 149 | } 150 | 151 | void objc_copyCppObjectAtomic(void *dest, const void *src, void (*copyHelper) (void *dest, const void *source)) { 152 | spinlock_t *srcLock = &CppObjectLocks[src]; 153 | spinlock_t *dstLock = &CppObjectLocks[dest]; 154 | spinlock_t::lockTwo(srcLock, dstLock); 155 | 156 | // let C++ code perform the actual copy. 157 | copyHelper(dest, src); 158 | 159 | spinlock_t::unlockTwo(srcLock, dstLock); 160 | } 161 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-auto.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2007 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 | #define OBJC_DECLARE_SYMBOLS 1 25 | #include "objc-private.h" 26 | #include "objc-auto.h" 27 | 28 | // GC is no longer supported. 29 | 30 | #if OBJC_NO_GC_API 31 | 32 | // No GC and no GC symbols needed. We're done here. 33 | # if SUPPORT_GC_COMPAT 34 | # error inconsistent config settings 35 | # endif 36 | 37 | #else 38 | 39 | // No GC but we do need to export GC symbols. 40 | 41 | # if !SUPPORT_GC_COMPAT 42 | # error inconsistent config settings 43 | # endif 44 | 45 | void objc_collect(unsigned long options __unused) { } 46 | BOOL objc_collectingEnabled(void) { return NO; } 47 | void objc_setCollectionThreshold(size_t threshold __unused) { } 48 | void objc_setCollectionRatio(size_t ratio __unused) { } 49 | void objc_startCollectorThread(void) { } 50 | 51 | #if TARGET_OS_WIN32 52 | BOOL objc_atomicCompareAndSwapPtr(id predicate, id replacement, volatile id *objectLocation) 53 | { void *original = InterlockedCompareExchangePointer((void * volatile *)objectLocation, (void *)replacement, (void *)predicate); return (original == predicate); } 54 | 55 | BOOL objc_atomicCompareAndSwapPtrBarrier(id predicate, id replacement, volatile id *objectLocation) 56 | { void *original = InterlockedCompareExchangePointer((void * volatile *)objectLocation, (void *)replacement, (void *)predicate); return (original == predicate); } 57 | #else 58 | BOOL objc_atomicCompareAndSwapPtr(id predicate, id replacement, volatile id *objectLocation) 59 | { return OSAtomicCompareAndSwapPtr((void *)predicate, (void *)replacement, (void * volatile *)objectLocation); } 60 | 61 | BOOL objc_atomicCompareAndSwapPtrBarrier(id predicate, id replacement, volatile id *objectLocation) 62 | { return OSAtomicCompareAndSwapPtrBarrier((void *)predicate, (void *)replacement, (void * volatile *)objectLocation); } 63 | #endif 64 | 65 | BOOL objc_atomicCompareAndSwapGlobal(id predicate, id replacement, volatile id *objectLocation) 66 | { return objc_atomicCompareAndSwapPtr(predicate, replacement, objectLocation); } 67 | 68 | BOOL objc_atomicCompareAndSwapGlobalBarrier(id predicate, id replacement, volatile id *objectLocation) 69 | { return objc_atomicCompareAndSwapPtrBarrier(predicate, replacement, objectLocation); } 70 | 71 | BOOL objc_atomicCompareAndSwapInstanceVariable(id predicate, id replacement, volatile id *objectLocation) 72 | { return objc_atomicCompareAndSwapPtr(predicate, replacement, objectLocation); } 73 | 74 | BOOL objc_atomicCompareAndSwapInstanceVariableBarrier(id predicate, id replacement, volatile id *objectLocation) 75 | { return objc_atomicCompareAndSwapPtrBarrier(predicate, replacement, objectLocation); } 76 | 77 | id objc_assign_strongCast(id val, id *dest) 78 | { return (*dest = val); } 79 | 80 | id objc_assign_global(id val, id *dest) 81 | { return (*dest = val); } 82 | 83 | id objc_assign_threadlocal(id val, id *dest) 84 | { return (*dest = val); } 85 | 86 | id objc_assign_ivar(id val, id dest, ptrdiff_t offset) 87 | { return (*(id*)((char *)dest+offset) = val); } 88 | 89 | id objc_read_weak(id *location) 90 | { return *location; } 91 | 92 | id objc_assign_weak(id value, id *location) 93 | { return (*location = value); } 94 | 95 | void *objc_memmove_collectable(void *dst, const void *src, size_t size) 96 | { return memmove(dst, src, size); } 97 | 98 | void objc_finalizeOnMainThread(Class cls __unused) { } 99 | BOOL objc_is_finalized(void *ptr __unused) { return NO; } 100 | void objc_clear_stack(unsigned long options __unused) { } 101 | 102 | BOOL objc_collecting_enabled(void) { return NO; } 103 | void objc_set_collection_threshold(size_t threshold __unused) { } 104 | void objc_set_collection_ratio(size_t ratio __unused) { } 105 | void objc_start_collector_thread(void) { } 106 | 107 | id objc_allocate_object(Class cls, int extra) 108 | { return class_createInstance(cls, extra); } 109 | 110 | void objc_registerThreadWithCollector() { } 111 | void objc_unregisterThreadWithCollector() { } 112 | void objc_assertRegisteredThreadWithCollector() { } 113 | 114 | malloc_zone_t* objc_collect_init(int(*callback)() __unused) { return nil; } 115 | malloc_zone_t* objc_collectableZone() { return nil; } 116 | 117 | BOOL objc_isAuto(id object __unused) { return NO; } 118 | BOOL objc_dumpHeap(char *filename __unused, unsigned long length __unused) 119 | { return NO; } 120 | 121 | // not OBJC_NO_GC_API 122 | #endif 123 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-block-trampolines.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 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 | 25 | #ifndef _OBJC_TRAMPOLINES_H 26 | #define _OBJC_TRAMPOLINES_H 27 | 28 | /* 29 | * WARNING DANGER HAZARD BEWARE EEK 30 | * 31 | * Everything in this file is for Apple Internal use only. 32 | * These will change in arbitrary OS updates and in unpredictable ways. 33 | * When your program breaks, you get to keep both pieces. 34 | */ 35 | 36 | /* 37 | * objc-block-trampolines.h: Symbols for IMP block trampolines 38 | */ 39 | 40 | #include 41 | 42 | OBJC_EXPORT const char _objc_blockTrampolineImpl 43 | OBJC_AVAILABLE(10.14, 12.0, 12.0, 5.0, 3.0); 44 | 45 | OBJC_EXPORT const char _objc_blockTrampolineStart 46 | OBJC_AVAILABLE(10.14, 12.0, 12.0, 5.0, 3.0); 47 | 48 | OBJC_EXPORT const char _objc_blockTrampolineLast 49 | OBJC_AVAILABLE(10.14, 12.0, 12.0, 5.0, 3.0); 50 | 51 | 52 | OBJC_EXPORT const char _objc_blockTrampolineImpl_stret 53 | OBJC_AVAILABLE(10.14, 12.0, 12.0, 5.0, 3.0) 54 | OBJC_ARM64_UNAVAILABLE; 55 | 56 | OBJC_EXPORT const char _objc_blockTrampolineStart_stret 57 | OBJC_AVAILABLE(10.14, 12.0, 12.0, 5.0, 3.0) 58 | OBJC_ARM64_UNAVAILABLE; 59 | 60 | OBJC_EXPORT const char _objc_blockTrampolineLast_stret 61 | OBJC_AVAILABLE(10.14, 12.0, 12.0, 5.0, 3.0) 62 | OBJC_ARM64_UNAVAILABLE; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-blocktramps-arm.s: -------------------------------------------------------------------------------- 1 | #if __arm__ 2 | 3 | #include 4 | #include 5 | 6 | .syntax unified 7 | 8 | .text 9 | .globl __objc_blockTrampolineImpl 10 | .globl __objc_blockTrampolineStart 11 | .globl __objc_blockTrampolineLast 12 | 13 | // Trampoline machinery assumes the trampolines are Thumb function pointers 14 | #if !__thumb2__ 15 | # error sorry 16 | #endif 17 | 18 | .thumb 19 | 20 | // Exported symbols are not marked as functions. 21 | // The trampoline construction code assumes that the Thumb bit is not set. 22 | .thumb_func L__objc_blockTrampolineImpl_func 23 | 24 | .align PAGE_MAX_SHIFT 25 | __objc_blockTrampolineImpl: 26 | L__objc_blockTrampolineImpl_func: 27 | /* 28 | r0 == self 29 | r12 == pc of trampoline's first instruction + PC bias 30 | lr == original return address 31 | */ 32 | 33 | mov r1, r0 // _cmd = self 34 | 35 | // Trampoline's data is one page before the trampoline text. 36 | // Also correct PC bias of 4 bytes. 37 | sub r12, # 2*PAGE_MAX_SIZE 38 | ldr r0, [r12, #-4] // self = block object 39 | ldr pc, [r0, #12] // tail call block->invoke 40 | // not reached 41 | 42 | // Align trampolines to 8 bytes 43 | .align 3 44 | 45 | .macro TrampolineEntry 46 | mov r12, pc 47 | b L__objc_blockTrampolineImpl_func 48 | .align 3 49 | .endmacro 50 | 51 | .macro TrampolineEntryX16 52 | TrampolineEntry 53 | TrampolineEntry 54 | TrampolineEntry 55 | TrampolineEntry 56 | 57 | TrampolineEntry 58 | TrampolineEntry 59 | TrampolineEntry 60 | TrampolineEntry 61 | 62 | TrampolineEntry 63 | TrampolineEntry 64 | TrampolineEntry 65 | TrampolineEntry 66 | 67 | TrampolineEntry 68 | TrampolineEntry 69 | TrampolineEntry 70 | TrampolineEntry 71 | .endmacro 72 | 73 | .macro TrampolineEntryX256 74 | TrampolineEntryX16 75 | TrampolineEntryX16 76 | TrampolineEntryX16 77 | TrampolineEntryX16 78 | 79 | TrampolineEntryX16 80 | TrampolineEntryX16 81 | TrampolineEntryX16 82 | TrampolineEntryX16 83 | 84 | TrampolineEntryX16 85 | TrampolineEntryX16 86 | TrampolineEntryX16 87 | TrampolineEntryX16 88 | 89 | TrampolineEntryX16 90 | TrampolineEntryX16 91 | TrampolineEntryX16 92 | TrampolineEntryX16 93 | .endmacro 94 | 95 | __objc_blockTrampolineStart: 96 | // 2048-2 trampolines to fill 16K page 97 | TrampolineEntryX256 98 | TrampolineEntryX256 99 | TrampolineEntryX256 100 | TrampolineEntryX256 101 | 102 | TrampolineEntryX256 103 | TrampolineEntryX256 104 | TrampolineEntryX256 105 | 106 | TrampolineEntryX16 107 | TrampolineEntryX16 108 | TrampolineEntryX16 109 | TrampolineEntryX16 110 | 111 | TrampolineEntryX16 112 | TrampolineEntryX16 113 | TrampolineEntryX16 114 | TrampolineEntryX16 115 | 116 | TrampolineEntryX16 117 | TrampolineEntryX16 118 | TrampolineEntryX16 119 | TrampolineEntryX16 120 | 121 | TrampolineEntryX16 122 | TrampolineEntryX16 123 | TrampolineEntryX16 124 | 125 | TrampolineEntry 126 | TrampolineEntry 127 | TrampolineEntry 128 | TrampolineEntry 129 | 130 | TrampolineEntry 131 | TrampolineEntry 132 | TrampolineEntry 133 | TrampolineEntry 134 | 135 | TrampolineEntry 136 | TrampolineEntry 137 | TrampolineEntry 138 | TrampolineEntry 139 | 140 | TrampolineEntry 141 | __objc_blockTrampolineLast: 142 | TrampolineEntry 143 | // TrampolineEntry 144 | // TrampolineEntry 145 | 146 | 147 | 148 | .text 149 | .globl __objc_blockTrampolineImpl_stret 150 | .globl __objc_blockTrampolineStart_stret 151 | .globl __objc_blockTrampolineLast_stret 152 | 153 | // Trampoline machinery assumes the trampolines are Thumb function pointers 154 | #if !__thumb2__ 155 | # error sorry 156 | #endif 157 | 158 | .thumb 159 | 160 | // Exported symbols are not marked as functions. 161 | // The trampoline construction code assumes that the Thumb bit is not set. 162 | .thumb_func L__objc_blockTrampolineImpl_stret_func 163 | 164 | .align PAGE_MAX_SHIFT 165 | __objc_blockTrampolineImpl_stret: 166 | L__objc_blockTrampolineImpl_stret_func: 167 | /* 168 | r1 == self 169 | r12 == pc of trampoline's first instruction + PC bias 170 | lr == original return address 171 | */ 172 | 173 | mov r2, r1 // _cmd = self 174 | 175 | // Trampoline's data is one page before the trampoline text. 176 | // Also correct PC bias of 4 bytes. 177 | sub r12, # 3*PAGE_MAX_SIZE 178 | ldr r1, [r12, #-4] // self = block object 179 | ldr pc, [r1, #12] // tail call block->invoke 180 | // not reached 181 | 182 | // Align trampolines to 8 bytes 183 | .align 3 184 | 185 | .macro TrampolineEntry_stret 186 | mov r12, pc 187 | b L__objc_blockTrampolineImpl_stret_func 188 | .align 3 189 | .endmacro 190 | 191 | .macro TrampolineEntryX16_stret 192 | TrampolineEntry_stret 193 | TrampolineEntry_stret 194 | TrampolineEntry_stret 195 | TrampolineEntry_stret 196 | 197 | TrampolineEntry_stret 198 | TrampolineEntry_stret 199 | TrampolineEntry_stret 200 | TrampolineEntry_stret 201 | 202 | TrampolineEntry_stret 203 | TrampolineEntry_stret 204 | TrampolineEntry_stret 205 | TrampolineEntry_stret 206 | 207 | TrampolineEntry_stret 208 | TrampolineEntry_stret 209 | TrampolineEntry_stret 210 | TrampolineEntry_stret 211 | .endmacro 212 | 213 | .macro TrampolineEntryX256_stret 214 | TrampolineEntryX16_stret 215 | TrampolineEntryX16_stret 216 | TrampolineEntryX16_stret 217 | TrampolineEntryX16_stret 218 | 219 | TrampolineEntryX16_stret 220 | TrampolineEntryX16_stret 221 | TrampolineEntryX16_stret 222 | TrampolineEntryX16_stret 223 | 224 | TrampolineEntryX16_stret 225 | TrampolineEntryX16_stret 226 | TrampolineEntryX16_stret 227 | TrampolineEntryX16_stret 228 | 229 | TrampolineEntryX16_stret 230 | TrampolineEntryX16_stret 231 | TrampolineEntryX16_stret 232 | TrampolineEntryX16_stret 233 | .endmacro 234 | 235 | __objc_blockTrampolineStart_stret: 236 | // 2048-2 trampolines to fill 16K page 237 | TrampolineEntryX256_stret 238 | TrampolineEntryX256_stret 239 | TrampolineEntryX256_stret 240 | TrampolineEntryX256_stret 241 | 242 | TrampolineEntryX256_stret 243 | TrampolineEntryX256_stret 244 | TrampolineEntryX256_stret 245 | 246 | TrampolineEntryX16_stret 247 | TrampolineEntryX16_stret 248 | TrampolineEntryX16_stret 249 | TrampolineEntryX16_stret 250 | 251 | TrampolineEntryX16_stret 252 | TrampolineEntryX16_stret 253 | TrampolineEntryX16_stret 254 | TrampolineEntryX16_stret 255 | 256 | TrampolineEntryX16_stret 257 | TrampolineEntryX16_stret 258 | TrampolineEntryX16_stret 259 | TrampolineEntryX16_stret 260 | 261 | TrampolineEntryX16_stret 262 | TrampolineEntryX16_stret 263 | TrampolineEntryX16_stret 264 | 265 | TrampolineEntry_stret 266 | TrampolineEntry_stret 267 | TrampolineEntry_stret 268 | TrampolineEntry_stret 269 | 270 | TrampolineEntry_stret 271 | TrampolineEntry_stret 272 | TrampolineEntry_stret 273 | TrampolineEntry_stret 274 | 275 | TrampolineEntry_stret 276 | TrampolineEntry_stret 277 | TrampolineEntry_stret 278 | TrampolineEntry_stret 279 | 280 | TrampolineEntry_stret 281 | __objc_blockTrampolineLast_stret: 282 | TrampolineEntry_stret 283 | // TrampolineEntry_stret 284 | // TrampolineEntry_stret 285 | 286 | #endif 287 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-blocktramps-arm64.s: -------------------------------------------------------------------------------- 1 | #if __arm64__ 2 | 3 | #include 4 | #include "arm64-asm.h" 5 | 6 | // Offset of block->invoke field. 7 | #if __LP64__ 8 | // true arm64 9 | # define BLOCK_INVOKE 16 10 | #else 11 | // arm64_32 12 | # define BLOCK_INVOKE 12 13 | #endif 14 | 15 | .text 16 | .globl __objc_blockTrampolineImpl 17 | .globl __objc_blockTrampolineStart 18 | .globl __objc_blockTrampolineLast 19 | 20 | .align PAGE_MAX_SHIFT 21 | __objc_blockTrampolineImpl: 22 | L_objc_blockTrampolineImpl: 23 | /* 24 | x0 == self 25 | x17 == address of called trampoline's data (2 pages before its code) 26 | lr == original return address 27 | */ 28 | 29 | mov x1, x0 // _cmd = self 30 | ldr p0, [x17] // self = block object 31 | add p15, p0, #BLOCK_INVOKE // x15 = &block->invoke 32 | ldr p16, [x15] // x16 = block->invoke 33 | TailCallBlockInvoke x16, x15 34 | 35 | // pad up to TrampolineBlockPagePair header size 36 | nop 37 | 38 | .macro TrampolineEntry 39 | // load address of trampoline data (two pages before this instruction) 40 | adr x17, -2*PAGE_MAX_SIZE 41 | b L_objc_blockTrampolineImpl 42 | .endmacro 43 | 44 | .macro TrampolineEntryX16 45 | TrampolineEntry 46 | TrampolineEntry 47 | TrampolineEntry 48 | TrampolineEntry 49 | 50 | TrampolineEntry 51 | TrampolineEntry 52 | TrampolineEntry 53 | TrampolineEntry 54 | 55 | TrampolineEntry 56 | TrampolineEntry 57 | TrampolineEntry 58 | TrampolineEntry 59 | 60 | TrampolineEntry 61 | TrampolineEntry 62 | TrampolineEntry 63 | TrampolineEntry 64 | .endmacro 65 | 66 | .macro TrampolineEntryX256 67 | TrampolineEntryX16 68 | TrampolineEntryX16 69 | TrampolineEntryX16 70 | TrampolineEntryX16 71 | 72 | TrampolineEntryX16 73 | TrampolineEntryX16 74 | TrampolineEntryX16 75 | TrampolineEntryX16 76 | 77 | TrampolineEntryX16 78 | TrampolineEntryX16 79 | TrampolineEntryX16 80 | TrampolineEntryX16 81 | 82 | TrampolineEntryX16 83 | TrampolineEntryX16 84 | TrampolineEntryX16 85 | TrampolineEntryX16 86 | .endmacro 87 | 88 | .align 3 89 | __objc_blockTrampolineStart: 90 | // 2048-3 trampolines to fill 16K page 91 | TrampolineEntryX256 92 | TrampolineEntryX256 93 | TrampolineEntryX256 94 | TrampolineEntryX256 95 | 96 | TrampolineEntryX256 97 | TrampolineEntryX256 98 | TrampolineEntryX256 99 | 100 | TrampolineEntryX16 101 | TrampolineEntryX16 102 | TrampolineEntryX16 103 | TrampolineEntryX16 104 | 105 | TrampolineEntryX16 106 | TrampolineEntryX16 107 | TrampolineEntryX16 108 | TrampolineEntryX16 109 | 110 | TrampolineEntryX16 111 | TrampolineEntryX16 112 | TrampolineEntryX16 113 | TrampolineEntryX16 114 | 115 | TrampolineEntryX16 116 | TrampolineEntryX16 117 | TrampolineEntryX16 118 | 119 | TrampolineEntry 120 | TrampolineEntry 121 | TrampolineEntry 122 | TrampolineEntry 123 | 124 | TrampolineEntry 125 | TrampolineEntry 126 | TrampolineEntry 127 | TrampolineEntry 128 | 129 | TrampolineEntry 130 | TrampolineEntry 131 | TrampolineEntry 132 | TrampolineEntry 133 | 134 | __objc_blockTrampolineLast: 135 | TrampolineEntry 136 | // TrampolineEntry 137 | // TrampolineEntry 138 | // TrampolineEntry 139 | 140 | #endif 141 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-cache-old.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 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_CACHE_OLD_H 25 | #define _OBJC_CACHE_OLD_H 26 | 27 | #include "objc-private.h" 28 | 29 | __BEGIN_DECLS 30 | 31 | extern IMP _cache_getImp(Class cls, SEL sel); 32 | extern Method _cache_getMethod(Class cls, SEL sel, IMP objc_msgForward_internal_imp); 33 | 34 | extern void flush_cache(Class cls); 35 | extern bool _cache_fill(Class cls, Method meth, SEL sel); 36 | extern void _cache_addForwardEntry(Class cls, SEL sel); 37 | extern IMP _cache_addIgnoredEntry(Class cls, SEL sel); 38 | extern void _cache_free(Cache cache); 39 | extern void _cache_collect(bool collectALot); 40 | 41 | __END_DECLS 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-cache.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _OBJC_CACHE_H 3 | #define _OBJC_CACHE_H 4 | 5 | #include "objc-private.h" 6 | 7 | __BEGIN_DECLS 8 | 9 | extern IMP cache_getImp(Class cls, SEL sel); 10 | 11 | extern void cache_fill(Class cls, SEL sel, IMP imp, id receiver); 12 | 13 | extern void cache_erase_nolock(Class cls); 14 | 15 | extern void cache_delete(Class cls); 16 | 17 | extern void cache_collect(bool collectALot); 18 | 19 | __END_DECLS 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-class.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | -------------------------------------------------------------------------------- /objc4-750/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 28 | 29 | // Define __OBJC2__ for the benefit of our asm files. 30 | #ifndef __OBJC2__ 31 | # if TARGET_OS_OSX && !TARGET_OS_IOSMAC && __i386__ 32 | // old ABI 33 | # else 34 | # define __OBJC2__ 1 35 | # endif 36 | #endif 37 | 38 | // Avoid the !NDEBUG double negative. 39 | #if !NDEBUG 40 | # define DEBUG 1 41 | #else 42 | # define DEBUG 0 43 | #endif 44 | 45 | // Define SUPPORT_GC_COMPAT=1 to enable compatibility where GC once was. 46 | // OBJC_NO_GC and OBJC_NO_GC_API in objc-api.h mean something else. 47 | #if !TARGET_OS_OSX 48 | # define SUPPORT_GC_COMPAT 0 49 | #else 50 | # define SUPPORT_GC_COMPAT 1 51 | #endif 52 | 53 | // Define SUPPORT_ZONES=1 to enable malloc zone support in NXHashTable. 54 | #if !(TARGET_OS_OSX || TARGET_OS_IOSMAC) 55 | # define SUPPORT_ZONES 0 56 | #else 57 | # define SUPPORT_ZONES 1 58 | #endif 59 | 60 | // Define SUPPORT_MOD=1 to use the mod operator in NXHashTable and objc-sel-set 61 | #if defined(__arm__) 62 | # define SUPPORT_MOD 0 63 | #else 64 | # define SUPPORT_MOD 1 65 | #endif 66 | 67 | // Define SUPPORT_PREOPT=1 to enable dyld shared cache optimizations 68 | #if TARGET_OS_WIN32 || TARGET_OS_SIMULATOR 69 | # define SUPPORT_PREOPT 0 70 | #else 71 | # define SUPPORT_PREOPT 1 72 | #endif 73 | 74 | // Define SUPPORT_TAGGED_POINTERS=1 to enable tagged pointer objects 75 | // Be sure to edit tagged pointer SPI in objc-internal.h as well. 76 | #if !(__OBJC2__ && __LP64__) 77 | # define SUPPORT_TAGGED_POINTERS 0 78 | #else 79 | # define SUPPORT_TAGGED_POINTERS 1 80 | #endif 81 | 82 | // Define SUPPORT_MSB_TAGGED_POINTERS to use the MSB 83 | // as the tagged pointer marker instead of the LSB. 84 | // Be sure to edit tagged pointer SPI in objc-internal.h as well. 85 | #if !SUPPORT_TAGGED_POINTERS || (TARGET_OS_OSX || TARGET_OS_IOSMAC) 86 | # define SUPPORT_MSB_TAGGED_POINTERS 0 87 | #else 88 | # define SUPPORT_MSB_TAGGED_POINTERS 1 89 | #endif 90 | 91 | // Define SUPPORT_INDEXED_ISA=1 on platforms that store the class in the isa 92 | // field as an index into a class table. 93 | // Note, keep this in sync with any .s files which also define it. 94 | // Be sure to edit objc-abi.h as well. 95 | #if __ARM_ARCH_7K__ >= 2 || (__arm64__ && !__LP64__) 96 | # define SUPPORT_INDEXED_ISA 1 97 | #else 98 | # define SUPPORT_INDEXED_ISA 0 99 | #endif 100 | 101 | // Define SUPPORT_PACKED_ISA=1 on platforms that store the class in the isa 102 | // field as a maskable pointer with other data around it. 103 | #if (!__LP64__ || TARGET_OS_WIN32 || \ 104 | (TARGET_OS_SIMULATOR && !TARGET_OS_IOSMAC)) 105 | # define SUPPORT_PACKED_ISA 0 106 | #else 107 | # define SUPPORT_PACKED_ISA 1 108 | #endif 109 | 110 | // Define SUPPORT_NONPOINTER_ISA=1 on any platform that may store something 111 | // in the isa field that is not a raw pointer. 112 | #if !SUPPORT_INDEXED_ISA && !SUPPORT_PACKED_ISA 113 | # define SUPPORT_NONPOINTER_ISA 0 114 | #else 115 | # define SUPPORT_NONPOINTER_ISA 1 116 | #endif 117 | 118 | // Define SUPPORT_FIXUP=1 to repair calls sites for fixup dispatch. 119 | // Fixup messaging itself is no longer supported. 120 | // Be sure to edit objc-abi.h as well (objc_msgSend*_fixup) 121 | #if !(defined(__x86_64__) && (TARGET_OS_OSX || TARGET_OS_SIMULATOR)) 122 | # define SUPPORT_FIXUP 0 123 | #else 124 | # define SUPPORT_FIXUP 1 125 | #endif 126 | 127 | // Define SUPPORT_ZEROCOST_EXCEPTIONS to use "zero-cost" exceptions for OBJC2. 128 | // Be sure to edit objc-exception.h as well (objc_add/removeExceptionHandler) 129 | #if !__OBJC2__ || (defined(__arm__) && __USING_SJLJ_EXCEPTIONS__) 130 | # define SUPPORT_ZEROCOST_EXCEPTIONS 0 131 | #else 132 | # define SUPPORT_ZEROCOST_EXCEPTIONS 1 133 | #endif 134 | 135 | // Define SUPPORT_ALT_HANDLERS if you're using zero-cost exceptions 136 | // but also need to support AppKit's alt-handler scheme 137 | // Be sure to edit objc-exception.h as well (objc_add/removeExceptionHandler) 138 | #if !SUPPORT_ZEROCOST_EXCEPTIONS || !TARGET_OS_OSX 139 | # define SUPPORT_ALT_HANDLERS 0 140 | #else 141 | # define SUPPORT_ALT_HANDLERS 1 142 | #endif 143 | 144 | // Define SUPPORT_RETURN_AUTORELEASE to optimize autoreleased return values 145 | #if TARGET_OS_WIN32 146 | # define SUPPORT_RETURN_AUTORELEASE 0 147 | #else 148 | # define SUPPORT_RETURN_AUTORELEASE 1 149 | #endif 150 | 151 | // Define SUPPORT_STRET on architectures that need separate struct-return ABI. 152 | #if defined(__arm64__) 153 | # define SUPPORT_STRET 0 154 | #else 155 | # define SUPPORT_STRET 1 156 | #endif 157 | 158 | // Define SUPPORT_MESSAGE_LOGGING to enable NSObjCMessageLoggingEnabled 159 | #if !TARGET_OS_OSX 160 | # define SUPPORT_MESSAGE_LOGGING 0 161 | #else 162 | # define SUPPORT_MESSAGE_LOGGING 1 163 | #endif 164 | 165 | // OBJC_INSTRUMENTED controls whether message dispatching is dynamically 166 | // monitored. Monitoring introduces substantial overhead. 167 | // NOTE: To define this condition, do so in the build command, NOT by 168 | // uncommenting the line here. This is because objc-class.h heeds this 169 | // condition, but objc-class.h can not #include this file (objc-config.h) 170 | // because objc-class.h is public and objc-config.h is not. 171 | //#define OBJC_INSTRUMENTED 172 | 173 | #endif 174 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-env.h: -------------------------------------------------------------------------------- 1 | // -*- truncate-lines: t; -*- 2 | 3 | // OPTION(var, env, help) 4 | 5 | OPTION( PrintImages, OBJC_PRINT_IMAGES, "log image and library names as they are loaded") 6 | OPTION( PrintImageTimes, OBJC_PRINT_IMAGE_TIMES, "measure duration of image loading steps") 7 | OPTION( PrintLoading, OBJC_PRINT_LOAD_METHODS, "log calls to class and category +load methods") 8 | OPTION( PrintInitializing, OBJC_PRINT_INITIALIZE_METHODS, "log calls to class +initialize methods") 9 | OPTION( PrintResolving, OBJC_PRINT_RESOLVED_METHODS, "log methods created by +resolveClassMethod: and +resolveInstanceMethod:") 10 | OPTION( PrintConnecting, OBJC_PRINT_CLASS_SETUP, "log progress of class and category setup") 11 | OPTION( PrintProtocols, OBJC_PRINT_PROTOCOL_SETUP, "log progress of protocol setup") 12 | OPTION( PrintIvars, OBJC_PRINT_IVAR_SETUP, "log processing of non-fragile ivars") 13 | OPTION( PrintVtables, OBJC_PRINT_VTABLE_SETUP, "log processing of class vtables") 14 | OPTION( PrintVtableImages, OBJC_PRINT_VTABLE_IMAGES, "print vtable images showing overridden methods") 15 | OPTION( PrintCaches, OBJC_PRINT_CACHE_SETUP, "log processing of method caches") 16 | OPTION( PrintFuture, OBJC_PRINT_FUTURE_CLASSES, "log use of future classes for toll-free bridging") 17 | OPTION( PrintPreopt, OBJC_PRINT_PREOPTIMIZATION, "log preoptimization courtesy of dyld shared cache") 18 | OPTION( PrintCxxCtors, OBJC_PRINT_CXX_CTORS, "log calls to C++ ctors and dtors for instance variables") 19 | OPTION( PrintExceptions, OBJC_PRINT_EXCEPTIONS, "log exception handling") 20 | OPTION( PrintExceptionThrow, OBJC_PRINT_EXCEPTION_THROW, "log backtrace of every objc_exception_throw()") 21 | OPTION( PrintAltHandlers, OBJC_PRINT_ALT_HANDLERS, "log processing of exception alt handlers") 22 | OPTION( PrintReplacedMethods, OBJC_PRINT_REPLACED_METHODS, "log methods replaced by category implementations") 23 | OPTION( PrintDeprecation, OBJC_PRINT_DEPRECATION_WARNINGS, "warn about calls to deprecated runtime functions") 24 | OPTION( PrintPoolHiwat, OBJC_PRINT_POOL_HIGHWATER, "log high-water marks for autorelease pools") 25 | OPTION( PrintCustomRR, OBJC_PRINT_CUSTOM_RR, "log classes with un-optimized custom retain/release methods") 26 | OPTION( PrintCustomAWZ, OBJC_PRINT_CUSTOM_AWZ, "log classes with un-optimized custom allocWithZone methods") 27 | OPTION( PrintRawIsa, OBJC_PRINT_RAW_ISA, "log classes that require raw pointer isa fields") 28 | 29 | OPTION( DebugUnload, OBJC_DEBUG_UNLOAD, "warn about poorly-behaving bundles when unloaded") 30 | OPTION( DebugFragileSuperclasses, OBJC_DEBUG_FRAGILE_SUPERCLASSES, "warn about subclasses that may have been broken by subsequent changes to superclasses") 31 | OPTION( DebugNilSync, OBJC_DEBUG_NIL_SYNC, "warn about @synchronized(nil), which does no synchronization") 32 | OPTION( DebugNonFragileIvars, OBJC_DEBUG_NONFRAGILE_IVARS, "capriciously rearrange non-fragile ivars") 33 | OPTION( DebugAltHandlers, OBJC_DEBUG_ALT_HANDLERS, "record more info about bad alt handler use") 34 | OPTION( DebugMissingPools, OBJC_DEBUG_MISSING_POOLS, "warn about autorelease with no pool in place, which may be a leak") 35 | OPTION( DebugPoolAllocation, OBJC_DEBUG_POOL_ALLOCATION, "halt when autorelease pools are popped out of order, and allow heap debuggers to track autorelease pools") 36 | OPTION( DebugDuplicateClasses, OBJC_DEBUG_DUPLICATE_CLASSES, "halt when multiple classes with the same name are present") 37 | OPTION( DebugDontCrash, OBJC_DEBUG_DONT_CRASH, "halt the process by exiting instead of crashing") 38 | 39 | OPTION( DisableVtables, OBJC_DISABLE_VTABLES, "disable vtable dispatch") 40 | OPTION( DisablePreopt, OBJC_DISABLE_PREOPTIMIZATION, "disable preoptimization courtesy of dyld shared cache") 41 | OPTION( DisableTaggedPointers, OBJC_DISABLE_TAGGED_POINTERS, "disable tagged pointer optimization of NSNumber et al.") 42 | OPTION( DisableTaggedPointerObfuscation, OBJC_DISABLE_TAG_OBFUSCATION, "disable obfuscation of tagged pointers") 43 | OPTION( DisableNonpointerIsa, OBJC_DISABLE_NONPOINTER_ISA, "disable non-pointer isa fields") 44 | OPTION( DisableInitializeForkSafety, OBJC_DISABLE_INITIALIZE_FORK_SAFETY, "disable safety checks for +initialize after fork") 45 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-exception.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002-2003, 2006-2007 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_EXCEPTION_H_ 25 | #define __OBJC_EXCEPTION_H_ 26 | 27 | #include 28 | #include 29 | 30 | #if !__OBJC2__ 31 | 32 | // compiler reserves a setjmp buffer + 4 words as localExceptionData 33 | 34 | OBJC_EXPORT void 35 | objc_exception_throw(id _Nonnull exception) 36 | __OSX_AVAILABLE(10.3) 37 | __IOS_UNAVAILABLE __TVOS_UNAVAILABLE 38 | __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE; 39 | 40 | OBJC_EXPORT void 41 | objc_exception_try_enter(void * _Nonnull localExceptionData) 42 | __OSX_AVAILABLE(10.3) 43 | __IOS_UNAVAILABLE __TVOS_UNAVAILABLE 44 | __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE; 45 | 46 | OBJC_EXPORT void 47 | objc_exception_try_exit(void * _Nonnull localExceptionData) 48 | __OSX_AVAILABLE(10.3) 49 | __IOS_UNAVAILABLE __TVOS_UNAVAILABLE 50 | __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE; 51 | 52 | OBJC_EXPORT id _Nonnull 53 | objc_exception_extract(void * _Nonnull localExceptionData) 54 | __OSX_AVAILABLE(10.3) 55 | __IOS_UNAVAILABLE __TVOS_UNAVAILABLE 56 | __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE; 57 | 58 | OBJC_EXPORT int objc_exception_match(Class _Nonnull exceptionClass, 59 | id _Nonnull exception) 60 | __OSX_AVAILABLE(10.3) 61 | __IOS_UNAVAILABLE __TVOS_UNAVAILABLE 62 | __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE; 63 | 64 | 65 | typedef struct { 66 | int version; 67 | void (* _Nonnull throw_exc)(id _Nonnull); // version 0 68 | void (* _Nonnull try_enter)(void * _Nonnull); // version 0 69 | void (* _Nonnull try_exit)(void * _Nonnull); // version 0 70 | id _Nonnull (* _Nonnull extract)(void * _Nonnull); // version 0 71 | int (* _Nonnull match)(Class _Nonnull, id _Nonnull); // version 0 72 | } objc_exception_functions_t; 73 | 74 | // get table; version tells how many 75 | OBJC_EXPORT void 76 | objc_exception_get_functions(objc_exception_functions_t * _Nullable table) 77 | __OSX_AVAILABLE(10.3) 78 | __IOS_UNAVAILABLE __TVOS_UNAVAILABLE 79 | __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE; 80 | 81 | // set table 82 | OBJC_EXPORT void 83 | objc_exception_set_functions(objc_exception_functions_t * _Nullable table) 84 | __OSX_AVAILABLE(10.3) 85 | __IOS_UNAVAILABLE __TVOS_UNAVAILABLE 86 | __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE; 87 | 88 | 89 | // !__OBJC2__ 90 | #else 91 | // __OBJC2__ 92 | 93 | typedef id _Nonnull (*objc_exception_preprocessor)(id _Nonnull exception); 94 | typedef int (*objc_exception_matcher)(Class _Nonnull catch_type, 95 | id _Nonnull exception); 96 | typedef void (*objc_uncaught_exception_handler)(id _Null_unspecified /* _Nonnull */ exception); 97 | typedef void (*objc_exception_handler)(id _Nullable unused, 98 | void * _Nullable context); 99 | 100 | /** 101 | * Throw a runtime exception. This function is inserted by the compiler 102 | * where \c @throw would otherwise be. 103 | * 104 | * @param exception The exception to be thrown. 105 | */ 106 | OBJC_EXPORT void 107 | objc_exception_throw(id _Nonnull exception) 108 | OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0); 109 | 110 | OBJC_EXPORT void 111 | objc_exception_rethrow(void) 112 | OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0); 113 | 114 | OBJC_EXPORT id _Nonnull 115 | objc_begin_catch(void * _Nonnull exc_buf) 116 | OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0); 117 | 118 | OBJC_EXPORT void 119 | objc_end_catch(void) 120 | OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0); 121 | 122 | OBJC_EXPORT void 123 | objc_terminate(void) 124 | OBJC_AVAILABLE(10.8, 6.0, 9.0, 1.0, 2.0); 125 | 126 | OBJC_EXPORT objc_exception_preprocessor _Nonnull 127 | objc_setExceptionPreprocessor(objc_exception_preprocessor _Nonnull fn) 128 | OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0); 129 | 130 | OBJC_EXPORT objc_exception_matcher _Nonnull 131 | objc_setExceptionMatcher(objc_exception_matcher _Nonnull fn) 132 | OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0); 133 | 134 | OBJC_EXPORT objc_uncaught_exception_handler _Nonnull 135 | objc_setUncaughtExceptionHandler(objc_uncaught_exception_handler _Nonnull fn) 136 | OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0, 2.0); 137 | 138 | // Not for iOS. 139 | OBJC_EXPORT uintptr_t 140 | objc_addExceptionHandler(objc_exception_handler _Nonnull fn, 141 | void * _Nullable context) 142 | __OSX_AVAILABLE(10.5) 143 | __IOS_UNAVAILABLE __TVOS_UNAVAILABLE 144 | __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE; 145 | 146 | OBJC_EXPORT void 147 | objc_removeExceptionHandler(uintptr_t token) 148 | __OSX_AVAILABLE(10.5) 149 | __IOS_UNAVAILABLE __TVOS_UNAVAILABLE 150 | __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE; 151 | 152 | // __OBJC2__ 153 | #endif 154 | 155 | #endif // __OBJC_EXCEPTION_H_ 156 | 157 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-file-old.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 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_FILE_OLD_H 25 | #define _OBJC_FILE_OLD_H 26 | 27 | #if !__OBJC2__ 28 | 29 | #include "objc-os.h" 30 | 31 | struct objc_module; 32 | struct old_protocol; 33 | struct old_class; 34 | 35 | __BEGIN_DECLS 36 | 37 | extern struct objc_module *_getObjcModules(const header_info *hi, size_t *nmodules); 38 | extern SEL *_getObjcSelectorRefs(const header_info *hi, size_t *nmess); 39 | extern struct old_protocol **_getObjcProtocols(const header_info *hi, size_t *nprotos); 40 | extern Class *_getObjcClassRefs(const header_info *hi, size_t *nclasses); 41 | extern const char *_getObjcClassNames(const header_info *hi, size_t *size); 42 | 43 | using UnsignedInitializer = void(*)(void); 44 | extern UnsignedInitializer* getLibobjcInitializers(const headerType *mhdr, size_t *count); 45 | 46 | __END_DECLS 47 | 48 | #endif 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-file-old.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2007 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 | // Copyright 1988-1996 NeXT Software, Inc. 24 | 25 | #if !__OBJC2__ 26 | 27 | #include "objc-private.h" 28 | #include "objc-runtime-old.h" 29 | #include "objc-file-old.h" 30 | 31 | #if TARGET_OS_WIN32 32 | 33 | /* 34 | Module 35 | _getObjcModules(const header_info *hi, size_t *nmodules) 36 | { 37 | if (nmodules) *nmodules = hi->moduleCount; 38 | return hi->modules; 39 | } 40 | */ 41 | SEL * 42 | _getObjcSelectorRefs(const header_info *hi, size_t *nmess) 43 | { 44 | if (nmess) *nmess = hi->selrefCount; 45 | return hi->selrefs; 46 | } 47 | 48 | struct old_protocol ** 49 | _getObjcProtocols(const header_info *hi, size_t *nprotos) 50 | { 51 | if (nprotos) *nprotos = hi->protocolCount; 52 | return hi->protocols; 53 | } 54 | 55 | Class* 56 | _getObjcClassRefs(const header_info *hi, size_t *nclasses) 57 | { 58 | if (nclasses) *nclasses = hi->clsrefCount; 59 | return (Class*)hi->clsrefs; 60 | } 61 | 62 | // __OBJC,__class_names section only emitted by CodeWarrior rdar://4951638 63 | const char * 64 | _getObjcClassNames(const header_info *hi, size_t *size) 65 | { 66 | if (size) *size = 0; 67 | return NULL; 68 | } 69 | 70 | #else 71 | 72 | #define GETSECT(name, type, segname, sectname) \ 73 | type *name(const headerType *mhdr, size_t *outCount) \ 74 | { \ 75 | unsigned long byteCount = 0; \ 76 | type *data = (type *) \ 77 | getsectiondata(mhdr, segname, sectname, &byteCount); \ 78 | *outCount = byteCount / sizeof(type); \ 79 | return data; \ 80 | } \ 81 | type *name(const header_info *hi, size_t *outCount) \ 82 | { \ 83 | return name(hi->mhdr(), outCount); \ 84 | } 85 | 86 | GETSECT(_getObjcModules, objc_module, "__OBJC", "__module_info"); 87 | GETSECT(_getObjcSelectorRefs, SEL, "__OBJC", "__message_refs"); 88 | GETSECT(_getObjcClassRefs, Class, "__OBJC", "__cls_refs"); 89 | GETSECT(_getObjcClassNames, const char, "__OBJC", "__class_names"); 90 | // __OBJC,__class_names section only emitted by CodeWarrior rdar://4951638 91 | GETSECT(getLibobjcInitializers, UnsignedInitializer, "__DATA", "__objc_init_func"); 92 | 93 | 94 | objc_image_info * 95 | _getObjcImageInfo(const headerType *mhdr, size_t *outBytes) 96 | { 97 | unsigned long byteCount = 0; 98 | objc_image_info *info = (objc_image_info *) 99 | getsectiondata(mhdr, SEG_OBJC, "__image_info", &byteCount); 100 | *outBytes = byteCount; 101 | return info; 102 | } 103 | 104 | 105 | struct old_protocol ** 106 | _getObjcProtocols(const header_info *hi, size_t *nprotos) 107 | { 108 | unsigned long size = 0; 109 | struct old_protocol *protos = (struct old_protocol *) 110 | getsectiondata(hi->mhdr(), SEG_OBJC, "__protocol", &size); 111 | *nprotos = size / sizeof(struct old_protocol); 112 | 113 | if (!hi->proto_refs && *nprotos) { 114 | size_t i; 115 | header_info *whi = (header_info *)hi; 116 | whi->proto_refs = (struct old_protocol **) 117 | malloc(*nprotos * sizeof(*hi->proto_refs)); 118 | for (i = 0; i < *nprotos; i++) { 119 | hi->proto_refs[i] = protos+i; 120 | } 121 | } 122 | 123 | return hi->proto_refs; 124 | } 125 | 126 | 127 | static const segmentType * 128 | getsegbynamefromheader(const headerType *head, const char *segname) 129 | { 130 | const segmentType *sgp; 131 | unsigned long i; 132 | 133 | sgp = (const segmentType *) (head + 1); 134 | for (i = 0; i < head->ncmds; i++){ 135 | if (sgp->cmd == SEGMENT_CMD) { 136 | if (strncmp(sgp->segname, segname, sizeof(sgp->segname)) == 0) { 137 | return sgp; 138 | } 139 | } 140 | sgp = (const segmentType *)((char *)sgp + sgp->cmdsize); 141 | } 142 | return NULL; 143 | } 144 | 145 | bool 146 | _hasObjcContents(const header_info *hi) 147 | { 148 | // Look for an __OBJC,* section other than __OBJC,__image_info 149 | const segmentType *seg = getsegbynamefromheader(hi->mhdr(), "__OBJC"); 150 | const sectionType *sect; 151 | uint32_t i; 152 | for (i = 0; i < seg->nsects; i++) { 153 | sect = ((const sectionType *)(seg+1))+i; 154 | if (0 != strncmp(sect->sectname, "__image_info", 12)) { 155 | return YES; 156 | } 157 | } 158 | 159 | return NO; 160 | } 161 | 162 | 163 | #endif 164 | 165 | #endif 166 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 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_FILE_NEW_H 25 | #define _OBJC_FILE_NEW_H 26 | 27 | #if __OBJC2__ 28 | 29 | #include "objc-runtime-new.h" 30 | 31 | // classref_t is not fixed up at launch; use remapClass() to convert 32 | 33 | extern SEL *_getObjc2SelectorRefs(const header_info *hi, size_t *count); 34 | extern message_ref_t *_getObjc2MessageRefs(const header_info *hi, size_t *count); 35 | extern Class*_getObjc2ClassRefs(const header_info *hi, size_t *count); 36 | extern Class*_getObjc2SuperRefs(const header_info *hi, size_t *count); 37 | extern classref_t *_getObjc2ClassList(const header_info *hi, size_t *count); 38 | extern classref_t *_getObjc2NonlazyClassList(const header_info *hi, size_t *count); 39 | extern category_t **_getObjc2CategoryList(const header_info *hi, size_t *count); 40 | extern category_t **_getObjc2NonlazyCategoryList(const header_info *hi, size_t *count); 41 | extern protocol_t **_getObjc2ProtocolList(const header_info *hi, size_t *count); 42 | extern protocol_t **_getObjc2ProtocolRefs(const header_info *hi, size_t *count); 43 | 44 | // FIXME: rdar://29241917&33734254 clang doesn't sign static initializers. 45 | struct UnsignedInitializer { 46 | private: 47 | uintptr_t storage; 48 | public: 49 | void operator () () const { 50 | using Initializer = void(*)(); 51 | Initializer init = 52 | ptrauth_sign_unauthenticated((Initializer)storage, 53 | ptrauth_key_function_pointer, 0); 54 | init(); 55 | } 56 | }; 57 | 58 | extern UnsignedInitializer *getLibobjcInitializers(const header_info *hi, size_t *count); 59 | 60 | extern classref_t *_getObjc2NonlazyClassList(const headerType *mhdr, size_t *count); 61 | extern category_t **_getObjc2NonlazyCategoryList(const headerType *mhdr, size_t *count); 62 | extern UnsignedInitializer *getLibobjcInitializers(const headerType *mhdr, size_t *count); 63 | 64 | static inline void 65 | foreach_data_segment(const headerType *mhdr, 66 | std::function code) 67 | { 68 | intptr_t slide = 0; 69 | 70 | // compute VM slide 71 | const segmentType *seg = (const segmentType *) (mhdr + 1); 72 | for (unsigned long i = 0; i < mhdr->ncmds; i++) { 73 | if (seg->cmd == SEGMENT_CMD && 74 | segnameEquals(seg->segname, "__TEXT")) 75 | { 76 | slide = (char *)mhdr - (char *)seg->vmaddr; 77 | break; 78 | } 79 | seg = (const segmentType *)((char *)seg + seg->cmdsize); 80 | } 81 | 82 | // enumerate __DATA* segments 83 | seg = (const segmentType *) (mhdr + 1); 84 | for (unsigned long i = 0; i < mhdr->ncmds; i++) { 85 | if (seg->cmd == SEGMENT_CMD && 86 | segnameStartsWith(seg->segname, "__DATA")) 87 | { 88 | code(seg, slide); 89 | } 90 | seg = (const segmentType *)((char *)seg + seg->cmdsize); 91 | } 92 | } 93 | 94 | #endif 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-file.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2007 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 | #if __OBJC2__ 25 | 26 | #include "objc-private.h" 27 | #include "objc-file.h" 28 | 29 | 30 | // Look for a __DATA or __DATA_CONST or __DATA_DIRTY section 31 | // with the given name that stores an array of T. 32 | template 33 | T* getDataSection(const headerType *mhdr, const char *sectname, 34 | size_t *outBytes, size_t *outCount) 35 | { 36 | unsigned long byteCount = 0; 37 | T* data = (T*)getsectiondata(mhdr, "__DATA", sectname, &byteCount); 38 | if (!data) { 39 | data = (T*)getsectiondata(mhdr, "__DATA_CONST", sectname, &byteCount); 40 | } 41 | if (!data) { 42 | data = (T*)getsectiondata(mhdr, "__DATA_DIRTY", sectname, &byteCount); 43 | } 44 | if (outBytes) *outBytes = byteCount; 45 | if (outCount) *outCount = byteCount / sizeof(T); 46 | return data; 47 | } 48 | 49 | #define GETSECT(name, type, sectname) \ 50 | type *name(const headerType *mhdr, size_t *outCount) { \ 51 | return getDataSection(mhdr, sectname, nil, outCount); \ 52 | } \ 53 | type *name(const header_info *hi, size_t *outCount) { \ 54 | return getDataSection(hi->mhdr(), sectname, nil, outCount); \ 55 | } 56 | 57 | // function name content type section name 58 | GETSECT(_getObjc2SelectorRefs, SEL, "__objc_selrefs"); 59 | GETSECT(_getObjc2MessageRefs, message_ref_t, "__objc_msgrefs"); 60 | GETSECT(_getObjc2ClassRefs, Class, "__objc_classrefs"); 61 | GETSECT(_getObjc2SuperRefs, Class, "__objc_superrefs"); 62 | GETSECT(_getObjc2ClassList, classref_t, "__objc_classlist"); 63 | GETSECT(_getObjc2NonlazyClassList, classref_t, "__objc_nlclslist"); 64 | GETSECT(_getObjc2CategoryList, category_t *, "__objc_catlist"); 65 | GETSECT(_getObjc2NonlazyCategoryList, category_t *, "__objc_nlcatlist"); 66 | GETSECT(_getObjc2ProtocolList, protocol_t *, "__objc_protolist"); 67 | GETSECT(_getObjc2ProtocolRefs, protocol_t *, "__objc_protorefs"); 68 | GETSECT(getLibobjcInitializers, UnsignedInitializer, "__objc_init_func"); 69 | 70 | 71 | objc_image_info * 72 | _getObjcImageInfo(const headerType *mhdr, size_t *outBytes) 73 | { 74 | return getDataSection(mhdr, "__objc_imageinfo", 75 | outBytes, nil); 76 | } 77 | 78 | // Look for an __objc* section other than __objc_imageinfo 79 | static bool segmentHasObjcContents(const segmentType *seg) 80 | { 81 | for (uint32_t i = 0; i < seg->nsects; i++) { 82 | const sectionType *sect = ((const sectionType *)(seg+1))+i; 83 | if (sectnameStartsWith(sect->sectname, "__objc_") && 84 | !sectnameEquals(sect->sectname, "__objc_imageinfo")) 85 | { 86 | return true; 87 | } 88 | } 89 | 90 | return false; 91 | } 92 | 93 | // Look for an __objc* section other than __objc_imageinfo 94 | bool 95 | _hasObjcContents(const header_info *hi) 96 | { 97 | bool foundObjC = false; 98 | 99 | foreach_data_segment(hi->mhdr(), [&](const segmentType *seg, intptr_t slide) 100 | { 101 | if (segmentHasObjcContents(seg)) foundObjC = true; 102 | }); 103 | 104 | return foundObjC; 105 | 106 | } 107 | 108 | 109 | // OBJC2 110 | #endif 111 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-gdb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 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_GDB_H 25 | #define _OBJC_GDB_H 26 | 27 | /* 28 | * WARNING DANGER HAZARD BEWARE EEK 29 | * 30 | * Everything in this file is for debugger and developer tool use only. 31 | * These will change in arbitrary OS updates and in unpredictable ways. 32 | * When your program breaks, you get to keep both pieces. 33 | */ 34 | 35 | #ifdef __APPLE_API_PRIVATE 36 | 37 | #ifndef _OBJC_PRIVATE_H_ 38 | # define _OBJC_PRIVATE_H_ 39 | #endif 40 | #include 41 | #include 42 | #include 43 | 44 | __BEGIN_DECLS 45 | 46 | 47 | /*********************************************************************** 48 | * Class pointer preflighting 49 | **********************************************************************/ 50 | 51 | // Return cls if it's a valid class, or crash. 52 | OBJC_EXPORT Class _Nonnull 53 | gdb_class_getClass(Class _Nonnull cls) 54 | #if __OBJC2__ 55 | OBJC_AVAILABLE(10.6, 3.1, 9.0, 1.0, 2.0); 56 | #else 57 | OBJC_AVAILABLE(10.7, 3.1, 9.0, 1.0, 2.0); 58 | #endif 59 | 60 | // Same as gdb_class_getClass(object_getClass(cls)). 61 | OBJC_EXPORT Class _Nonnull gdb_object_getClass(id _Nullable obj) 62 | OBJC_AVAILABLE(10.7, 4.3, 9.0, 1.0, 2.0); 63 | 64 | 65 | /*********************************************************************** 66 | * Class lists for heap. 67 | **********************************************************************/ 68 | 69 | #if __OBJC2__ 70 | 71 | // Maps class name to Class, for in-use classes only. NXStrValueMapPrototype. 72 | OBJC_EXPORT NXMapTable * _Nullable gdb_objc_realized_classes 73 | OBJC_AVAILABLE(10.6, 3.1, 9.0, 1.0, 2.0); 74 | 75 | #else 76 | 77 | // Hashes Classes, for all known classes. Custom prototype. 78 | OBJC_EXPORT NXHashTable * _Nullable _objc_debug_class_hash 79 | __OSX_AVAILABLE(10.2) 80 | __IOS_UNAVAILABLE __TVOS_UNAVAILABLE 81 | __WATCHOS_UNAVAILABLE __BRIDGEOS_UNAVAILABLE; 82 | 83 | #endif 84 | 85 | 86 | /*********************************************************************** 87 | * Non-pointer isa 88 | **********************************************************************/ 89 | 90 | #if __OBJC2__ 91 | 92 | // Extract isa pointer from an isa field. 93 | // (Class)(isa & mask) == class pointer 94 | OBJC_EXPORT const uintptr_t objc_debug_isa_class_mask 95 | OBJC_AVAILABLE(10.10, 7.0, 9.0, 1.0, 2.0); 96 | 97 | // Extract magic cookie from an isa field. 98 | // (isa & magic_mask) == magic_value 99 | OBJC_EXPORT const uintptr_t objc_debug_isa_magic_mask 100 | OBJC_AVAILABLE(10.10, 7.0, 9.0, 1.0, 2.0); 101 | OBJC_EXPORT const uintptr_t objc_debug_isa_magic_value 102 | OBJC_AVAILABLE(10.10, 7.0, 9.0, 1.0, 2.0); 103 | 104 | // Use indexed ISAs for targets which store index of the class in the ISA. 105 | // This index can be used to index the array of classes. 106 | OBJC_EXPORT const uintptr_t objc_debug_indexed_isa_magic_mask; 107 | OBJC_EXPORT const uintptr_t objc_debug_indexed_isa_magic_value; 108 | 109 | // Then these are used to extract the index from the ISA. 110 | OBJC_EXPORT const uintptr_t objc_debug_indexed_isa_index_mask; 111 | OBJC_EXPORT const uintptr_t objc_debug_indexed_isa_index_shift; 112 | 113 | // And then we can use that index to get the class from this array. Note 114 | // the size is provided so that clients can ensure the index they get is in 115 | // bounds and not read off the end of the array. 116 | OBJC_EXPORT Class _Nullable objc_indexed_classes[]; 117 | 118 | // When we don't have enough bits to store a class*, we can instead store an 119 | // index in to this array. Classes are added here when they are realized. 120 | // Note, an index of 0 is illegal. 121 | OBJC_EXPORT uintptr_t objc_indexed_classes_count; 122 | 123 | // Absolute symbols for some of the above values are in objc-abi.h. 124 | 125 | #endif 126 | 127 | 128 | /*********************************************************************** 129 | * Class structure decoding 130 | **********************************************************************/ 131 | #if __OBJC2__ 132 | 133 | // Mask for the pointer from class struct to class rw data. 134 | // Other bits may be used for flags. 135 | // Use 0x00007ffffffffff8UL or 0xfffffffcUL when this variable is unavailable. 136 | OBJC_EXPORT const uintptr_t objc_debug_class_rw_data_mask 137 | OBJC_AVAILABLE(10.13, 11.0, 11.0, 4.0, 2.0); 138 | 139 | #endif 140 | 141 | 142 | /*********************************************************************** 143 | * Tagged pointer decoding 144 | **********************************************************************/ 145 | #if __OBJC2__ 146 | 147 | // Basic tagged pointers (7 classes, 60-bit payload). 148 | 149 | // if (obj & mask) obj is a tagged pointer object 150 | OBJC_EXPORT uintptr_t objc_debug_taggedpointer_mask 151 | OBJC_AVAILABLE(10.9, 7.0, 9.0, 1.0, 2.0); 152 | 153 | // tagged pointers are obfuscated by XORing with a random value 154 | // decoded_obj = (obj ^ obfuscator) 155 | OBJC_EXPORT uintptr_t objc_debug_taggedpointer_obfuscator 156 | OBJC_AVAILABLE(10.14, 12.0, 12.0, 5.0, 3.0); 157 | 158 | 159 | // tag_slot = (obj >> slot_shift) & slot_mask 160 | OBJC_EXPORT unsigned int objc_debug_taggedpointer_slot_shift 161 | OBJC_AVAILABLE(10.9, 7.0, 9.0, 1.0, 2.0); 162 | OBJC_EXPORT uintptr_t objc_debug_taggedpointer_slot_mask 163 | OBJC_AVAILABLE(10.9, 7.0, 9.0, 1.0, 2.0); 164 | 165 | // class = classes[tag_slot] 166 | OBJC_EXPORT Class _Nullable objc_debug_taggedpointer_classes[] 167 | OBJC_AVAILABLE(10.9, 7.0, 9.0, 1.0, 2.0); 168 | 169 | // payload = (decoded_obj << payload_lshift) >> payload_rshift 170 | // Payload signedness is determined by the signedness of the right-shift. 171 | OBJC_EXPORT unsigned int objc_debug_taggedpointer_payload_lshift 172 | OBJC_AVAILABLE(10.9, 7.0, 9.0, 1.0, 2.0); 173 | OBJC_EXPORT unsigned int objc_debug_taggedpointer_payload_rshift 174 | OBJC_AVAILABLE(10.9, 7.0, 9.0, 1.0, 2.0); 175 | 176 | 177 | // Extended tagged pointers (255 classes, 52-bit payload). 178 | 179 | // If you interrogate an extended tagged pointer using the basic 180 | // tagged pointer scheme alone, it will appear to have an isa 181 | // that is either nil or class __NSUnrecognizedTaggedPointer. 182 | 183 | // if (ext_mask != 0 && (decoded_obj & ext_mask) == ext_mask) 184 | // obj is a ext tagged pointer object 185 | OBJC_EXPORT uintptr_t objc_debug_taggedpointer_ext_mask 186 | OBJC_AVAILABLE(10.12, 10.0, 10.0, 3.0, 2.0); 187 | 188 | // ext_tag_slot = (obj >> ext_slot_shift) & ext_slot_mask 189 | OBJC_EXPORT unsigned int objc_debug_taggedpointer_ext_slot_shift 190 | OBJC_AVAILABLE(10.12, 10.0, 10.0, 3.0, 2.0); 191 | OBJC_EXPORT uintptr_t objc_debug_taggedpointer_ext_slot_mask 192 | OBJC_AVAILABLE(10.12, 10.0, 10.0, 3.0, 2.0); 193 | 194 | // class = ext_classes[ext_tag_slot] 195 | OBJC_EXPORT Class _Nullable objc_debug_taggedpointer_ext_classes[] 196 | OBJC_AVAILABLE(10.12, 10.0, 10.0, 3.0, 2.0); 197 | 198 | // payload = (decoded_obj << ext_payload_lshift) >> ext_payload_rshift 199 | // Payload signedness is determined by the signedness of the right-shift. 200 | OBJC_EXPORT unsigned int objc_debug_taggedpointer_ext_payload_lshift 201 | OBJC_AVAILABLE(10.12, 10.0, 10.0, 3.0, 2.0); 202 | OBJC_EXPORT unsigned int objc_debug_taggedpointer_ext_payload_rshift 203 | OBJC_AVAILABLE(10.12, 10.0, 10.0, 3.0, 2.0); 204 | 205 | #endif 206 | 207 | __END_DECLS 208 | 209 | // APPLE_API_PRIVATE 210 | #endif 211 | 212 | // _OBJC_GDB_H 213 | #endif 214 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-initialize.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005-2006 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_INITIALIZE_H 25 | #define _OBJC_INITIALIZE_H 26 | 27 | #include "objc-private.h" 28 | 29 | __BEGIN_DECLS 30 | 31 | struct _objc_initializing_classes; 32 | 33 | extern void _class_initialize(Class cls); 34 | 35 | extern void _destroyInitializingClassList(struct _objc_initializing_classes *list); 36 | 37 | extern bool _thisThreadIsInitializingClass(Class cls); 38 | 39 | __END_DECLS 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-load.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2001, 2005-2006 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 | * objc-load.h 25 | * Copyright 1988-1996, NeXT Software, Inc. 26 | */ 27 | 28 | #ifndef _OBJC_LOAD_H_ 29 | #define _OBJC_LOAD_H_ 30 | 31 | #include 32 | 33 | #include 34 | 35 | /* dynamically loading Mach-O object files that contain Objective-C code */ 36 | 37 | OBJC_EXPORT long objc_loadModules ( 38 | char * _Nullable modlist[_Nullable], 39 | void * _Nullable errStream, 40 | void (* _Nullable class_callback) (Class _Nullable, Category _Nullable), 41 | /*headerType*/ struct mach_header * _Nullable * _Nullable hdr_addr, 42 | char * _Nullable debug_file 43 | ) OBJC2_UNAVAILABLE; 44 | 45 | OBJC_EXPORT int objc_loadModule ( 46 | char * _Nullable moduleName, 47 | void (* _Nullable class_callback) (Class _Nullable, Category _Nullable), 48 | int * _Nullable errorCode 49 | ) OBJC2_UNAVAILABLE; 50 | OBJC_EXPORT long objc_unloadModules( 51 | void * _Nullable errorStream, /* input (optional) */ 52 | void (* _Nullable unloadCallback)(Class _Nullable, Category _Nullable) /* input (optional) */ 53 | ) OBJC2_UNAVAILABLE; 54 | 55 | #endif /* _OBJC_LOAD_H_ */ 56 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-load.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2001, 2004-2007 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 | /* 25 | * objc-load.m 26 | * Copyright 1988-1996, NeXT Software, Inc. 27 | * Author: s. naroff 28 | * 29 | */ 30 | 31 | #include "objc-private.h" 32 | #include "objc-load.h" 33 | 34 | #if !__OBJC2__ && !TARGET_OS_WIN32 35 | 36 | extern void (*callbackFunction)( Class, Category ); 37 | 38 | 39 | /********************************************************************************** 40 | * objc_loadModule. 41 | * 42 | * NOTE: Loading isn't really thread safe. If a load message recursively calls 43 | * objc_loadModules() both sets will be loaded correctly, but if the original 44 | * caller calls objc_unloadModules() it will probably unload the wrong modules. 45 | * If a load message calls objc_unloadModules(), then it will unload 46 | * the modules currently being loaded, which will probably cause a crash. 47 | * 48 | * Error handling is still somewhat crude. If we encounter errors while 49 | * linking up classes or categories, we will not recover correctly. 50 | * 51 | * I removed attempts to lock the class hashtable, since this introduced 52 | * deadlock which was hard to remove. The only way you can get into trouble 53 | * is if one thread loads a module while another thread tries to access the 54 | * loaded classes (using objc_lookUpClass) before the load is complete. 55 | **********************************************************************************/ 56 | int objc_loadModule(char *moduleName, void (*class_callback) (Class, Category), int *errorCode) 57 | { 58 | int successFlag = 1; 59 | int locErrorCode; 60 | NSObjectFileImage objectFileImage; 61 | NSObjectFileImageReturnCode code; 62 | 63 | // So we don't have to check this everywhere 64 | if (errorCode == NULL) 65 | errorCode = &locErrorCode; 66 | 67 | if (moduleName == NULL) 68 | { 69 | *errorCode = NSObjectFileImageInappropriateFile; 70 | return 0; 71 | } 72 | 73 | if (_dyld_present () == 0) 74 | { 75 | *errorCode = NSObjectFileImageFailure; 76 | return 0; 77 | } 78 | 79 | callbackFunction = class_callback; 80 | code = NSCreateObjectFileImageFromFile (moduleName, &objectFileImage); 81 | if (code != NSObjectFileImageSuccess) 82 | { 83 | *errorCode = code; 84 | return 0; 85 | } 86 | 87 | if (NSLinkModule(objectFileImage, moduleName, NSLINKMODULE_OPTION_RETURN_ON_ERROR) == NULL) { 88 | NSLinkEditErrors error; 89 | int errorNum; 90 | const char *fileName, *errorString; 91 | NSLinkEditError(&error, &errorNum, &fileName, &errorString); 92 | // These errors may overlap with other errors that objc_loadModule returns in other failure cases. 93 | *errorCode = error; 94 | return 0; 95 | } 96 | callbackFunction = NULL; 97 | 98 | 99 | return successFlag; 100 | } 101 | 102 | /********************************************************************************** 103 | * objc_loadModules. 104 | **********************************************************************************/ 105 | /* Lock for dynamic loading and unloading. */ 106 | // static OBJC_DECLARE_LOCK (loadLock); 107 | 108 | 109 | long objc_loadModules (char * modlist[], 110 | void * errStream, 111 | void (*class_callback) (Class, Category), 112 | headerType ** hdr_addr, 113 | char * debug_file) 114 | { 115 | char ** modules; 116 | int code; 117 | int itWorked; 118 | 119 | if (modlist == 0) 120 | return 0; 121 | 122 | for (modules = &modlist[0]; *modules != 0; modules++) 123 | { 124 | itWorked = objc_loadModule (*modules, class_callback, &code); 125 | if (itWorked == 0) 126 | { 127 | //if (errStream) 128 | // NXPrintf ((NXStream *) errStream, "objc_loadModules(%s) code = %d\n", *modules, code); 129 | return 1; 130 | } 131 | 132 | if (hdr_addr) 133 | *(hdr_addr++) = 0; 134 | } 135 | 136 | return 0; 137 | } 138 | 139 | /********************************************************************************** 140 | * objc_unloadModules. 141 | * 142 | * NOTE: Unloading isn't really thread safe. If an unload message calls 143 | * objc_loadModules() or objc_unloadModules(), then the current call 144 | * to objc_unloadModules() will probably unload the wrong stuff. 145 | **********************************************************************************/ 146 | 147 | long objc_unloadModules (void * errStream, 148 | void (*unload_callback) (Class, Category)) 149 | { 150 | headerType * header_addr = 0; 151 | int errflag = 0; 152 | 153 | // TODO: to make unloading work, should get the current header 154 | 155 | if (header_addr) 156 | { 157 | ; // TODO: unload the current header 158 | } 159 | else 160 | { 161 | errflag = 1; 162 | } 163 | 164 | return errflag; 165 | } 166 | 167 | #endif 168 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-loadmethod.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 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 | /*********************************************************************** 25 | * objc-loadmethod.h 26 | * Support for +load methods. 27 | **********************************************************************/ 28 | 29 | #ifndef _OBJC_LOADMETHOD_H 30 | #define _OBJC_LOADMETHOD_H 31 | 32 | #include "objc-private.h" 33 | 34 | __BEGIN_DECLS 35 | 36 | extern void add_class_to_loadable_list(Class cls); 37 | extern void add_category_to_loadable_list(Category cat); 38 | extern void remove_class_from_loadable_list(Class cls); 39 | extern void remove_category_from_loadable_list(Category cat); 40 | 41 | extern void call_load_methods(void); 42 | 43 | __END_DECLS 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-lockdebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 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 | #if LOCKDEBUG 25 | extern void lockdebug_assert_all_locks_locked(); 26 | extern void lockdebug_assert_no_locks_locked(); 27 | extern void lockdebug_setInForkPrepare(bool); 28 | extern void lockdebug_lock_precedes_lock(const void *oldlock, const void *newlock); 29 | #else 30 | static constexpr inline void lockdebug_assert_all_locks_locked() { } 31 | static constexpr inline void lockdebug_assert_no_locks_locked() { } 32 | static constexpr inline void lockdebug_setInForkPrepare(bool) { } 33 | static constexpr inline void lockdebug_lock_precedes_lock(const void *, const void *) { } 34 | #endif 35 | 36 | extern void lockdebug_remember_mutex(mutex_tt *lock); 37 | extern void lockdebug_mutex_lock(mutex_tt *lock); 38 | extern void lockdebug_mutex_try_lock(mutex_tt *lock); 39 | extern void lockdebug_mutex_unlock(mutex_tt *lock); 40 | extern void lockdebug_mutex_assert_locked(mutex_tt *lock); 41 | extern void lockdebug_mutex_assert_unlocked(mutex_tt *lock); 42 | 43 | static constexpr inline void lockdebug_remember_mutex(mutex_tt *lock) { } 44 | static constexpr inline void lockdebug_mutex_lock(mutex_tt *lock) { } 45 | static constexpr inline void lockdebug_mutex_try_lock(mutex_tt *lock) { } 46 | static constexpr inline void lockdebug_mutex_unlock(mutex_tt *lock) { } 47 | static constexpr inline void lockdebug_mutex_assert_locked(mutex_tt *lock) { } 48 | static constexpr inline void lockdebug_mutex_assert_unlocked(mutex_tt *lock) { } 49 | 50 | 51 | extern void lockdebug_remember_monitor(monitor_tt *lock); 52 | extern void lockdebug_monitor_enter(monitor_tt *lock); 53 | extern void lockdebug_monitor_leave(monitor_tt *lock); 54 | extern void lockdebug_monitor_wait(monitor_tt *lock); 55 | extern void lockdebug_monitor_assert_locked(monitor_tt *lock); 56 | extern void lockdebug_monitor_assert_unlocked(monitor_tt *lock); 57 | 58 | static constexpr inline void lockdebug_remember_monitor(monitor_tt *lock) { } 59 | static constexpr inline void lockdebug_monitor_enter(monitor_tt *lock) { } 60 | static constexpr inline void lockdebug_monitor_leave(monitor_tt *lock) { } 61 | static constexpr inline void lockdebug_monitor_wait(monitor_tt *lock) { } 62 | static constexpr inline void lockdebug_monitor_assert_locked(monitor_tt *lock) { } 63 | static constexpr inline void lockdebug_monitor_assert_unlocked(monitor_tt *lock) {} 64 | 65 | 66 | extern void 67 | lockdebug_remember_recursive_mutex(recursive_mutex_tt *lock); 68 | extern void 69 | lockdebug_recursive_mutex_lock(recursive_mutex_tt *lock); 70 | extern void 71 | lockdebug_recursive_mutex_unlock(recursive_mutex_tt *lock); 72 | extern void 73 | lockdebug_recursive_mutex_assert_locked(recursive_mutex_tt *lock); 74 | extern void 75 | lockdebug_recursive_mutex_assert_unlocked(recursive_mutex_tt *lock); 76 | 77 | static constexpr inline void 78 | lockdebug_remember_recursive_mutex(recursive_mutex_tt *lock) { } 79 | static constexpr inline void 80 | lockdebug_recursive_mutex_lock(recursive_mutex_tt *lock) { } 81 | static constexpr inline void 82 | lockdebug_recursive_mutex_unlock(recursive_mutex_tt *lock) { } 83 | static constexpr inline void 84 | lockdebug_recursive_mutex_assert_locked(recursive_mutex_tt *lock) { } 85 | static constexpr inline void 86 | lockdebug_recursive_mutex_assert_unlocked(recursive_mutex_tt *lock) { } 87 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-locks-new.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 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 | /*********************************************************************** 25 | * objc-locks-new.h 26 | * Declarations of all locks used in the runtime. 27 | **********************************************************************/ 28 | 29 | #ifndef _OBJC_LOCKS_NEW_H 30 | #define _OBJC_LOCKS_NEW_H 31 | 32 | // fork() safety requires careful tracking of all locks used in the runtime. 33 | // Thou shalt not declare any locks outside this file. 34 | 35 | extern mutex_t runtimeLock; 36 | extern mutex_t DemangleCacheLock; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-locks-old.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 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 | /*********************************************************************** 25 | * objc-locks-old.h 26 | * Declarations of all locks used in the runtime. 27 | **********************************************************************/ 28 | 29 | #ifndef _OBJC_LOCKS_OLD_H 30 | #define _OBJC_LOCKS_OLD_H 31 | 32 | // fork() safety requires careful tracking of all locks used in the runtime. 33 | // Thou shalt not declare any locks outside this file. 34 | 35 | extern mutex_t classLock; 36 | extern mutex_t methodListLock; 37 | extern mutex_t NXUniqueStringLock; 38 | extern spinlock_t impLock; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-locks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 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 | /*********************************************************************** 25 | * objc-locks.h 26 | * Declarations of all locks used in the runtime. 27 | **********************************************************************/ 28 | 29 | #ifndef _OBJC_LOCKS_H 30 | #define _OBJC_LOCKS_H 31 | 32 | // fork() safety requires careful tracking of all locks used in the runtime. 33 | // Thou shalt not declare any locks outside this file. 34 | 35 | // Lock ordering is declared in _objc_fork_prepare() 36 | // and is enforced by lockdebug. 37 | 38 | extern monitor_t classInitLock; 39 | extern mutex_t selLock; 40 | extern mutex_t cacheUpdateLock; 41 | extern recursive_mutex_t loadMethodLock; 42 | extern mutex_t crashlog_lock; 43 | extern spinlock_t objcMsgLogLock; 44 | extern mutex_t AltHandlerDebugLock; 45 | extern mutex_t AssociationsManagerLock; 46 | extern StripedMap PropertyLocks; 47 | extern StripedMap StructLocks; 48 | extern StripedMap CppObjectLocks; 49 | 50 | // SideTable lock is buried awkwardly. Call a function to manipulate it. 51 | extern void SideTableLockAll(); 52 | extern void SideTableUnlockAll(); 53 | extern void SideTableForceResetAll(); 54 | extern void SideTableDefineLockOrder(); 55 | extern void SideTableLocksPrecedeLock(const void *newlock); 56 | extern void SideTableLocksSucceedLock(const void *oldlock); 57 | extern void SideTableLocksPrecedeLocks(StripedMap& newlocks); 58 | extern void SideTableLocksSucceedLocks(StripedMap& oldlocks); 59 | 60 | #if __OBJC2__ 61 | #include "objc-locks-new.h" 62 | #else 63 | #include "objc-locks-old.h" 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-probes.d: -------------------------------------------------------------------------------- 1 | provider objc_runtime 2 | { 3 | probe objc_exception_throw(void *id); 4 | probe objc_exception_rethrow(); 5 | }; 6 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-ptrauth.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 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_PTRAUTH_H_ 25 | #define _OBJC_PTRAUTH_H_ 26 | 27 | #include 28 | 29 | // On some architectures, method lists and method caches store signed IMPs. 30 | 31 | // StorageSignedFunctionPointer is declared by libclosure. 32 | #include 33 | 34 | // fixme simply include ptrauth.h once all build trains have it 35 | #if __has_include () 36 | #include 37 | #else 38 | #define ptrauth_strip(__value, __key) __value 39 | #define ptrauth_blend_discriminator(__pointer, __integer) ((uintptr_t)0) 40 | #define ptrauth_sign_constant(__value, __key, __data) __value 41 | #define ptrauth_sign_unauthenticated(__value, __key, __data) __value 42 | #define ptrauth_auth_and_resign(__value, __old_key, __old_data, __new_key, __new_data) __value 43 | #define ptrauth_auth_function(__value, __old_key, __old_data) __value 44 | #define ptrauth_auth_data(__value, __old_key, __old_data) __value 45 | #define ptrauth_string_discriminator(__string) ((int)0) 46 | #define ptrauth_sign_generic_data(__value, __data) ((ptrauth_generic_signature_t)0) 47 | 48 | #define __ptrauth_function_pointer 49 | #define __ptrauth_return_address 50 | #define __ptrauth_block_invocation_pointer 51 | #define __ptrauth_block_copy_helper 52 | #define __ptrauth_block_destroy_helper 53 | #define __ptrauth_block_byref_copy_helper 54 | #define __ptrauth_block_byref_destroy_helper 55 | #define __ptrauth_objc_method_list_imp 56 | #define __ptrauth_cxx_vtable_pointer 57 | #define __ptrauth_cxx_vtt_vtable_pointer 58 | #define __ptrauth_swift_heap_object_destructor 59 | #define __ptrauth_cxx_virtual_function_pointer(__declkey) 60 | #define __ptrauth_swift_function_pointer(__typekey) 61 | #define __ptrauth_swift_class_method_pointer(__declkey) 62 | #define __ptrauth_swift_protocol_witness_function_pointer(__declkey) 63 | #define __ptrauth_swift_value_witness_function_pointer(__key) 64 | #endif 65 | 66 | 67 | #if __has_feature(ptrauth_calls) 68 | 69 | // Method lists use process-independent signature for compatibility. 70 | // Method caches use process-dependent signature for extra protection. 71 | // (fixme not yet __ptrauth(...) because of `stp` inline asm in objc-cache.mm) 72 | using MethodListIMP = IMP __ptrauth_objc_method_list_imp; 73 | using MethodCacheIMP = 74 | StorageSignedFunctionPointer; 75 | 76 | #else 77 | 78 | using MethodListIMP = IMP; 79 | using MethodCacheIMP = IMP; 80 | 81 | #endif 82 | 83 | // _OBJC_PTRAUTH_H_ 84 | #endif 85 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-references.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 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 | * objc-references.h 25 | */ 26 | 27 | #ifndef _OBJC_REFERENCES_H_ 28 | #define _OBJC_REFERENCES_H_ 29 | 30 | #include "objc-api.h" 31 | #include "objc-config.h" 32 | 33 | __BEGIN_DECLS 34 | 35 | extern void _object_set_associative_reference(id object, void *key, id value, uintptr_t policy); 36 | extern id _object_get_associative_reference(id object, void *key); 37 | extern void _object_remove_assocations(id object); 38 | 39 | __END_DECLS 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-runtime.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-sel-old.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2007 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 | /* 25 | * Utilities for registering and looking up selectors. The sole 26 | * purpose of the selector tables is a registry whereby there is 27 | * exactly one address (selector) associated with a given string 28 | * (method name). 29 | */ 30 | 31 | #if !__OBJC2__ 32 | 33 | #include "objc-private.h" 34 | #include "objc-sel-set.h" 35 | 36 | #if SUPPORT_PREOPT 37 | #include 38 | static const objc_selopt_t *builtins = NULL; 39 | #endif 40 | 41 | __BEGIN_DECLS 42 | 43 | static size_t SelrefCount = 0; 44 | 45 | static const char *_objc_empty_selector = ""; 46 | static struct __objc_sel_set *_objc_selectors = NULL; 47 | 48 | 49 | static SEL _objc_search_builtins(const char *key) 50 | { 51 | #if defined(DUMP_SELECTORS) 52 | if (NULL != key) printf("\t\"%s\",\n", key); 53 | #endif 54 | 55 | if (!key) return (SEL)0; 56 | if ('\0' == *key) return (SEL)_objc_empty_selector; 57 | 58 | #if SUPPORT_PREOPT 59 | if (builtins) return (SEL)builtins->get(key); 60 | #endif 61 | 62 | return (SEL)0; 63 | } 64 | 65 | 66 | const char *sel_getName(SEL sel) { 67 | return sel ? (const char *)sel : ""; 68 | } 69 | 70 | 71 | BOOL sel_isMapped(SEL name) 72 | { 73 | SEL sel; 74 | 75 | if (!name) return NO; 76 | 77 | sel = _objc_search_builtins((const char *)name); 78 | if (sel) return YES; 79 | 80 | mutex_locker_t lock(selLock); 81 | if (_objc_selectors) { 82 | sel = __objc_sel_set_get(_objc_selectors, name); 83 | } 84 | return bool(sel); 85 | } 86 | 87 | static SEL __sel_registerName(const char *name, bool shouldLock, bool copy) 88 | { 89 | SEL result = 0; 90 | 91 | if (shouldLock) selLock.assertUnlocked(); 92 | else selLock.assertLocked(); 93 | 94 | if (!name) return (SEL)0; 95 | result = _objc_search_builtins(name); 96 | if (result) return result; 97 | 98 | conditional_mutex_locker_t lock(selLock, shouldLock); 99 | if (_objc_selectors) { 100 | result = __objc_sel_set_get(_objc_selectors, (SEL)name); 101 | } 102 | if (result) return result; 103 | 104 | // No match. Insert. 105 | 106 | if (!_objc_selectors) { 107 | _objc_selectors = __objc_sel_set_create(SelrefCount); 108 | } 109 | if (!result) { 110 | result = (SEL)(copy ? strdup(name) : name); 111 | __objc_sel_set_add(_objc_selectors, result); 112 | #if defined(DUMP_UNKNOWN_SELECTORS) 113 | printf("\t\"%s\",\n", name); 114 | #endif 115 | } 116 | 117 | return result; 118 | } 119 | 120 | 121 | SEL sel_registerName(const char *name) { 122 | return __sel_registerName(name, 1, 1); // YES lock, YES copy 123 | } 124 | 125 | SEL sel_registerNameNoLock(const char *name, bool copy) { 126 | return __sel_registerName(name, 0, copy); // NO lock, maybe copy 127 | } 128 | 129 | 130 | // 2001/1/24 131 | // the majority of uses of this function (which used to return NULL if not found) 132 | // did not check for NULL, so, in fact, never return NULL 133 | // 134 | SEL sel_getUid(const char *name) { 135 | return __sel_registerName(name, 2, 1); // YES lock, YES copy 136 | } 137 | 138 | 139 | BOOL sel_isEqual(SEL lhs, SEL rhs) 140 | { 141 | return bool(lhs == rhs); 142 | } 143 | 144 | 145 | /*********************************************************************** 146 | * sel_init 147 | * Initialize selector tables and register selectors used internally. 148 | **********************************************************************/ 149 | void sel_init(size_t selrefCount) 150 | { 151 | // save this value for later 152 | SelrefCount = selrefCount; 153 | 154 | #if SUPPORT_PREOPT 155 | builtins = preoptimizedSelectors(); 156 | #endif 157 | 158 | // Register selectors used by libobjc 159 | 160 | #define s(x) SEL_##x = sel_registerNameNoLock(#x, NO) 161 | #define t(x,y) SEL_##y = sel_registerNameNoLock(#x, NO) 162 | 163 | mutex_locker_t lock(selLock); 164 | 165 | s(load); 166 | s(initialize); 167 | t(resolveInstanceMethod:, resolveInstanceMethod); 168 | t(resolveClassMethod:, resolveClassMethod); 169 | t(.cxx_construct, cxx_construct); 170 | t(.cxx_destruct, cxx_destruct); 171 | s(retain); 172 | s(release); 173 | s(autorelease); 174 | s(retainCount); 175 | s(alloc); 176 | t(allocWithZone:, allocWithZone); 177 | s(dealloc); 178 | s(copy); 179 | s(new); 180 | t(forwardInvocation:, forwardInvocation); 181 | t(_tryRetain, tryRetain); 182 | t(_isDeallocating, isDeallocating); 183 | s(retainWeakReference); 184 | s(allowsWeakReference); 185 | 186 | extern SEL FwdSel; 187 | FwdSel = sel_registerNameNoLock("forward::", NO); 188 | 189 | #undef s 190 | #undef t 191 | } 192 | 193 | __END_DECLS 194 | 195 | #endif 196 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-sel-set.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 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 | /* 25 | * objc-sel-set.h 26 | * A set of SELs used for SEL uniquing. 27 | */ 28 | 29 | #ifndef _OBJC_SEL_SET_H_ 30 | #define _OBJC_SEL_SET_H_ 31 | 32 | #if !__OBJC2__ 33 | 34 | #include 35 | #include "objc-os.h" 36 | 37 | __BEGIN_DECLS 38 | 39 | struct __objc_sel_set; 40 | 41 | extern struct __objc_sel_set *__objc_sel_set_create(size_t selrefCount); 42 | extern SEL __objc_sel_set_get(struct __objc_sel_set *sset, SEL candidate); 43 | extern void __objc_sel_set_add(struct __objc_sel_set *sset, SEL value); 44 | 45 | __END_DECLS 46 | 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-sel-set.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2004,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 | /* 25 | * objc-sel-set.h 26 | * A cut-down copy of CFSet used for SEL uniquing. 27 | */ 28 | 29 | 30 | // NOTE: even on a 64-bit system, the implementation is still limited 31 | // to 32-bit integers (like, the count), but SEL can be any size. 32 | 33 | #include 34 | #include "objc-private.h" 35 | #include "objc-sel-set.h" 36 | 37 | #if !__OBJC2__ 38 | 39 | 40 | #if !SUPPORT_MOD 41 | // mod-free power of 2 version 42 | 43 | #define CONSTRAIN(val, range) ((val) & ((range)-1)) 44 | #define SIZE 27 45 | 46 | static const uint32_t __objc_sel_set_capacities[SIZE+1] = { 47 | 3, 6, 12, 24, 48, 96, 192, 384, 768, 1536, 3072, 6144, 12288, 24576, 48 | 49152, 98304, 196608, 393216, 786432, 1572864, 3145728, 6291456, 49 | 12582912, 25165824, 50331648, 100663296, 201326592, UINT32_MAX 50 | }; 51 | 52 | static const uint32_t __objc_sel_set_buckets[SIZE] = { // powers of 2 53 | 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 54 | 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 55 | 16777216, 33554432, 67108864, 134217728, 268435456 56 | }; 57 | 58 | #else 59 | // prime version 60 | 61 | #define CONSTRAIN(val, range) ((val) % (range)) 62 | #define SIZE 42 63 | 64 | static const uint32_t __objc_sel_set_capacities[SIZE+1] = { 65 | 4, 8, 17, 29, 47, 76, 123, 199, 322, 521, 843, 1364, 2207, 3571, 66 | 5778, 9349, 15127, 24476, 39603, 64079, 103682, 167761, 271443, 67 | 439204, 710647, 1149851, 1860498, 3010349, 4870847, 7881196, 12752043, 68 | 20633239, 33385282, 54018521, 87403803, 141422324, 228826127, 370248451, 69 | 599074578, 969323029, 1568397607, 2537720636U, UINT32_MAX 70 | }; 71 | 72 | static const uint32_t __objc_sel_set_buckets[SIZE] = { // primes 73 | 5, 11, 23, 41, 67, 113, 199, 317, 521, 839, 1361, 2207, 3571, 5779, 74 | 9349, 15121, 24473, 39607, 64081, 103681, 167759, 271429, 439199, 75 | 710641, 1149857, 1860503, 3010349, 4870843, 7881193, 12752029, 20633237, 76 | 33385273, 54018521, 87403763, 141422317, 228826121, 370248451, 599074561, 77 | 969323023, 1568397599, 2537720629U, 4106118251U 78 | }; 79 | 80 | #endif 81 | 82 | struct __objc_sel_set { 83 | uint32_t _count; /* number of slots used */ 84 | uint32_t _capacity; /* maximum number of used slots */ 85 | uint32_t _bucketsNum; /* number of slots */ 86 | SEL *_buckets; /* can be NULL if not allocated yet */ 87 | }; 88 | 89 | struct __objc_sel_set_finds { 90 | SEL match; 91 | uint32_t nomatch; 92 | }; 93 | 94 | // candidate may not be 0; match is 0 if not present 95 | static struct __objc_sel_set_finds __objc_sel_set_findBuckets(struct __objc_sel_set *sset, SEL candidate) { 96 | struct __objc_sel_set_finds ret = {0, 0xffffffff}; 97 | uint32_t probe = CONSTRAIN((uint32_t)_objc_strhash((const char *)candidate), sset->_bucketsNum); 98 | for (;;) { 99 | SEL currentSel = sset->_buckets[probe]; 100 | if (!currentSel) { 101 | ret.nomatch = probe; 102 | return ret; 103 | } else if (!ret.match && 0 == strcmp((const char *)currentSel, (const char *)candidate)) { 104 | ret.match = currentSel; 105 | } 106 | probe++; 107 | if (sset->_bucketsNum <= probe) { 108 | probe -= sset->_bucketsNum; 109 | } 110 | } 111 | } 112 | 113 | // create a set with given starting capacity, will resize as needed 114 | struct __objc_sel_set *__objc_sel_set_create(size_t selrefs) { 115 | uint32_t idx; 116 | 117 | struct __objc_sel_set *sset = (struct __objc_sel_set *) 118 | malloc(sizeof(struct __objc_sel_set)); 119 | if (!sset) _objc_fatal("objc_sel_set failure"); 120 | sset->_count = 0; 121 | 122 | // heuristic to convert executable's selrefs count to table size 123 | #if TARGET_OS_IPHONE && !TARGET_OS_IOSMAC 124 | for (idx = 0; __objc_sel_set_capacities[idx] < selrefs; idx++); 125 | if (idx > 0 && selrefs < 1536) idx--; 126 | #else 127 | if (selrefs < 1024) selrefs = 1024; 128 | for (idx = 0; __objc_sel_set_capacities[idx] < selrefs; idx++); 129 | idx++; 130 | #endif 131 | 132 | if (SIZE <= idx) _objc_fatal("objc_sel_set failure"); 133 | sset->_capacity = __objc_sel_set_capacities[idx]; 134 | sset->_bucketsNum = __objc_sel_set_buckets[idx]; 135 | sset->_buckets = (SEL *)calloc(sset->_bucketsNum, sizeof(SEL)); 136 | if (!sset->_buckets) _objc_fatal("objc_sel_set failure"); 137 | return sset; 138 | } 139 | 140 | // returns 0 on failure; candidate may not be 0 141 | SEL __objc_sel_set_get(struct __objc_sel_set *sset, SEL candidate) { 142 | return __objc_sel_set_findBuckets(sset, candidate).match; 143 | } 144 | 145 | // value may not be 0; should not be called unless it is known the value is not in the set 146 | void __objc_sel_set_add(struct __objc_sel_set *sset, SEL value) { 147 | if (sset->_count == sset->_capacity) { 148 | SEL *oldbuckets = sset->_buckets; 149 | uint32_t oldnbuckets = sset->_bucketsNum; 150 | uint32_t idx, capacity = sset->_count + 1; 151 | for (idx = 0; __objc_sel_set_capacities[idx] < capacity; idx++); 152 | if (SIZE <= idx) _objc_fatal("objc_sel_set failure"); 153 | sset->_capacity = __objc_sel_set_capacities[idx]; 154 | sset->_bucketsNum = __objc_sel_set_buckets[idx]; 155 | sset->_buckets = (SEL *) 156 | calloc(sset->_bucketsNum, sizeof(SEL)); 157 | if (!sset->_buckets) _objc_fatal("objc_sel_set failure"); 158 | for (idx = 0; idx < oldnbuckets; idx++) { 159 | SEL currentSel = oldbuckets[idx]; 160 | if (currentSel) { 161 | uint32_t nomatch = __objc_sel_set_findBuckets(sset, currentSel).nomatch; 162 | sset->_buckets[nomatch] = currentSel; 163 | } 164 | } 165 | free(oldbuckets); 166 | } 167 | { 168 | uint32_t nomatch = __objc_sel_set_findBuckets(sset, value).nomatch; 169 | sset->_buckets[nomatch] = value; 170 | sset->_count++; 171 | } 172 | } 173 | 174 | 175 | // !__OBJC2__ 176 | #endif 177 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-sel-table.s: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #if __LP64__ 5 | # define PTR(x) .quad x 6 | #else 7 | # define PTR(x) .long x 8 | #endif 9 | 10 | .section __TEXT,__objc_opt_ro 11 | .align 3 12 | .private_extern __objc_opt_data 13 | __objc_opt_data: 14 | .long 15 /* table.version */ 15 | .long 0 /* table.flags */ 16 | .long 0 /* table.selopt_offset */ 17 | .long 0 /* table.headeropt_ro_offset */ 18 | .long 0 /* table.clsopt_offset */ 19 | .long 0 /* table.protocolopt_offset */ 20 | .long 0 /* table.headeropt_rw_offset */ 21 | .space PAGE_MAX_SIZE-28 22 | 23 | /* space for selopt, smax/capacity=1048576, blen/mask=524287+1 */ 24 | .space 4*(8+256) /* header and scramble */ 25 | .space 524288 /* mask tab */ 26 | .space 1048576 /* checkbytes */ 27 | .space 1048576*4 /* offsets */ 28 | 29 | /* space for clsopt, smax/capacity=131072, blen/mask=32767+1 */ 30 | .space 4*(8+256) /* header and scramble */ 31 | .space 32768 /* mask tab */ 32 | .space 131072 /* checkbytes */ 33 | .space 131072*12 /* offsets to name and class and header_info */ 34 | .space 512*8 /* some duplicate classes */ 35 | 36 | /* space for some demangled protocol names */ 37 | .space 1024 38 | 39 | /* space for protocolopt, smax/capacity=16384, blen/mask=8191+1 */ 40 | .space 4*(8+256) /* header and scramble */ 41 | .space 8192 /* mask tab */ 42 | .space 16384 /* checkbytes */ 43 | .space 16384*8 /* offsets */ 44 | 45 | /* space for 2048 header_info (RO) structures */ 46 | .space 8 + (2048*16) 47 | 48 | 49 | .section __DATA,__objc_opt_rw 50 | .align 3 51 | .private_extern __objc_opt_rw_data 52 | __objc_opt_rw_data: 53 | 54 | /* space for 2048 header_info (RW) structures */ 55 | .space 8 + (2048*8) 56 | 57 | /* space for 16384 protocols */ 58 | #if __LP64__ 59 | .space 16384 * 12 * 8 60 | #else 61 | .space 16384 * 12 * 4 62 | #endif 63 | 64 | 65 | /* section of pointers that the shared cache optimizer wants to know about */ 66 | .section __DATA,__objc_opt_ptrs 67 | .align 3 68 | 69 | #if TARGET_OS_OSX && __i386__ 70 | // old ABI 71 | .globl .objc_class_name_Protocol 72 | PTR(.objc_class_name_Protocol) 73 | #else 74 | // new ABI 75 | .globl _OBJC_CLASS_$_Protocol 76 | PTR(_OBJC_CLASS_$_Protocol) 77 | #endif 78 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-sel.mm: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012 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 | #if __OBJC2__ 25 | 26 | #include "objc-private.h" 27 | #include "objc-cache.h" 28 | 29 | #if SUPPORT_PREOPT 30 | static const objc_selopt_t *builtins = NULL; 31 | #endif 32 | 33 | 34 | static size_t SelrefCount = 0; 35 | 36 | static NXMapTable *namedSelectors; 37 | 38 | static SEL search_builtins(const char *key); 39 | 40 | 41 | /*********************************************************************** 42 | * sel_init 43 | * Initialize selector tables and register selectors used internally. 44 | **********************************************************************/ 45 | void sel_init(size_t selrefCount) 46 | { 47 | // save this value for later 48 | SelrefCount = selrefCount; 49 | 50 | #if SUPPORT_PREOPT 51 | builtins = preoptimizedSelectors(); 52 | 53 | if (PrintPreopt && builtins) { 54 | uint32_t occupied = builtins->occupied; 55 | uint32_t capacity = builtins->capacity; 56 | 57 | _objc_inform("PREOPTIMIZATION: using selopt at %p", builtins); 58 | _objc_inform("PREOPTIMIZATION: %u selectors", occupied); 59 | _objc_inform("PREOPTIMIZATION: %u/%u (%u%%) hash table occupancy", 60 | occupied, capacity, 61 | (unsigned)(occupied/(double)capacity*100)); 62 | } 63 | #endif 64 | 65 | // Register selectors used by libobjc 66 | 67 | #define s(x) SEL_##x = sel_registerNameNoLock(#x, NO) 68 | #define t(x,y) SEL_##y = sel_registerNameNoLock(#x, NO) 69 | 70 | mutex_locker_t lock(selLock); 71 | 72 | s(load); 73 | s(initialize); 74 | t(resolveInstanceMethod:, resolveInstanceMethod); 75 | t(resolveClassMethod:, resolveClassMethod); 76 | t(.cxx_construct, cxx_construct); 77 | t(.cxx_destruct, cxx_destruct); 78 | s(retain); 79 | s(release); 80 | s(autorelease); 81 | s(retainCount); 82 | s(alloc); 83 | t(allocWithZone:, allocWithZone); 84 | s(dealloc); 85 | s(copy); 86 | s(new); 87 | t(forwardInvocation:, forwardInvocation); 88 | t(_tryRetain, tryRetain); 89 | t(_isDeallocating, isDeallocating); 90 | s(retainWeakReference); 91 | s(allowsWeakReference); 92 | 93 | #undef s 94 | #undef t 95 | } 96 | 97 | 98 | static SEL sel_alloc(const char *name, bool copy) 99 | { 100 | selLock.assertLocked(); 101 | return (SEL)(copy ? strdupIfMutable(name) : name); 102 | } 103 | 104 | 105 | const char *sel_getName(SEL sel) 106 | { 107 | if (!sel) return ""; 108 | return (const char *)(const void*)sel; 109 | } 110 | 111 | 112 | BOOL sel_isMapped(SEL sel) 113 | { 114 | if (!sel) return NO; 115 | 116 | const char *name = (const char *)(void *)sel; 117 | 118 | if (sel == search_builtins(name)) return YES; 119 | 120 | mutex_locker_t lock(selLock); 121 | if (namedSelectors) { 122 | return (sel == (SEL)NXMapGet(namedSelectors, name)); 123 | } 124 | return false; 125 | } 126 | 127 | 128 | static SEL search_builtins(const char *name) 129 | { 130 | #if SUPPORT_PREOPT 131 | if (builtins) return (SEL)builtins->get(name); 132 | #endif 133 | return nil; 134 | } 135 | 136 | 137 | static SEL __sel_registerName(const char *name, bool shouldLock, bool copy) 138 | { 139 | SEL result = 0; 140 | 141 | if (shouldLock) selLock.assertUnlocked(); 142 | else selLock.assertLocked(); 143 | 144 | if (!name) return (SEL)0; 145 | 146 | result = search_builtins(name); 147 | if (result) return result; 148 | 149 | conditional_mutex_locker_t lock(selLock, shouldLock); 150 | if (namedSelectors) { 151 | result = (SEL)NXMapGet(namedSelectors, name); 152 | } 153 | if (result) return result; 154 | 155 | // No match. Insert. 156 | 157 | if (!namedSelectors) { 158 | namedSelectors = NXCreateMapTable(NXStrValueMapPrototype, 159 | (unsigned)SelrefCount); 160 | } 161 | if (!result) { 162 | result = sel_alloc(name, copy); 163 | // fixme choose a better container (hash not map for starters) 164 | NXMapInsert(namedSelectors, sel_getName(result), result); 165 | } 166 | 167 | return result; 168 | } 169 | 170 | 171 | SEL sel_registerName(const char *name) { 172 | return __sel_registerName(name, 1, 1); // YES lock, YES copy 173 | } 174 | 175 | SEL sel_registerNameNoLock(const char *name, bool copy) { 176 | return __sel_registerName(name, 0, copy); // NO lock, maybe copy 177 | } 178 | 179 | 180 | // 2001/1/24 181 | // the majority of uses of this function (which used to return NULL if not found) 182 | // did not check for NULL, so, in fact, never return NULL 183 | // 184 | SEL sel_getUid(const char *name) { 185 | return __sel_registerName(name, 2, 1); // YES lock, YES copy 186 | } 187 | 188 | 189 | BOOL sel_isEqual(SEL lhs, SEL rhs) 190 | { 191 | return bool(lhs == rhs); 192 | } 193 | 194 | 195 | #endif 196 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-sync.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002, 2006 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_SNYC_H_ 25 | #define __OBJC_SNYC_H_ 26 | 27 | #include 28 | 29 | 30 | /** 31 | * Begin synchronizing on 'obj'. 32 | * Allocates recursive pthread_mutex associated with 'obj' if needed. 33 | * 34 | * @param obj The object to begin synchronizing on. 35 | * 36 | * @return OBJC_SYNC_SUCCESS once lock is acquired. 37 | */ 38 | OBJC_EXPORT int 39 | objc_sync_enter(id _Nonnull obj) 40 | OBJC_AVAILABLE(10.3, 2.0, 9.0, 1.0, 2.0); 41 | 42 | /** 43 | * End synchronizing on 'obj'. 44 | * 45 | * @param obj The object to end synchronizing on. 46 | * 47 | * @return OBJC_SYNC_SUCCESS or OBJC_SYNC_NOT_OWNING_THREAD_ERROR 48 | */ 49 | OBJC_EXPORT int 50 | objc_sync_exit(id _Nonnull obj) 51 | OBJC_AVAILABLE(10.3, 2.0, 9.0, 1.0, 2.0); 52 | 53 | enum { 54 | OBJC_SYNC_SUCCESS = 0, 55 | OBJC_SYNC_NOT_OWNING_THREAD_ERROR = -1 56 | }; 57 | 58 | 59 | #endif // __OBJC_SYNC_H_ 60 | -------------------------------------------------------------------------------- /objc4-750/runtime/objc-weak.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2011 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_WEAK_H_ 25 | #define _OBJC_WEAK_H_ 26 | 27 | #include 28 | #include "objc-config.h" 29 | 30 | __BEGIN_DECLS 31 | 32 | /* 33 | The weak table is a hash table governed by a single spin lock. 34 | An allocated blob of memory, most often an object, but under GC any such 35 | allocation, may have its address stored in a __weak marked storage location 36 | through use of compiler generated write-barriers or hand coded uses of the 37 | register weak primitive. Associated with the registration can be a callback 38 | block for the case when one of the allocated chunks of memory is reclaimed. 39 | The table is hashed on the address of the allocated memory. When __weak 40 | marked memory changes its reference, we count on the fact that we can still 41 | see its previous reference. 42 | 43 | So, in the hash table, indexed by the weakly referenced item, is a list of 44 | all locations where this address is currently being stored. 45 | 46 | For ARC, we also keep track of whether an arbitrary object is being 47 | deallocated by briefly placing it in the table just prior to invoking 48 | dealloc, and removing it via objc_clear_deallocating just prior to memory 49 | reclamation. 50 | 51 | */ 52 | 53 | // The address of a __weak variable. 54 | // These pointers are stored disguised so memory analysis tools 55 | // don't see lots of interior pointers from the weak table into objects. 56 | typedef DisguisedPtr weak_referrer_t; 57 | 58 | #if __LP64__ 59 | #define PTR_MINUS_2 62 60 | #else 61 | #define PTR_MINUS_2 30 62 | #endif 63 | 64 | /** 65 | * The internal structure stored in the weak references table. 66 | * It maintains and stores 67 | * a hash set of weak references pointing to an object. 68 | * If out_of_line_ness != REFERRERS_OUT_OF_LINE then the set 69 | * is instead a small inline array. 70 | */ 71 | #define WEAK_INLINE_COUNT 4 72 | 73 | // out_of_line_ness field overlaps with the low two bits of inline_referrers[1]. 74 | // inline_referrers[1] is a DisguisedPtr of a pointer-aligned address. 75 | // The low two bits of a pointer-aligned DisguisedPtr will always be 0b00 76 | // (disguised nil or 0x80..00) or 0b11 (any other address). 77 | // Therefore out_of_line_ness == 0b10 is used to mark the out-of-line state. 78 | #define REFERRERS_OUT_OF_LINE 2 79 | 80 | struct weak_entry_t { 81 | DisguisedPtr referent; 82 | union { 83 | struct { 84 | weak_referrer_t *referrers; 85 | uintptr_t out_of_line_ness : 2; 86 | uintptr_t num_refs : PTR_MINUS_2; 87 | uintptr_t mask; 88 | uintptr_t max_hash_displacement; 89 | }; 90 | struct { 91 | // out_of_line_ness field is low bits of inline_referrers[1] 92 | weak_referrer_t inline_referrers[WEAK_INLINE_COUNT]; 93 | }; 94 | }; 95 | 96 | bool out_of_line() { 97 | return (out_of_line_ness == REFERRERS_OUT_OF_LINE); 98 | } 99 | 100 | weak_entry_t& operator=(const weak_entry_t& other) { 101 | memcpy(this, &other, sizeof(other)); 102 | return *this; 103 | } 104 | 105 | weak_entry_t(objc_object *newReferent, objc_object **newReferrer) 106 | : referent(newReferent) 107 | { 108 | inline_referrers[0] = newReferrer; 109 | for (int i = 1; i < WEAK_INLINE_COUNT; i++) { 110 | inline_referrers[i] = nil; 111 | } 112 | } 113 | }; 114 | 115 | /** 116 | * The global weak references table. Stores object ids as keys, 117 | * and weak_entry_t structs as their values. 118 | */ 119 | struct weak_table_t { 120 | weak_entry_t *weak_entries; 121 | size_t num_entries; 122 | uintptr_t mask; 123 | uintptr_t max_hash_displacement; 124 | }; 125 | 126 | /// Adds an (object, weak pointer) pair to the weak table. 127 | id weak_register_no_lock(weak_table_t *weak_table, id referent, 128 | id *referrer, bool crashIfDeallocating); 129 | 130 | /// Removes an (object, weak pointer) pair from the weak table. 131 | void weak_unregister_no_lock(weak_table_t *weak_table, id referent, id *referrer); 132 | 133 | #if DEBUG 134 | /// Returns true if an object is weakly referenced somewhere. 135 | bool weak_is_registered_no_lock(weak_table_t *weak_table, id referent); 136 | #endif 137 | 138 | /// Called on object destruction. Sets all remaining weak pointers to nil. 139 | void weak_clear_no_lock(weak_table_t *weak_table, id referent); 140 | 141 | __END_DECLS 142 | 143 | #endif /* _OBJC_WEAK_H_ */ 144 | -------------------------------------------------------------------------------- /objc4-750/runtime/objcrt.c: -------------------------------------------------------------------------------- 1 | #define WIN32_LEAN_AND_MEAN 2 | #include 3 | #include 4 | #include 5 | #include "objcrt.h" 6 | 7 | // Boundary symbols for metadata sections 8 | 9 | #pragma section(".objc_module_info$A",long,read,write) 10 | #pragma data_seg(".objc_module_info$A") 11 | static uintptr_t __objc_modStart = 0; 12 | #pragma section(".objc_module_info$C",long,read,write) 13 | #pragma data_seg(".objc_module_info$C") 14 | static uintptr_t __objc_modEnd = 0; 15 | 16 | #pragma section(".objc_protocol$A",long,read,write) 17 | #pragma data_seg(".objc_protocol$A") 18 | static uintptr_t __objc_protoStart = 0; 19 | #pragma section(".objc_protocol$C",long,read,write) 20 | #pragma data_seg(".objc_protocol$C") 21 | static uintptr_t __objc_protoEnd = 0; 22 | 23 | #pragma section(".objc_image_info$A",long,read,write) 24 | #pragma data_seg(".objc_image_info$A") 25 | static uintptr_t __objc_iiStart = 0; 26 | #pragma section(".objc_image_info$C",long,read,write) 27 | #pragma data_seg(".objc_image_info$C") 28 | static uintptr_t __objc_iiEnd = 0; 29 | 30 | #pragma section(".objc_message_refs$A",long,read,write) 31 | #pragma data_seg(".objc_message_refs$A") 32 | static uintptr_t __objc_selrefsStart = 0; 33 | #pragma section(".objc_message_refs$C",long,read,write) 34 | #pragma data_seg(".objc_message_refs$C") 35 | static uintptr_t __objc_selrefsEnd = 0; 36 | 37 | #pragma section(".objc_class_refs$A",long,read,write) 38 | #pragma data_seg(".objc_class_refs$A") 39 | static uintptr_t __objc_clsrefsStart = 0; 40 | #pragma section(".objc_class_refs$C",long,read,write) 41 | #pragma data_seg(".objc_class_refs$C") 42 | static uintptr_t __objc_clsrefsEnd = 0; 43 | 44 | #pragma data_seg() 45 | 46 | // Merge all metadata into .data 47 | // fixme order these by usage? 48 | #pragma comment(linker, "/MERGE:.objc_module_info=.data") 49 | #pragma comment(linker, "/MERGE:.objc_protocol=.data") 50 | #pragma comment(linker, "/MERGE:.objc_image_info=.data") 51 | #pragma comment(linker, "/MERGE:.objc_message_refs=.data") 52 | #pragma comment(linker, "/MERGE:.objc_class_refs=.data") 53 | 54 | 55 | // Image initializers 56 | 57 | static void *__hinfo = NULL; // cookie from runtime 58 | extern IMAGE_DOS_HEADER __ImageBase; // this image's header 59 | 60 | static int __objc_init(void) 61 | { 62 | objc_sections sections = { 63 | 5, 64 | &__objc_modStart, &__objc_modEnd, 65 | &__objc_protoStart, &__objc_protoEnd, 66 | &__objc_iiStart, &__objc_iiEnd, 67 | &__objc_selrefsStart, &__objc_selrefsEnd, 68 | &__objc_clsrefsStart, &__objc_clsrefsEnd, 69 | }; 70 | __hinfo = _objc_init_image((HMODULE)&__ImageBase, §ions); 71 | return 0; 72 | } 73 | 74 | static void __objc_unload(void) 75 | { 76 | _objc_unload_image((HMODULE)&__ImageBase, __hinfo); 77 | } 78 | 79 | static int __objc_load(void) 80 | { 81 | _objc_load_image((HMODULE)&__ImageBase, __hinfo); 82 | return 0; 83 | } 84 | 85 | // run _objc_init_image ASAP 86 | #pragma section(".CRT$XIAA",long,read,write) 87 | #pragma data_seg(".CRT$XIAA") 88 | static void *__objc_init_fn = &__objc_init; 89 | 90 | // run _objc_load_image (+load methods) after all other initializers; 91 | // otherwise constant NSStrings are not initialized yet 92 | #pragma section(".CRT$XCUO",long,read,write) 93 | #pragma data_seg(".CRT$XCUO") 94 | static void *__objc_load_fn = &__objc_load; 95 | 96 | // _objc_unload_image is called by atexit(), not by an image terminator 97 | 98 | #pragma data_seg() 99 | -------------------------------------------------------------------------------- /objc4-750/runtime/objcrt.h: -------------------------------------------------------------------------------- 1 | #ifndef _OBJC_RT_H_ 2 | #define _OBJC_RT_H_ 3 | 4 | #include 5 | 6 | 7 | typedef struct { 8 | int count; // number of pointer pairs that follow 9 | void *modStart; 10 | void *modEnd; 11 | void *protoStart; 12 | void *protoEnd; 13 | void *iiStart; 14 | void *iiEnd; 15 | void *selrefsStart; 16 | void *selrefsEnd; 17 | void *clsrefsStart; 18 | void *clsrefsEnd; 19 | } objc_sections; 20 | 21 | OBJC_EXPORT void *_objc_init_image(HMODULE image, const objc_sections *sects); 22 | OBJC_EXPORT void _objc_load_image(HMODULE image, void *hinfo); 23 | OBJC_EXPORT void _objc_unload_image(HMODULE image, void *hinfo); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /objc4-750/unexported_symbols: -------------------------------------------------------------------------------- 1 | .objc_class_name___IncompleteProtocol 2 | __Znam 3 | __ZnamRKSt9nothrow_t 4 | __Znwm 5 | __ZnwmRKSt9nothrow_t 6 | __ZdaPv 7 | __ZdaPvRKSt9nothrow_t 8 | __ZdlPv 9 | __ZdlPvRKSt9nothrow_t 10 | __ZTISt9bad_alloc 11 | __ZTISt9exception 12 | __ZTISt11logic_error 13 | __ZTISt12length_error 14 | __ZTSSt9bad_alloc 15 | __ZTSSt9exception 16 | __ZTSSt11logic_error 17 | __ZTSSt12length_error 18 | -------------------------------------------------------------------------------- /objc4-750/version.bat: -------------------------------------------------------------------------------- 1 | :: version.bat 2 | :: Writes version numbers from B&I into version.h for use by version.rc. 3 | 4 | @ECHO OFF 5 | 6 | :: Set default values for environment variables if not set by B&I 7 | IF "%OBJROOT%"=="" SET OBJROOT=. 8 | IF "%RC_PROJECTSOURCEVERSION%"=="" SET RC_PROJECTSOURCEVERSION=0.0 9 | IF "%RC_PROJECTBUILDVERSION%"=="" SET RC_PROJECTBUILDVERSION=0 10 | 11 | :: Get version numbers from environment variables 12 | SET major=1 13 | SET patch=0 14 | FOR /F "tokens=1* eol= delims=." %%i IN ("%RC_PROJECTSOURCEVERSION%") DO ( 15 | SET minor=%%i 16 | IF NOT "%%j"=="" SET patch=%%j 17 | ) 18 | SET build=%RC_PROJECTBUILDVERSION% 19 | 20 | ECHO version %major% . %minor% . %patch% . %build% 21 | 22 | :: Write version.h 23 | ECHO // This file is automatically generated by version.bat. > "%OBJROOT%\version.h" 24 | ECHO // DO NOT EDIT >> "%OBJROOT%\version.h" 25 | ECHO #define major %major% >> "%OBJROOT%\version.h" 26 | ECHO #define minor %minor% >> "%OBJROOT%\version.h" 27 | ECHO #define patch %patch% >> "%OBJROOT%\version.h" 28 | ECHO #define build %build% >> "%OBJROOT%\version.h" 29 | ECHO #define string "%major%,%minor%,%patch%,%build%" >> "%OBJROOT%\version.h" 30 | -------------------------------------------------------------------------------- /objc4-750/version.rc: -------------------------------------------------------------------------------- 1 | #include "Winver.h" 2 | 3 | // built by version.bat; sets variables major, minor, patch, build, string 4 | #include "version.h" 5 | 6 | VS_VERSION_INFO VERSIONINFO 7 | FILEVERSION major,minor,patch,build 8 | PRODUCTVERSION major,minor,patch,build 9 | FILEFLAGSMASK 0x17L 10 | #ifdef _DEBUG 11 | FILEFLAGS VS_FF_DEBUG 12 | #else 13 | FILEFLAGS 0x0L 14 | #endif 15 | FILEOS VOS_NT_WINDOWS32 16 | FILETYPE VFT_DLL 17 | FILESUBTYPE VFT2_UNKNOWN 18 | BEGIN 19 | BLOCK "StringFileInfo" 20 | BEGIN 21 | BLOCK "040904b0" 22 | BEGIN 23 | VALUE "CompanyName", "Apple Inc." 24 | VALUE "FileDescription", "Objective-C Runtime Library" 25 | VALUE "FileVersion", string 26 | VALUE "ProductVersion", string 27 | VALUE "ProductName", "objc4" 28 | VALUE "InternalName", "objc4" 29 | VALUE "LegalCopyright", "Copyright (C) 2007-2009, Apple Inc." 30 | VALUE "OriginalFilename", "objc.dll" 31 | END 32 | END 33 | BLOCK "VarFileInfo" 34 | BEGIN 35 | VALUE "Translation", 0x409, 1200 36 | END 37 | END 38 | 39 | --------------------------------------------------------------------------------