mirror of
https://github.com/darlinghq/darling-libobjc2.git
synced 2024-11-27 14:10:33 +00:00
More tweaks to +load. Now defers +load a little bit more.
This commit is contained in:
parent
378c7d3a6c
commit
a75064866a
@ -34,7 +34,6 @@ static void load_category(struct objc_category *cat, struct objc_class *class)
|
||||
cat->protocols->next = class->protocols;
|
||||
class->protocols = cat->protocols;
|
||||
}
|
||||
objc_send_load_message(class);
|
||||
}
|
||||
|
||||
static BOOL try_load_category(struct objc_category *cat)
|
||||
|
17
loader.c
17
loader.c
@ -16,6 +16,7 @@ void __objc_init_selector_tables(void);
|
||||
void __objc_init_protocol_table(void);
|
||||
void __objc_init_class_tables(void);
|
||||
void __objc_init_dispatch_tables(void);
|
||||
void objc_send_load_message(Class class);
|
||||
|
||||
/* Number of threads that are alive. */
|
||||
int __objc_runtime_threads_alive = 1; /* !T:MUTEX */
|
||||
@ -72,6 +73,7 @@ void __objc_exec_class(struct objc_module_abi_8 *module)
|
||||
{
|
||||
objc_load_class(symbols->definitions[defs++]);
|
||||
}
|
||||
unsigned int category_start = defs;
|
||||
// Load the categories from this module
|
||||
for (unsigned short i=0 ; i<symbols->category_count; i++)
|
||||
{
|
||||
@ -84,9 +86,20 @@ void __objc_exec_class(struct objc_module_abi_8 *module)
|
||||
objc_init_statics(*(statics++));
|
||||
}
|
||||
|
||||
// Fix up the class links for loaded classes.
|
||||
objc_resolve_class_links();
|
||||
// Load categories and statics that were deferred.
|
||||
objc_load_buffered_categories();
|
||||
objc_init_buffered_statics();
|
||||
// Fix up the class links for loaded classes.
|
||||
objc_resolve_class_links();
|
||||
for (unsigned short i=0 ; i<symbols->category_count; i++)
|
||||
{
|
||||
struct objc_category *cat = (struct objc_category*)
|
||||
symbols->definitions[category_start++];
|
||||
Class class = (Class)objc_getClass(cat->class_name);
|
||||
if ((Nil != class) &&
|
||||
objc_test_class_flag(class, objc_class_flag_resolved))
|
||||
{
|
||||
objc_send_load_message(class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user