22#if !defined(__has_feature) || !__has_feature(nullability)
31typedef uint32_t (*_Nonnull objc_hashtable_hash_func)(
32 const void *_Nonnull key);
33typedef bool (*_Nonnull objc_hashtable_equal_func)(
const void *_Nonnull key1,
34 const void *_Nonnull key2);
38 Class _Nullable superclass;
39 const char *_Nonnull name;
40 unsigned long version;
43 struct objc_ivar_list *_Nullable ivars;
44 struct objc_method_list *_Nullable methodList;
45 struct objc_dtable *_Nullable dTable;
46 Class _Nullable *_Nullable subclassList;
47 void *_Nullable siblingClass;
48 struct objc_protocol_list *_Nullable protocols;
49 void *_Nullable GCObjectType;
50 unsigned long ABIVersion;
51 int32_t *_Nonnull *_Nullable ivarOffsets;
52 struct objc_property_list *_Nullable propertyList;
55enum _objc_class_info {
56 _OBJC_CLASS_INFO_CLASS = 0x0001,
57 _OBJC_CLASS_INFO_METACLASS = 0x0002,
58 _OBJC_CLASS_INFO_NEW_ABI = 0x0010,
59 _OBJC_CLASS_INFO_SETUP = 0x0100,
60 _OBJC_CLASS_INFO_LOADED = 0x0200,
61 _OBJC_CLASS_INFO_DTABLE = 0x0400,
62 _OBJC_CLASS_INFO_INITIALIZED = 0x0800,
63 _OBJC_CLASS_INFO_RUNTIME_RR = 0x1000
72 const char *_Nullable typeEncoding;
76 struct objc_selector selector;
77 IMP _Nonnull implementation;
80struct objc_method_list {
81 struct objc_method_list *_Nullable next;
83 struct objc_method methods[1];
87 const char *_Nonnull categoryName;
88 const char *_Nonnull className;
89 struct objc_method_list *_Nullable instanceMethods;
90 struct objc_method_list *_Nullable classMethods;
91 struct objc_protocol_list *_Nullable protocols;
95 const char *_Nonnull name;
96 const char *_Nonnull typeEncoding;
100struct objc_ivar_list {
102 struct objc_ivar ivars[1];
105struct objc_method_description {
106 const char *_Nonnull name;
107 const char *_Nonnull typeEncoding;
110struct objc_method_description_list {
112 struct objc_method_description list[1];
115struct objc_protocol_list {
116 struct objc_protocol_list *_Nullable next;
118 Protocol *__unsafe_unretained _Nonnull list[1];
121#if __has_attribute(__objc_root_class__)
122__attribute__((__objc_root_class__))
128 const char *_Nonnull name;
129 struct objc_protocol_list *_Nullable protocolList;
130 struct objc_method_description_list *_Nullable instanceMethods;
131 struct objc_method_description_list *_Nullable classMethods;
135enum _objc_property_attributes {
136 _OBJC_PROPERTY_READONLY = 0x01,
137 _OBJC_PROPERTY_GETTER = 0x02,
138 _OBJC_PROPERTY_ASSIGN = 0x04,
139 _OBJC_PROPERTY_READWRITE = 0x08,
140 _OBJC_PROPERTY_RETAIN = 0x10,
141 _OBJC_PROPERTY_COPY = 0x20,
142 _OBJC_PROPERTY_NONATOMIC = 0x40,
143 _OBJC_PROPERTY_SETTER = 0x80
146enum _objc_property_extended_attributes {
147 _OBJC_PROPERTY_SYNTHESIZED = 0x1,
148 _OBJC_PROPERTY_DYNAMIC = 0x2,
149 _OBJC_PROPERTY_PROTOCOL = 0x3,
150 _OBJC_PROPERTY_ATOMIC = 0x4,
151 _OBJC_PROPERTY_WEAK = 0x8,
152 _OBJC_PROPERTY_STRONG = 0x10,
153 _OBJC_PROPERTY_UNSAFE_UNRETAINED = 0x20
156struct objc_property {
157 const char *_Nonnull name;
158 unsigned char attributes, extendedAttributes;
160 const char *_Nullable name;
161 const char *_Nullable typeEncoding;
165struct objc_property_list {
167 struct objc_property_list *_Nullable next;
168 struct objc_property properties[1];
171struct objc_static_instances {
172 const char *_Nonnull className;
173 id _Nullable instances[1];
177 unsigned long unknown;
178 struct objc_selector *_Nullable selectorRefs;
179 uint16_t classDefsCount;
180 uint16_t categoryDefsCount;
181 void *_Nonnull defs[1];
185 unsigned long version;
187 const char *_Nullable name;
188 struct objc_symtab *_Nonnull symtab;
191struct objc_hashtable_bucket {
192 const void *_Nonnull key, *_Nonnull object;
196struct objc_hashtable {
197 objc_hashtable_hash_func hash;
198 objc_hashtable_equal_func equal;
199 uint32_t count, size;
200 struct objc_hashtable_bucket *_Nonnull *_Nullable data;
203struct objc_sparsearray {
204 struct objc_sparsearray_data {
205 void *_Nullable next[256];
211 struct objc_dtable_level2 {
213 struct objc_dtable_level3 {
214 IMP _Nullable buckets[256];
215 } *_Nonnull buckets[256];
217 IMP _Nullable buckets[256];
219 } *_Nonnull buckets[256];
222#if defined(OBJC_COMPILING_AMIGA_LIBRARY) || \
223 defined(OBJC_COMPILING_AMIGA_LINKLIB)
224struct objc_linklib_context {
225 void *_Nullable (*_Nonnull malloc)(size_t);
226 void *_Nullable (*_Nonnull calloc)(size_t, size_t);
227 void *_Nullable (*_Nonnull realloc)(
void *_Nullable, size_t);
228 void (*_Nonnull free)(
void *_Nullable);
229 int (*_Nonnull vfprintf)(FILE *_Nonnull,
const char *_Nonnull, va_list);
230 int (*_Nonnull fflush)(FILE *_Nonnull);
231 void (*_Nonnull abort)(void);
232 int (*_Nonnull _Unwind_RaiseException)(
void *_Nonnull);
233 void (*_Nonnull _Unwind_DeleteException)(
void *_Nonnull);
234 void *_Nullable (*_Nonnull _Unwind_GetLanguageSpecificData)(
236 uintptr_t (*_Nonnull _Unwind_GetRegionStart)(
void *_Nonnull);
237 uintptr_t (*_Nonnull _Unwind_GetDataRelBase)(
void *_Nonnull);
238 uintptr_t (*_Nonnull _Unwind_GetTextRelBase)(
void *_Nonnull);
239 uintptr_t (*_Nonnull _Unwind_GetIP)(
void *_Nonnull);
240 uintptr_t (*_Nonnull _Unwind_GetGR)(
void *_Nonnull, int);
241 void (*_Nonnull _Unwind_SetIP)(
void *_Nonnull, uintptr_t);
242 void (*_Nonnull _Unwind_SetGR)(
void *_Nonnull, int, uintptr_t);
243 void (*_Nonnull _Unwind_Resume)(
void *_Nonnull);
244 void (*_Nonnull __register_frame)(
void *_Nonnull);
245 void (*_Nonnull __deregister_frame)(
void *_Nonnull);
248extern bool objc_init(
unsigned int version,
249 struct objc_linklib_context *_Nonnull ctx);
250extern void class_registerAlias_np(Class _Nonnull class_,
251 const char *_Nonnull name);
253extern const char *_Nullable _class_getMethodTypeEncoding(Class _Nullable
class,
254 SEL _Nonnull selector);
258extern void _objc_registerAllCategories(
struct objc_symtab *_Nonnull)
259 OF_VISIBILITY_INTERNAL;
260extern struct objc_category *_Nullable *_Nullable
261 _objc_categoriesForClass(Class _Nonnull) OF_VISIBILITY_INTERNAL;
262extern void _objc_processCategoriesLoadQueue(
void) OF_VISIBILITY_INTERNAL;
263extern void _objc_unregisterAllCategories(
void) OF_VISIBILITY_INTERNAL;
264extern void _objc_initializeClass(Class _Nonnull) OF_VISIBILITY_INTERNAL;
265extern void _objc_updateDTable(Class _Nonnull) OF_VISIBILITY_INTERNAL;
266extern void _objc_registerAllClasses(
struct objc_symtab *_Nonnull)
267 OF_VISIBILITY_INTERNAL;
268extern Class _Nullable _objc_classnameToClass(
const char *_Nonnull,
bool)
269 OF_VISIBILITY_INTERNAL;
270extern void _objc_unregisterClass(Class _Nonnull) OF_VISIBILITY_INTERNAL;
271extern void _objc_unregisterAllClasses(
void) OF_VISIBILITY_INTERNAL;
272extern uint32_t _objc_string_hash(
const void *_Nonnull) OF_VISIBILITY_INTERNAL;
273extern bool _objc_string_equal(
const void *_Nonnull,
const void *_Nonnull)
274 OF_VISIBILITY_INTERNAL;
275extern struct objc_hashtable *_Nonnull _objc_hashtable_new(
276 objc_hashtable_hash_func, objc_hashtable_equal_func, uint32_t)
277 OF_VISIBILITY_INTERNAL;
278extern struct objc_hashtable_bucket _objc_deletedBucket OF_VISIBILITY_INTERNAL;
279extern void _objc_hashtable_set(
struct objc_hashtable *_Nonnull,
280 const void *_Nonnull,
const void *_Nonnull) OF_VISIBILITY_INTERNAL;
281extern void *_Nullable _objc_hashtable_get(
struct objc_hashtable *_Nonnull,
282 const void *_Nonnull) OF_VISIBILITY_INTERNAL;
283extern void _objc_hashtable_delete(
struct objc_hashtable *_Nonnull,
284 const void *_Nonnull) OF_VISIBILITY_INTERNAL;
285extern void _objc_hashtable_free(
struct objc_hashtable *_Nonnull)
286 OF_VISIBILITY_INTERNAL;
287extern void _objc_registerSelector(
struct objc_selector *_Nonnull)
288 OF_VISIBILITY_INTERNAL;
289extern void _objc_registerAllSelectors(
struct objc_symtab *_Nonnull)
290 OF_VISIBILITY_INTERNAL;
291extern void _objc_unregisterAllSelectors(
void) OF_VISIBILITY_INTERNAL;
292extern struct objc_sparsearray *_Nonnull _objc_sparsearray_new(uint8_t)
293 OF_VISIBILITY_INTERNAL;
294extern void *_Nullable _objc_sparsearray_get(
struct objc_sparsearray *_Nonnull,
295 uintptr_t) OF_VISIBILITY_INTERNAL;
296extern void _objc_sparsearray_set(
struct objc_sparsearray *_Nonnull, uintptr_t,
297 void *_Nullable) OF_VISIBILITY_INTERNAL;
298extern void _objc_sparsearray_free(
struct objc_sparsearray *_Nonnull)
299 OF_VISIBILITY_INTERNAL;
300extern struct objc_dtable *_Nonnull _objc_dtable_new(
void)
301 OF_VISIBILITY_INTERNAL;
302extern void _objc_dtable_copy(
struct objc_dtable *_Nonnull,
303 struct objc_dtable *_Nonnull) OF_VISIBILITY_INTERNAL;
304extern void _objc_dtable_set(
struct objc_dtable *_Nonnull, uint32_t,
305 IMP _Nullable) OF_VISIBILITY_INTERNAL;
306extern void _objc_dtable_free(
struct objc_dtable *_Nonnull)
307 OF_VISIBILITY_INTERNAL;
308extern void _objc_dtable_cleanup(
void) OF_VISIBILITY_INTERNAL;
309extern void _objc_initStaticInstances(
struct objc_symtab *_Nonnull)
310 OF_VISIBILITY_INTERNAL;
311extern void _objc_forgetPendingStaticInstances(
void) OF_VISIBILITY_INTERNAL;
312extern void _objc_zeroWeakReferences(
id _Nonnull) OF_VISIBILITY_INTERNAL;
313extern Class _Nullable _object_getTaggedPointerClass(
id _Nonnull)
314 OF_VISIBILITY_INTERNAL;
315#ifdef OF_HAVE_THREADS
316extern void _objc_globalMutex_lock(
void) OF_VISIBILITY_INTERNAL;
317extern void _objc_globalMutex_unlock(
void) OF_VISIBILITY_INTERNAL;
318extern void _objc_globalMutex_free(
void) OF_VISIBILITY_INTERNAL;
320# define _objc_globalMutex_lock()
321# define _objc_globalMutex_unlock()
322# define _objc_globalMutex_free()
324extern char *_Nullable _objc_strdup(
const char *_Nonnull
string)
325 OF_VISIBILITY_INTERNAL;
327static OF_INLINE
IMP _Nullable
328_objc_dtable_get(
const struct objc_dtable *_Nonnull dtable, uint32_t idx)
331 uint8_t i = idx >> 16;
332 uint8_t j = idx >> 8;
335 return dtable->buckets[i]->buckets[j]->buckets[k];
337 uint8_t i = idx >> 8;
340 return dtable->buckets[i]->buckets[j];
344extern void OF_NO_RETURN_FUNC _objc_error(
const char *_Nonnull title,
345 const char *_Nonnull format, ...) OF_VISIBILITY_INTERNAL;
346#define _OBJC_ERROR(...) \
347 _objc_error("ObjFWRT @ " __FILE__ ":" OF_STRINGIFY(__LINE__), \
351# if defined(OF_AMD64) || defined(OF_X86) || \
352 defined(OF_POWERPC64) || defined(OF_POWERPC) || \
353 defined(OF_ARM64) || defined(OF_ARM) || \
354 defined(OF_MIPS64_N64) || defined(OF_MIPS) || \
355 defined(OF_SPARC64) || defined(OF_SPARC) || \
356 defined(OF_RISCV64) || defined(OF_LOONGARCH64)
357# define OF_ASM_LOOKUP
359#elif defined(OF_MACH_O)
360# if defined(OF_AMD64)
361# define OF_ASM_LOOKUP
363#elif defined(OF_WINDOWS)
364# if defined(OF_AMD64) || defined(OF_X86) || defined(OF_ARM64)
365# define OF_ASM_LOOKUP
369@interface DummyObject
374@property (readonly, nonatomic)
bool allowsWeakReference;
377+ (bool)resolveClassMethod: (nonnull
SEL)selector;
378+ (bool)resolveInstanceMethod: (nonnull
SEL)selector;
382- (nonnull id)autorelease;
384- (nonnull id)mutableCopy;
385- (bool)retainWeakReference;
386- (void)_usesRuntimeRR;
id(* IMP)(id object, SEL selector,...)
A method implementation.
Definition ObjFWRT.h:146
const struct objc_protocol * Protocol
A protocol.
Definition ObjFWRT.h:117
A pointer to a class.
Definition private.h:36
A pointer to any object.
Definition private.h:66