summaryrefslogtreecommitdiff
path: root/libobjc/init.c
diff options
context:
space:
mode:
authorNicola Pero <nicola.pero@meta-innovation.com>2010-10-16 21:26:59 +0000
committerNicola Pero <nicola@gcc.gnu.org>2010-10-16 21:26:59 +0000
commit6c5c7efd6bbca80cb28fffd24600cbb58436f808 (patch)
tree3920a8a13cd2db3193c61dca0c4a3e93ab0c05f5 /libobjc/init.c
parentd4d9b0a64193609249caa5db60afc6cb0bf50e2a (diff)
downloadgcc-6c5c7efd6bbca80cb28fffd24600cbb58436f808.tar.gz
In libobjc/: 2010-10-16 Nicola Pero <nicola.pero@meta-innovation.com>
In libobjc/: 2010-10-16 Nicola Pero <nicola.pero@meta-innovation.com> * objc/runtime.h: Updated comments. (class_addMethod): New. (class_addIvar): New. (class_replaceMethod): New. (objc_allocateClassPair): New. (objc_registerClassPair): New. (objc_disposeClassPair): New. * class.c (objc_allocateClassPair): New. (objc_registerClassPair): New. (objc_disposeClassPair): New. (class_getSuperclass): Return Nil if a class is in construction. * init.c (__objc_exec_class): Call __objc_init_class. (__objc_init_class): New. * ivars.c (class_copyIvarList): Return NULL if class is in construction. Do not lock the runtime mutex. (class_getInstanceVariable): Return NULL if class is in construction. Do not lock the runtime mutex. (class_addIvar): New. * sendmsg.c (class_addMethod): New. (class_replaceMethod): New. * objc-private/module-abi-8.h (__CLS_SETNOTINFO): New. (_CLS_IN_CONSTRUCTION): New. (CLS_IS_IN_CONSTRUCTION): New. (CLS_SET_IN_CONSTRUCTION): New. (CLS_SET_NOT_IN_CONSTRUCTION): New. * objc-private/runtime.h (__objc_init_class): New. From-SVN: r165563
Diffstat (limited to 'libobjc/init.c')
-rw-r--r--libobjc/init.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/libobjc/init.c b/libobjc/init.c
index 33fb7979ef7..dd8789c9cac 100644
--- a/libobjc/init.c
+++ b/libobjc/init.c
@@ -623,23 +623,7 @@ __objc_exec_class (Module_t module)
In some cases it isn't and this crashes the program. */
class->subclass_list = NULL;
- /* Store the class in the class table and assign class numbers. */
- __objc_add_class_to_hash (class);
-
- /* Register all of the selectors in the class and meta class. */
- __objc_register_selectors_from_class (class);
- __objc_register_selectors_from_class ((Class) class->class_pointer);
-
- /* Install the fake dispatch tables */
- __objc_install_premature_dtable (class);
- __objc_install_premature_dtable (class->class_pointer);
-
- /* Register the instance methods as class methods, this is
- only done for root classes. */
- __objc_register_instance_methods_to_class (class);
-
- if (class->protocols)
- __objc_init_protocols (class->protocols);
+ __objc_init_class (class);
/* Check to see if the superclass is known in this point. If it's not
add the class to the unresolved_classes list. */
@@ -864,6 +848,29 @@ init_check_module_version (Module_t module)
}
}
+/* __objc_init_class must be called with __objc_runtime_mutex already locked. */
+void
+__objc_init_class (Class class)
+{
+ /* Store the class in the class table and assign class numbers. */
+ __objc_add_class_to_hash (class);
+
+ /* Register all of the selectors in the class and meta class. */
+ __objc_register_selectors_from_class (class);
+ __objc_register_selectors_from_class ((Class) class->class_pointer);
+
+ /* Install the fake dispatch tables */
+ __objc_install_premature_dtable (class);
+ __objc_install_premature_dtable (class->class_pointer);
+
+ /* Register the instance methods as class methods, this is only done
+ for root classes. */
+ __objc_register_instance_methods_to_class (class);
+
+ if (class->protocols)
+ __objc_init_protocols (class->protocols);
+}
+
/* __objc_init_protocol must be called with __objc_runtime_mutex
already locked, and the "Protocol" class already registered. */
static void