summaryrefslogtreecommitdiff
path: root/libobjc/objc-private
diff options
context:
space:
mode:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-15 10:35:00 +0000
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-15 10:35:00 +0000
commit1e13b8762fd121ad1d83c8ceb22b8f9dfb98d18c (patch)
tree25c0b3362de3f254c6fe9987ea63d4a668631f87 /libobjc/objc-private
parent0ba90dfe7ae02bd83235d470f23f095c3ef1eab1 (diff)
downloadgcc-1e13b8762fd121ad1d83c8ceb22b8f9dfb98d18c.tar.gz
In libobjc/:
2010-10-14 Nicola Pero <nicola.pero@meta-innovation.com> * init.c (__objc_init_protocol): New function which fixes up a protocol's class pointer, registers it with the runtime, register all protocol selectors and registers associated protocols too. (objc_init_statics): Detect if we are initializing protocols, and if so, use __objc_init_protocol instead of only fixing up the class pointer. (__objc_init_protocls): Use __objc_init_protocol. * objc-private/module-abi-8.h: Updated comments. * objc-private/runtime.h (__objc_register_selectors_from_description_list): New. * selector.c (__objc_register_selectors_from_description_list): New. (struct objc_method_description_list): Declare. * Protocol.m ([-descriptionForInstanceMethod:]): Use sel_get_name when accessing the name of a method, which is now correctly a SEL. ([-descriptionForClassMethod:]): Same change. * protocols.c (protocol_getMethodDescription): Same change. * objc/runtime.h: Updated comments. (sel_registerTypedName): Fixed typo in function name. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165499 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libobjc/objc-private')
-rw-r--r--libobjc/objc-private/module-abi-8.h21
-rw-r--r--libobjc/objc-private/runtime.h2
2 files changed, 16 insertions, 7 deletions
diff --git a/libobjc/objc-private/module-abi-8.h b/libobjc/objc-private/module-abi-8.h
index 414e5e354ec..7505a6b0bf3 100644
--- a/libobjc/objc-private/module-abi-8.h
+++ b/libobjc/objc-private/module-abi-8.h
@@ -115,13 +115,15 @@ struct objc_ivar_list
problem is a singly linked list of methods. */
struct objc_method
{
- SEL method_name; /* This variable is the method's name. It
- is a char*. The unique integer passed
- to objc_msg_send is a char* too. It is
- compared against method_name using
- strcmp. */
+ SEL method_name; /* This variable is the method's name.
+ The compiler puts a char* here, and
+ it's replaced by a real SEL at runtime
+ when the method is registered. */
const char* method_types; /* Description of the method's parameter
- list. Useful for debuggers. */
+ list. Used when registering the
+ selector with the runtime. When that
+ happens, method_name will contain the
+ method's parameter list. */
IMP method_imp; /* Address of the method in the
executable. */
};
@@ -139,7 +141,12 @@ struct objc_method_list
};
/* Currently defined in Protocol.m (that definition should go away
- once we include this file). */
+ once we include this file). Note that a 'struct
+ objc_method_description' as embedded inside a Protocol uses the
+ same trick as a 'struct objc_method': the method_name is a 'char *'
+ according to the compiler, who puts the method name as a string in
+ there. At runtime, the selectors need to be registered, and the
+ method_name then becomes a SEL. */
struct objc_method_description_list
{
int count;
diff --git a/libobjc/objc-private/runtime.h b/libobjc/objc-private/runtime.h
index b7e75ae4304..6794d181513 100644
--- a/libobjc/objc-private/runtime.h
+++ b/libobjc/objc-private/runtime.h
@@ -60,6 +60,8 @@ extern void __objc_install_premature_dtable(Class); /* (objc-dispatch.c) */
extern void __objc_resolve_class_links(void); /* (objc-class.c) */
extern void __objc_register_selectors_from_class(Class); /* (objc-sel.c) */
extern void __objc_register_selectors_from_list (struct objc_method_list *); /* (selector.c) */
+extern void __objc_register_selectors_from_description_list
+(struct objc_method_description_list *method_list); /* (selector.c) */
extern void __objc_update_dispatch_table_for_class (Class);/* (objc-msg.c) */
extern int __objc_init_thread_system(void); /* thread.c */