Index: src/OFBlock.m ================================================================== --- src/OFBlock.m +++ src/OFBlock.m @@ -69,43 +69,46 @@ - (void)release; @end #ifdef OF_OBJFW_RUNTIME /* Begin of ObjC module */ -static struct objc_abi_class _NSConcreteStackBlock_metaclass = { - (struct objc_abi_class *)(void *)"OFBlock", "OFBlock", "OFStackBlock", - 8, OBJC_CLASS_INFO_METACLASS, sizeof(struct objc_abi_class), NULL, NULL -}; - -struct objc_abi_class _NSConcreteStackBlock = { - &_NSConcreteStackBlock_metaclass, "OFBlock", "OFStackBlock", - 8, OBJC_CLASS_INFO_CLASS, sizeof(of_block_literal_t), NULL, NULL -}; - -static struct objc_abi_class _NSConcreteGlobalBlock_metaclass = { - (struct objc_abi_class *)(void *)"OFBlock", "OFBlock", "OFGlobalBlock", - 8, OBJC_CLASS_INFO_METACLASS, sizeof(struct objc_abi_class), NULL, NULL -}; - -struct objc_abi_class _NSConcreteGlobalBlock = { - &_NSConcreteGlobalBlock_metaclass, "OFBlock", "OFGlobalBlock", - 8, OBJC_CLASS_INFO_CLASS, sizeof(of_block_literal_t), NULL, NULL -}; - -static struct objc_abi_class _NSConcreteMallocBlock_metaclass = { - (struct objc_abi_class *)(void *)"OFBlock", "OFBlock", "OFMallocBlock", - 8, OBJC_CLASS_INFO_METACLASS, sizeof(struct objc_abi_class), NULL, NULL -}; - -struct objc_abi_class _NSConcreteMallocBlock = { - &_NSConcreteMallocBlock_metaclass, "OFBlock", "OFMallocBlock", - 8, OBJC_CLASS_INFO_CLASS, sizeof(of_block_literal_t), NULL, NULL +static struct objc_class _NSConcreteStackBlock_metaclass = { + (Class)(void *)"OFObject", (Class)(void *)"OFBlock", "OFStackBlock", 8, + OBJC_CLASS_INFO_METACLASS, sizeof(struct objc_class), NULL, NULL +}; + +struct objc_class _NSConcreteStackBlock = { + &_NSConcreteStackBlock_metaclass, (Class)(void *)"OFBlock", + "OFStackBlock", 8, OBJC_CLASS_INFO_CLASS, sizeof(of_block_literal_t), + NULL, NULL +}; + +static struct objc_class _NSConcreteGlobalBlock_metaclass = { + (Class)(void *)"OFObject", (Class)(void *)"OFBlock", "OFGlobalBlock", 8, + OBJC_CLASS_INFO_METACLASS, sizeof(struct objc_class), NULL, NULL +}; + +struct objc_class _NSConcreteGlobalBlock = { + &_NSConcreteGlobalBlock_metaclass, (Class)(void *)"OFBlock", + "OFGlobalBlock", 8, OBJC_CLASS_INFO_CLASS, sizeof(of_block_literal_t), + NULL, NULL +}; + +static struct objc_class _NSConcreteMallocBlock_metaclass = { + (Class)(void *)"OFObject", (Class)(void *)"OFBlock", "OFMallocBlock", 8, + OBJC_CLASS_INFO_METACLASS, sizeof(struct objc_class), NULL, NULL +}; + +struct objc_class _NSConcreteMallocBlock = { + &_NSConcreteMallocBlock_metaclass, (Class)(void *)"OFBlock", + "OFMallocBlock", 8, OBJC_CLASS_INFO_CLASS, sizeof(of_block_literal_t), + NULL, NULL }; static struct { unsigned long unknown; - struct objc_abi_selector *selectorRefs; + struct objc_selector *selectorRefs; uint16_t classDefsCount, categoryDefsCount; void *defs[4]; } symtab = { 0, NULL, 3, 0, { @@ -112,12 +115,12 @@ &_NSConcreteStackBlock, &_NSConcreteGlobalBlock, &_NSConcreteMallocBlock, NULL } }; -static struct objc_abi_module module = { - 8, sizeof(module), NULL, (struct objc_abi_symtab *)&symtab +static struct objc_module module = { + 8, sizeof(module), NULL, (struct objc_symtab *)&symtab }; OF_CONSTRUCTOR() { __objc_exec_class(&module); Index: src/block.h ================================================================== --- src/block.h +++ src/block.h @@ -48,12 +48,12 @@ /* * Clang has implicit declarations for these, but they are dllimport. When * compiling ObjFW itself or using it as a static library, these need to be * dllexport. Interestingly, this still works when using it as a shared library. */ -extern __declspec(dllexport) struct objc_abi_class _NSConcreteStackBlock; -extern __declspec(dllexport) struct objc_abi_class _NSConcreteGlobalBlock; +extern __declspec(dllexport) struct objc_class _NSConcreteStackBlock; +extern __declspec(dllexport) struct objc_class _NSConcreteGlobalBlock; extern __declspec(dllexport) void _Block_object_assign(void *, const void *, const int); extern __declspec(dllexport) void _Block_object_dispose(const void *, const int); # endif Index: src/runtime/ObjFWRT.h ================================================================== --- src/runtime/ObjFWRT.h +++ src/runtime/ObjFWRT.h @@ -59,11 +59,11 @@ #define NO false typedef struct objc_class *Class; typedef struct objc_object *id; typedef const struct objc_selector *SEL; -typedef struct objc_ivar *Ivar; +typedef const struct objc_ivar *Ivar; #if !defined(__wii__) && !defined(__amigaos__) typedef bool BOOL; #endif typedef id _Nullable (*IMP)(id _Nonnull, SEL _Nonnull, ...); typedef void (*objc_uncaught_exception_handler_t)(id _Nullable); @@ -269,11 +269,12 @@ * Used by the compiler, but can also be called manually. * * These declarations are also required to prevent Clang's implicit * declarations which include __declspec(dllimport) on Windows. */ -extern void __objc_exec_class(void *_Nonnull module); +struct objc_module; +extern void __objc_exec_class(struct objc_module *_Nonnull module); extern IMP _Nonnull objc_msg_lookup(id _Nullable object, SEL _Nonnull selector); extern IMP _Nonnull objc_msg_lookup_stret(id _Nullable object, SEL _Nonnull selector); extern IMP _Nonnull objc_msg_lookup_super(struct objc_super *_Nonnull super, SEL _Nonnull selector); Index: src/runtime/amiga-glue.m ================================================================== --- src/runtime/amiga-glue.m +++ src/runtime/amiga-glue.m @@ -53,13 +53,13 @@ return objc_init(version, libc, stdout_, stderr_); } void __saveds -glue___objc_exec_class PPC_PARAMS(void *module) +glue___objc_exec_class PPC_PARAMS(struct objc_module *module) { - M68K_ARG(void *, module, a0) + M68K_ARG(struct objc_module *, module, a0) __objc_exec_class(module); } IMP __saveds Index: src/runtime/amigaos3.sfd ================================================================== --- src/runtime/amigaos3.sfd +++ src/runtime/amigaos3.sfd @@ -5,11 +5,11 @@ ==public * Functions that are only for the linklib. bool glue_objc_init(unsigned int version, struct objc_libc *libc, FILE *stdout, FILE *stderr)(d0,a0,a1,a2) * These have a built-in declaration in the compiler that does not use the * registers and thus always need glue. -void glue___objc_exec_class(void *_Nonnull module)(a0) +void glue___objc_exec_class(struct objc_module *_Nonnull module)(a0) IMP _Nonnull glue_objc_msg_lookup(id _Nullable object, SEL _Nonnull selector)(a0,a1) IMP _Nonnull glue_objc_msg_lookup_stret(id _Nullable object, SEL _Nonnull selector)(a0,a1) IMP _Nonnull glue_objc_msg_lookup_super(struct objc_super *_Nonnull super, SEL _Nonnull selector)(a0,a1) IMP _Nonnull glue_objc_msg_lookup_super_stret(struct objc_super *_Nonnull super, SEL _Nonnull selector)(a0,a1) Class _Nullable glue_objc_lookUpClass(const char *_Nonnull name)(a0) Index: src/runtime/category.m ================================================================== --- src/runtime/category.m +++ src/runtime/category.m @@ -25,47 +25,45 @@ #import "private.h" static struct objc_hashtable *categoriesMap = NULL; static void -registerSelectors(struct objc_abi_category *category) -{ - for (struct objc_abi_method_list *methodList = - category->instanceMethods; methodList != NULL; - methodList = methodList->next) - for (unsigned int i = 0; i < methodList->count; i++) - objc_register_selector((struct objc_abi_selector *) - &methodList->methods[i]); - - for (struct objc_abi_method_list *methodList = category->classMethods; - methodList != NULL; methodList = methodList->next) - for (unsigned int i = 0; i < methodList->count; i++) - objc_register_selector((struct objc_abi_selector *) - &methodList->methods[i]); +registerSelectors(struct objc_category *category) +{ + struct objc_method_list *iter; + unsigned int i; + + for (iter = category->instanceMethods; iter != NULL; iter = iter->next) + for (i = 0; i < iter->count; i++) + objc_register_selector(&iter->methods[i].selector); + + for (iter = category->classMethods; iter != NULL; iter = iter->next) + for (i = 0; i < iter->count; i++) + objc_register_selector(&iter->methods[i].selector); } static void -registerCategory(struct objc_abi_category *category) +registerCategory(struct objc_category *category) { - struct objc_abi_category **categories; + struct objc_category **categories; Class class = objc_classname_to_class(category->className, false); if (categoriesMap == NULL) categoriesMap = objc_hashtable_new( objc_hash_string, objc_equal_string, 2); - categories = (struct objc_abi_category **)objc_hashtable_get( + categories = (struct objc_category **)objc_hashtable_get( categoriesMap, category->className); if (categories != NULL) { - struct objc_abi_category **newCategories; + struct objc_category **newCategories; size_t i; for (i = 0; categories[i] != NULL; i++); if ((newCategories = realloc(categories, - (i + 2) * sizeof(struct objc_abi_category *))) == NULL) + (i + 2) * sizeof(*categories))) == NULL) OBJC_ERROR("Not enough memory for category %s of " "class %s!", category->categoryName, category->className); newCategories[i] = category; @@ -79,12 +77,11 @@ } return; } - if ((categories = malloc( - 2 * sizeof(struct objc_abi_category *))) == NULL) + if ((categories = malloc(2 * sizeof(*categories))) == NULL) OBJC_ERROR("Not enough memory for category %s of class %s!\n", category->categoryName, category->className); categories[0] = category; categories[1] = NULL; @@ -95,14 +92,14 @@ objc_update_dtable(class->isa); } } void -objc_register_all_categories(struct objc_abi_symtab *symtab) +objc_register_all_categories(struct objc_symtab *symtab) { - struct objc_abi_category **categories = - (struct objc_abi_category **)symtab->defs + symtab->classDefsCount; + struct objc_category **categories = + (struct objc_category **)symtab->defs + symtab->classDefsCount; for (size_t i = 0; i < symtab->categoryDefsCount; i++) { registerSelectors(categories[i]); registerCategory(categories[i]); } Index: src/runtime/class.m ================================================================== --- src/runtime/class.m +++ src/runtime/class.m @@ -32,25 +32,25 @@ static struct objc_dtable *emptyDTable = NULL; static unsigned lookupsUntilFastPath = 128; static struct objc_sparsearray *fastPath = NULL; static void -registerClass(struct objc_abi_class *rawClass) +registerClass(Class class) { if (classes == NULL) classes = objc_hashtable_new( objc_hash_string, objc_equal_string, 2); - objc_hashtable_set(classes, rawClass->name, rawClass); + objc_hashtable_set(classes, class->name, class); if (emptyDTable == NULL) emptyDTable = objc_dtable_new(); - rawClass->DTable = emptyDTable; - rawClass->metaclass->DTable = emptyDTable; + class->DTable = emptyDTable; + class->isa->DTable = emptyDTable; - if (strcmp(rawClass->name, "Protocol") != 0) + if (strcmp(class->name, "Protocol") != 0) classesCount++; } bool class_registerAlias_np(Class class, const char *name) @@ -69,19 +69,18 @@ return YES; } static void -registerSelectors(struct objc_abi_class *rawClass) -{ - struct objc_abi_method_list *methodList; - - for (methodList = rawClass->methodList; methodList != NULL; - methodList = methodList->next) - for (unsigned int i = 0; i < methodList->count; i++) - objc_register_selector((struct objc_abi_selector *) - &methodList->methods[i]); +registerSelectors(Class class) +{ + struct objc_method_list *iter; + unsigned int i; + + for (iter = class->methodList; iter != NULL; iter = iter->next) + for (i = 0; i < iter->count; i++) + objc_register_selector(&iter->methods[i].selector); } Class objc_classname_to_class(const char *name, bool cache) { @@ -290,11 +289,11 @@ const char *superclassName; if (class->info & OBJC_CLASS_INFO_SETUP) return; - superclassName = ((struct objc_abi_class *)class)->superclass; + superclassName = (const char *)class->superclass; if (superclassName != NULL) { Class super = objc_classname_to_class(superclassName, false); if (super == Nil) return; @@ -415,19 +414,18 @@ } } } void -objc_register_all_classes(struct objc_abi_symtab *symtab) +objc_register_all_classes(struct objc_symtab *symtab) { for (uint16_t i = 0; i < symtab->classDefsCount; i++) { - struct objc_abi_class *rawClass = - (struct objc_abi_class *)symtab->defs[i]; + Class class = (Class)symtab->defs[i]; - registerClass(rawClass); - registerSelectors(rawClass); - registerSelectors(rawClass->metaclass); + registerClass(class); + registerSelectors(class); + registerSelectors(class->isa); } for (uint16_t i = 0; i < symtab->classDefsCount; i++) { Class class = (Class)symtab->defs[i]; @@ -490,11 +488,11 @@ void objc_registerClassPair(Class class) { objc_global_mutex_lock(); - registerClass((struct objc_abi_class *)class); + registerClass(class); if (class->superclass != Nil) { addSubclass(class); addSubclass(class->isa); } @@ -863,12 +861,10 @@ } static void unregisterClass(Class class) { - struct objc_abi_class *rawClass = (struct objc_abi_class *)class; - if ((class->info & OBJC_CLASS_INFO_SETUP) && class->superclass != Nil && class->superclass->subclassList != NULL) { size_t i = SIZE_MAX, count = 0; Class *tmp; @@ -900,11 +896,11 @@ objc_dtable_free(class->DTable); class->DTable = NULL; if ((class->info & OBJC_CLASS_INFO_SETUP) && class->superclass != Nil) - rawClass->superclass = class->superclass->name; + class->superclass = (Class)class->superclass->name; class->info &= ~OBJC_CLASS_INFO_SETUP; } void Index: src/runtime/init.m ================================================================== --- src/runtime/init.m +++ src/runtime/init.m @@ -19,14 +19,12 @@ #import "ObjFWRT.h" #import "private.h" void -__objc_exec_class(void *module_) +__objc_exec_class(struct objc_module *module) { - struct objc_abi_module *module = module_; - objc_global_mutex_lock(); objc_register_all_selectors(module->symtab); objc_register_all_classes(module->symtab); objc_register_all_categories(module->symtab); Index: src/runtime/linklib/linklib.m ================================================================== --- src/runtime/linklib/linklib.m +++ src/runtime/linklib/linklib.m @@ -138,11 +138,11 @@ dtor(); } #endif void -__objc_exec_class(void *module) +__objc_exec_class(struct objc_module *module) { /* * The compiler generates constructors that call into this, so it is * possible that we are not set up yet when we get called. */ Index: src/runtime/morphos-clib.h ================================================================== --- src/runtime/morphos-clib.h +++ src/runtime/morphos-clib.h @@ -1,9 +1,9 @@ /* Functions that are only for the linklib. */ bool glue_objc_init(unsigned int, struct objc_libc *, FILE *, FILE *); /* All other functions. */ -void glue___objc_exec_class(void *); +void glue___objc_exec_class(struct objc_module *); IMP glue_objc_msg_lookup(id, SEL); IMP glue_objc_msg_lookup_stret(id, SEL); IMP glue_objc_msg_lookup_super(struct objc_super *, SEL); IMP glue_objc_msg_lookup_super_stret(struct objc_super *, SEL); Class glue_objc_lookUpClass(const char *); Index: src/runtime/private.h ================================================================== --- src/runtime/private.h +++ src/runtime/private.h @@ -27,45 +27,10 @@ # ifndef _Nullable # define _Nullable # endif #endif -struct objc_abi_class { - struct objc_abi_class *_Nonnull metaclass; - const char *_Nullable superclass; - const char *_Nonnull name; - unsigned long version; - unsigned long info; - long instanceSize; - void *_Nullable ivars; - struct objc_abi_method_list *_Nullable methodList; - void *_Nullable DTable; - void *_Nullable subclassList; - void *_Nullable siblingClass; - void *_Nullable protocols; - void *_Nullable GCObjectType; - long ABIVersion; - int32_t *_Nonnull *_Nullable ivarOffsets; - void *_Nullable properties; -}; - -struct objc_abi_selector { - const char *_Nonnull name; - const char *_Nullable typeEncoding; -}; - -struct objc_abi_method { - struct objc_abi_selector selector; - IMP _Nonnull implementation; -}; - -struct objc_abi_method_list { - struct objc_abi_method_list *_Nullable next; - unsigned int count; - struct objc_abi_method methods[1]; -}; - struct objc_ivar { const char *_Nonnull name; const char *_Nonnull typeEncoding; unsigned int offset; }; @@ -73,36 +38,28 @@ struct objc_ivar_list { unsigned int count; struct objc_ivar ivars[1]; }; -struct objc_abi_category { - const char *_Nonnull categoryName; - const char *_Nonnull className; - struct objc_abi_method_list *_Nullable instanceMethods; - struct objc_abi_method_list *_Nullable classMethods; - struct objc_protocol_list *_Nullable protocols; -}; - -struct objc_abi_static_instances { +struct objc_static_instances { const char *_Nonnull className; id _Nullable instances[1]; }; -struct objc_abi_symtab { +struct objc_symtab { unsigned long unknown; - struct objc_abi_selector *_Nullable selectorRefs; + struct objc_selector *_Nullable selectorRefs; uint16_t classDefsCount; uint16_t categoryDefsCount; void *_Nonnull defs[1]; }; -struct objc_abi_module { +struct objc_module { unsigned long version; /* 9 = non-fragile */ unsigned long size; const char *_Nullable name; - struct objc_abi_symtab *_Nonnull symtab; + struct objc_symtab *_Nonnull symtab; }; struct objc_hashtable_bucket { const void *_Nonnull key, *_Nonnull object; uint32_t hash; @@ -183,17 +140,17 @@ # undef stdout # undef stderr extern FILE *stdout, *stderr; #endif -extern void objc_register_all_categories(struct objc_abi_symtab *_Nonnull); +extern void objc_register_all_categories(struct objc_symtab *_Nonnull); extern struct objc_category *_Nullable *_Nullable objc_categories_for_class(Class _Nonnull); extern void objc_unregister_all_categories(void); extern void objc_initialize_class(Class _Nonnull); extern void objc_update_dtable(Class _Nonnull); -extern void objc_register_all_classes(struct objc_abi_symtab *_Nonnull); +extern void objc_register_all_classes(struct objc_symtab *_Nonnull); extern Class _Nullable objc_classname_to_class(const char *_Nonnull, bool); extern void objc_unregister_class(Class _Nonnull); extern void objc_unregister_all_classes(void); extern uint32_t objc_hash_string(const void *_Nonnull); extern bool objc_equal_string(const void *_Nonnull, const void *_Nonnull); @@ -206,12 +163,12 @@ extern void *_Nullable objc_hashtable_get(struct objc_hashtable *_Nonnull, const void *_Nonnull); extern void objc_hashtable_delete(struct objc_hashtable *_Nonnull, const void *_Nonnull); extern void objc_hashtable_free(struct objc_hashtable *_Nonnull); -extern void objc_register_selector(struct objc_abi_selector *_Nonnull); -extern void objc_register_all_selectors(struct objc_abi_symtab *_Nonnull); +extern void objc_register_selector(struct objc_selector *_Nonnull); +extern void objc_register_all_selectors(struct objc_symtab *_Nonnull); extern void objc_unregister_all_selectors(void); extern struct objc_sparsearray *_Nonnull objc_sparsearray_new(uint8_t); extern void *_Nullable objc_sparsearray_get(struct objc_sparsearray *_Nonnull, uintptr_t); extern void objc_sparsearray_set(struct objc_sparsearray *_Nonnull, uintptr_t, @@ -222,11 +179,11 @@ struct objc_dtable *_Nonnull); extern void objc_dtable_set(struct objc_dtable *_Nonnull, uint32_t, IMP _Nullable); extern void objc_dtable_free(struct objc_dtable *_Nonnull); extern void objc_dtable_cleanup(void); -extern void objc_init_static_instances(struct objc_abi_symtab *_Nonnull); +extern void objc_init_static_instances(struct objc_symtab *_Nonnull); extern void objc_forget_pending_static_instances(void); #ifdef OF_HAVE_THREADS extern void objc_global_mutex_lock(void); extern void objc_global_mutex_unlock(void); extern void objc_global_mutex_free(void); Index: src/runtime/selector.m ================================================================== --- src/runtime/selector.m +++ src/runtime/selector.m @@ -39,32 +39,31 @@ static struct objc_sparsearray *selectorNames = NULL; static void **freeList = NULL; static size_t freeListCount = 0; void -objc_register_selector(struct objc_abi_selector *rawSelector) +objc_register_selector(struct objc_selector *selector) { - struct objc_selector *selector; + SEL existingSelector; const char *name; if (selectorsCount > SEL_MAX) OBJC_ERROR("Out of selector slots!"); if (selectors == NULL) selectors = objc_hashtable_new( objc_hash_string, objc_equal_string, 2); - else if ((selector = objc_hashtable_get(selectors, - rawSelector->name)) != NULL) { - ((struct objc_selector *)rawSelector)->UID = selector->UID; + else if ((existingSelector = objc_hashtable_get(selectors, + (const char *)selector->UID)) != NULL) { + selector->UID = existingSelector->UID; return; } if (selectorNames == NULL) selectorNames = objc_sparsearray_new(SEL_SIZE); - name = rawSelector->name; - selector = (struct objc_selector *)rawSelector; + name = (const char *)selector->UID; selector->UID = selectorsCount++; objc_hashtable_set(selectors, name, selector); objc_sparsearray_set(selectorNames, (uint32_t)selector->UID, (void *)name); @@ -71,52 +70,51 @@ } SEL sel_registerName(const char *name) { - struct objc_abi_selector *rawSelector; + struct objc_selector *selector; objc_global_mutex_lock(); if (selectors != NULL && - (rawSelector= objc_hashtable_get(selectors, name)) != NULL) { + (selector = objc_hashtable_get(selectors, name)) != NULL) { objc_global_mutex_unlock(); - return (SEL)rawSelector; + return (SEL)selector; } - if ((rawSelector = malloc(sizeof(*rawSelector))) == NULL) + if ((selector = malloc(sizeof(*selector))) == NULL) OBJC_ERROR("Not enough memory to allocate selector!"); - if ((rawSelector->name = of_strdup(name)) == NULL) + if ((selector->UID = (uintptr_t)of_strdup(name)) == 0) OBJC_ERROR("Not enough memory to allocate selector!"); - rawSelector->typeEncoding = NULL; + selector->typeEncoding = NULL; if ((freeList = realloc(freeList, sizeof(void *) * (freeListCount + 2))) == NULL) OBJC_ERROR("Not enough memory to allocate selector!"); - freeList[freeListCount++] = rawSelector; - freeList[freeListCount++] = (char *)rawSelector->name; + freeList[freeListCount++] = selector; + freeList[freeListCount++] = (char *)selector->UID; - objc_register_selector(rawSelector); + objc_register_selector(selector); objc_global_mutex_unlock(); - return (SEL)rawSelector; + return (SEL)selector; } void -objc_register_all_selectors(struct objc_abi_symtab *symtab) +objc_register_all_selectors(struct objc_symtab *symtab) { - struct objc_abi_selector *rawSelector; + struct objc_selector *selector; if (symtab->selectorRefs == NULL) return; - for (rawSelector = symtab->selectorRefs; rawSelector->name != NULL; - rawSelector++) - objc_register_selector(rawSelector); + for (selector = symtab->selectorRefs; selector->UID != 0; selector++) + objc_register_selector(selector); } const char * sel_getName(SEL selector) { Index: src/runtime/static-instances.m ================================================================== --- src/runtime/static-instances.m +++ src/runtime/static-instances.m @@ -21,17 +21,17 @@ #include #import "ObjFWRT.h" #import "private.h" -static struct objc_abi_static_instances **staticInstancesList = NULL; +static struct objc_static_instances **staticInstancesList = NULL; static size_t staticInstancesCount = 0; void -objc_init_static_instances(struct objc_abi_symtab *symtab) +objc_init_static_instances(struct objc_symtab *symtab) { - struct objc_abi_static_instances **staticInstances; + struct objc_static_instances **staticInstances; /* Check if the class for a static instance became available */ for (size_t i = 0; i < staticInstancesCount; i++) { Class class = objc_lookUpClass( staticInstancesList[i]->className); @@ -51,11 +51,11 @@ staticInstancesList[i] = staticInstancesList[staticInstancesCount]; staticInstancesList = realloc(staticInstancesList, - sizeof(struct objc_abi_static_instances *) * + sizeof(*staticInstancesList) * staticInstancesCount); if (staticInstancesList == NULL) OBJC_ERROR("Not enough memory for list of " "static instances!"); @@ -66,11 +66,11 @@ */ i--; } } - staticInstances = (struct objc_abi_static_instances **) + staticInstances = (struct objc_static_instances **) symtab->defs[symtab->classDefsCount + symtab->categoryDefsCount]; if (staticInstances == NULL) return; @@ -81,11 +81,11 @@ for (id *instances = (*staticInstances)->instances; *instances != nil; instances++) object_setClass(*instances, class); } else { staticInstancesList = realloc(staticInstancesList, - sizeof(struct objc_abi_static_instances *) * + sizeof(*staticInstancesList) * (staticInstancesCount + 1)); if (staticInstancesList == NULL) OBJC_ERROR("Not enough memory for list of " "static instances!"); Index: tests/OFBlockTests.m ================================================================== --- tests/OFBlockTests.m +++ tests/OFBlockTests.m @@ -19,13 +19,13 @@ #import "TestsAppDelegate.h" static OFString *module = @"OFBlock"; -extern struct objc_abi_class _NSConcreteStackBlock; -extern struct objc_abi_class _NSConcreteGlobalBlock; -extern struct objc_abi_class _NSConcreteMallocBlock; +extern struct objc_class _NSConcreteStackBlock; +extern struct objc_class _NSConcreteGlobalBlock; +extern struct objc_class _NSConcreteMallocBlock; static void (^g)(void) = ^ {}; static int (^returnStackBlock(void))(void)