|
|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
/* GNU Objective C Runtime initialization
|
|
|
|
|
Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc.
|
|
|
|
|
Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
|
|
|
|
|
Contributed by Kresten Krab Thorup
|
|
|
|
|
+load support contributed by Ovidiu Predescu <ovidiu@net-community.com>
|
|
|
|
|
|
|
|
|
|
@ -27,14 +27,14 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
|
|
|
#include "runtime.h"
|
|
|
|
|
|
|
|
|
|
/* The version number of this runtime. This must match the number
|
|
|
|
|
defined in gcc (objc-act.c) */
|
|
|
|
|
defined in gcc (objc-act.c). */
|
|
|
|
|
#define OBJC_VERSION 8
|
|
|
|
|
#define PROTOCOL_VERSION 2
|
|
|
|
|
|
|
|
|
|
/* This list contains all modules currently loaded into the runtime */
|
|
|
|
|
/* This list contains all modules currently loaded into the runtime. */
|
|
|
|
|
static struct objc_list *__objc_module_list = 0; /* !T:MUTEX */
|
|
|
|
|
|
|
|
|
|
/* This list contains all proto_list's not yet assigned class links */
|
|
|
|
|
/* This list contains all proto_list's not yet assigned class links. */
|
|
|
|
|
static struct objc_list *unclaimed_proto_list = 0; /* !T:MUTEX */
|
|
|
|
|
|
|
|
|
|
/* List of unresolved static instances. */
|
|
|
|
|
@ -46,19 +46,19 @@ objc_mutex_t __objc_runtime_mutex = 0;
|
|
|
|
|
/* Number of threads that are alive. */
|
|
|
|
|
int __objc_runtime_threads_alive = 1; /* !T:MUTEX */
|
|
|
|
|
|
|
|
|
|
/* Check compiler vs runtime version */
|
|
|
|
|
/* Check compiler vs runtime version. */
|
|
|
|
|
static void init_check_module_version (Module_t);
|
|
|
|
|
|
|
|
|
|
/* Assign isa links to protos */
|
|
|
|
|
/* Assign isa links to protos. */
|
|
|
|
|
static void __objc_init_protocols (struct objc_protocol_list *protos);
|
|
|
|
|
|
|
|
|
|
/* Add protocol to class */
|
|
|
|
|
/* Add protocol to class. */
|
|
|
|
|
static void __objc_class_add_protocols (Class, struct objc_protocol_list *);
|
|
|
|
|
|
|
|
|
|
/* This is a hook which is called by __objc_exec_class every time a class
|
|
|
|
|
or a category is loaded into the runtime. This may e.g. help a
|
|
|
|
|
dynamic loader determine the classes that have been loaded when
|
|
|
|
|
an object file is dynamically linked in */
|
|
|
|
|
/* This is a hook which is called by __objc_exec_class every time a
|
|
|
|
|
class or a category is loaded into the runtime. This may e.g. help
|
|
|
|
|
a dynamic loader determine the classes that have been loaded when
|
|
|
|
|
an object file is dynamically linked in. */
|
|
|
|
|
void (*_objc_load_callback) (Class class, Category *category); /* !T:SAFE */
|
|
|
|
|
|
|
|
|
|
/* Is all categories/classes resolved? */
|
|
|
|
|
@ -72,11 +72,11 @@ __sel_register_typed_name (const char *name, const char *types,
|
|
|
|
|
static void objc_send_load (void);
|
|
|
|
|
|
|
|
|
|
/* Inserts all the classes defined in module in a tree of classes that
|
|
|
|
|
resembles the class hierarchy. This tree is traversed in preorder and the
|
|
|
|
|
classes in its nodes receive the +load message if these methods were not
|
|
|
|
|
executed before. The algorithm ensures that when the +load method of a class
|
|
|
|
|
is executed all the superclasses have been already received the +load
|
|
|
|
|
message. */
|
|
|
|
|
resembles the class hierarchy. This tree is traversed in preorder
|
|
|
|
|
and the classes in its nodes receive the +load message if these
|
|
|
|
|
methods were not executed before. The algorithm ensures that when
|
|
|
|
|
the +load method of a class is executed all the superclasses have
|
|
|
|
|
been already received the +load message. */
|
|
|
|
|
static void __objc_create_classes_tree (Module_t module);
|
|
|
|
|
|
|
|
|
|
static void __objc_call_callback (Module_t module);
|
|
|
|
|
@ -90,19 +90,21 @@ typedef struct objc_class_tree {
|
|
|
|
|
struct objc_list *subclasses; /* `head' is pointer to an objc_class_tree */
|
|
|
|
|
} objc_class_tree;
|
|
|
|
|
|
|
|
|
|
/* This is a linked list of objc_class_tree trees. The head of these trees
|
|
|
|
|
are root classes (their super class is Nil). These different trees
|
|
|
|
|
represent different class hierarchies. */
|
|
|
|
|
/* This is a linked list of objc_class_tree trees. The head of these
|
|
|
|
|
trees are root classes (their super class is Nil). These different
|
|
|
|
|
trees represent different class hierarchies. */
|
|
|
|
|
static struct objc_list *__objc_class_tree_list = NULL;
|
|
|
|
|
|
|
|
|
|
/* Keeps the +load methods who have been already executed. This hash should
|
|
|
|
|
not be destroyed during the execution of the program. */
|
|
|
|
|
/* Keeps the +load methods who have been already executed. This hash
|
|
|
|
|
should not be destroyed during the execution of the program. */
|
|
|
|
|
static cache_ptr __objc_load_methods = NULL;
|
|
|
|
|
|
|
|
|
|
/* Creates a tree of classes whose topmost class is directly inherited from
|
|
|
|
|
`upper' and the bottom class in this tree is `bottom_class'. The classes
|
|
|
|
|
in this tree are super classes of `bottom_class'. `subclasses' member
|
|
|
|
|
of each tree node point to the next subclass tree node. */
|
|
|
|
|
/* Creates a tree of classes whose topmost class is directly inherited
|
|
|
|
|
from `upper' and the bottom class in this tree is
|
|
|
|
|
`bottom_class'. The classes in this tree are super classes of
|
|
|
|
|
`bottom_class'. `subclasses' member of each tree node point to the
|
|
|
|
|
next subclass tree node. */
|
|
|
|
|
|
|
|
|
|
static objc_class_tree *
|
|
|
|
|
create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper)
|
|
|
|
|
{
|
|
|
|
|
@ -134,11 +136,13 @@ create_tree_of_subclasses_inherited_from (Class bottom_class, Class upper)
|
|
|
|
|
return tree;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Insert the `class' into the proper place in the `tree' class hierarchy. This
|
|
|
|
|
function returns a new tree if the class has been successfully inserted into
|
|
|
|
|
the tree or NULL if the class is not part of the classes hierarchy described
|
|
|
|
|
by `tree'. This function is private to objc_tree_insert_class(), you should
|
|
|
|
|
not call it directly. */
|
|
|
|
|
/* Insert the `class' into the proper place in the `tree' class
|
|
|
|
|
hierarchy. This function returns a new tree if the class has been
|
|
|
|
|
successfully inserted into the tree or NULL if the class is not
|
|
|
|
|
part of the classes hierarchy described by `tree'. This function is
|
|
|
|
|
private to objc_tree_insert_class (), you should not call it
|
|
|
|
|
directly. */
|
|
|
|
|
|
|
|
|
|
static objc_class_tree *
|
|
|
|
|
__objc_tree_insert_class (objc_class_tree *tree, Class class)
|
|
|
|
|
{
|
|
|
|
|
@ -186,12 +190,13 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* The class is not a direct subclass of tree->class. Search for class's
|
|
|
|
|
superclasses in the list of subclasses. */
|
|
|
|
|
/* The class is not a direct subclass of tree->class. Search for
|
|
|
|
|
class's superclasses in the list of subclasses. */
|
|
|
|
|
struct objc_list *subclasses = tree->subclasses;
|
|
|
|
|
|
|
|
|
|
/* Precondition: the class must be a subclass of tree->class; otherwise
|
|
|
|
|
return NULL to indicate our caller that it must take the next tree. */
|
|
|
|
|
/* Precondition: the class must be a subclass of tree->class;
|
|
|
|
|
otherwise return NULL to indicate our caller that it must
|
|
|
|
|
take the next tree. */
|
|
|
|
|
if (! class_is_subclass_of_class (class, tree->class))
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
@ -201,9 +206,9 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
|
|
|
|
|
|
|
|
|
|
if (class_is_subclass_of_class (class, aClass))
|
|
|
|
|
{
|
|
|
|
|
/* If we found one of class's superclasses we insert the class
|
|
|
|
|
into its subtree and return the original tree since nothing
|
|
|
|
|
has been changed. */
|
|
|
|
|
/* If we found one of class's superclasses we insert the
|
|
|
|
|
class into its subtree and return the original tree
|
|
|
|
|
since nothing has been changed. */
|
|
|
|
|
subclasses->head
|
|
|
|
|
= __objc_tree_insert_class (subclasses->head, class);
|
|
|
|
|
DEBUG_PRINTF ("4. class %s inserted\n", class->name);
|
|
|
|
|
@ -211,9 +216,9 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We haven't found a subclass of `class' in the `subclasses' list.
|
|
|
|
|
Create a new tree of classes whose topmost class is a direct subclass
|
|
|
|
|
of tree->class. */
|
|
|
|
|
/* We haven't found a subclass of `class' in the `subclasses'
|
|
|
|
|
list. Create a new tree of classes whose topmost class is a
|
|
|
|
|
direct subclass of tree->class. */
|
|
|
|
|
{
|
|
|
|
|
objc_class_tree *new_tree
|
|
|
|
|
= create_tree_of_subclasses_inherited_from (class, tree->class);
|
|
|
|
|
@ -225,6 +230,7 @@ __objc_tree_insert_class (objc_class_tree *tree, Class class)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This function inserts `class' in the right tree hierarchy classes. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
objc_tree_insert_class (Class class)
|
|
|
|
|
{
|
|
|
|
|
@ -244,8 +250,8 @@ objc_tree_insert_class (Class class)
|
|
|
|
|
list_node = list_node->tail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If the list was finished but the class hasn't been inserted, insert it
|
|
|
|
|
here. */
|
|
|
|
|
/* If the list was finished but the class hasn't been inserted,
|
|
|
|
|
insert it here. */
|
|
|
|
|
if (! list_node)
|
|
|
|
|
{
|
|
|
|
|
__objc_class_tree_list = list_cons (NULL, __objc_class_tree_list);
|
|
|
|
|
@ -254,6 +260,7 @@ objc_tree_insert_class (Class class)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Traverse tree in preorder. Used to send +load. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
objc_preorder_traverse (objc_class_tree *tree,
|
|
|
|
|
int level,
|
|
|
|
|
@ -267,6 +274,7 @@ objc_preorder_traverse (objc_class_tree *tree,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Traverse tree in postorder. Used to destroy a tree. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
objc_postorder_traverse (objc_class_tree *tree,
|
|
|
|
|
int level,
|
|
|
|
|
@ -280,6 +288,7 @@ objc_postorder_traverse (objc_class_tree *tree,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Used to print a tree class hierarchy. */
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_RUNTIME
|
|
|
|
|
static void
|
|
|
|
|
__objc_tree_print (objc_class_tree *tree, int level)
|
|
|
|
|
@ -292,10 +301,12 @@ __objc_tree_print (objc_class_tree *tree, int level)
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Walks on a linked list of methods in the reverse order and executes all
|
|
|
|
|
the methods corresponding to `op' selector. Walking in the reverse order
|
|
|
|
|
assures the +load of class is executed first and then +load of categories
|
|
|
|
|
because of the way in which categories are added to the class methods. */
|
|
|
|
|
/* Walks on a linked list of methods in the reverse order and executes
|
|
|
|
|
all the methods corresponding to `op' selector. Walking in the
|
|
|
|
|
reverse order assures the +load of class is executed first and then
|
|
|
|
|
+load of categories because of the way in which categories are
|
|
|
|
|
added to the class methods. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
__objc_send_message_in_list (MethodList_t method_list, Class class, SEL op)
|
|
|
|
|
{
|
|
|
|
|
@ -315,21 +326,22 @@ __objc_send_message_in_list (MethodList_t method_list, Class class, SEL op)
|
|
|
|
|
if (mth->method_name && sel_eq (mth->method_name, op)
|
|
|
|
|
&& ! hash_is_key_in_hash (__objc_load_methods, mth->method_imp))
|
|
|
|
|
{
|
|
|
|
|
/* The method was found and wasn't previously executed. */
|
|
|
|
|
(*mth->method_imp) ((id)class, mth->method_name);
|
|
|
|
|
|
|
|
|
|
/* Add this method into the +load hash table */
|
|
|
|
|
hash_add (&__objc_load_methods, mth->method_imp, mth->method_imp);
|
|
|
|
|
|
|
|
|
|
DEBUG_PRINTF ("sending +load in class: %s\n", class->name);
|
|
|
|
|
|
|
|
|
|
/* The method was found and wasn't previously executed. */
|
|
|
|
|
(*mth->method_imp) ((id)class, mth->method_name);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
__objc_send_load (objc_class_tree *tree, int level)
|
|
|
|
|
__objc_send_load (objc_class_tree *tree,
|
|
|
|
|
int level __attribute__ ((__unused__)))
|
|
|
|
|
{
|
|
|
|
|
static SEL load_sel = 0;
|
|
|
|
|
Class class = tree->class;
|
|
|
|
|
@ -342,13 +354,15 @@ __objc_send_load (objc_class_tree *tree, int level)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
__objc_destroy_class_tree_node (objc_class_tree *tree, int level)
|
|
|
|
|
__objc_destroy_class_tree_node (objc_class_tree *tree,
|
|
|
|
|
int level __attribute__ ((__unused__)))
|
|
|
|
|
{
|
|
|
|
|
objc_free (tree);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This is used to check if the relationship between two classes before the
|
|
|
|
|
runtime completely installs the classes. */
|
|
|
|
|
/* This is used to check if the relationship between two classes
|
|
|
|
|
before the runtime completely installs the classes. */
|
|
|
|
|
|
|
|
|
|
static BOOL
|
|
|
|
|
class_is_subclass_of_class (Class class, Class superclass)
|
|
|
|
|
{
|
|
|
|
|
@ -364,12 +378,12 @@ class_is_subclass_of_class (Class class, Class superclass)
|
|
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* This list contains all the classes in the runtime system for whom their
|
|
|
|
|
superclasses are not yet know to the runtime. */
|
|
|
|
|
/* This list contains all the classes in the runtime system for whom
|
|
|
|
|
their superclasses are not yet known to the runtime. */
|
|
|
|
|
static struct objc_list *unresolved_classes = 0;
|
|
|
|
|
|
|
|
|
|
/* Extern function used to reference the Object and NXConstantString classes.
|
|
|
|
|
*/
|
|
|
|
|
/* Extern function used to reference the Object and NXConstantString
|
|
|
|
|
classes. */
|
|
|
|
|
|
|
|
|
|
extern void __objc_force_linking (void);
|
|
|
|
|
|
|
|
|
|
@ -380,8 +394,9 @@ __objc_force_linking (void)
|
|
|
|
|
__objc_linking ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Run through the statics list, removing modules as soon as all its statics
|
|
|
|
|
have been initialized. */
|
|
|
|
|
/* Run through the statics list, removing modules as soon as all its
|
|
|
|
|
statics have been initialized. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
objc_init_statics (void)
|
|
|
|
|
{
|
|
|
|
|
@ -440,9 +455,9 @@ objc_init_statics (void)
|
|
|
|
|
} /* objc_init_statics */
|
|
|
|
|
|
|
|
|
|
/* This function is called by constructor functions generated for each
|
|
|
|
|
module compiled. (_GLOBAL_$I$...) The purpose of this function is to
|
|
|
|
|
gather the module pointers so that they may be processed by the
|
|
|
|
|
initialization routines as soon as possible */
|
|
|
|
|
module compiled. (_GLOBAL_$I$...) The purpose of this function is
|
|
|
|
|
to gather the module pointers so that they may be processed by the
|
|
|
|
|
initialization routines as soon as possible. */
|
|
|
|
|
|
|
|
|
|
objc_DECLARE void
|
|
|
|
|
__objc_exec_class (Module_t module)
|
|
|
|
|
@ -599,9 +614,7 @@ __objc_exec_class (Module_t module)
|
|
|
|
|
|
|
|
|
|
/* Scan the unclaimed category hash. Attempt to attach any unclaimed
|
|
|
|
|
categories to objects. */
|
|
|
|
|
for (cell = &unclaimed_categories;
|
|
|
|
|
*cell;
|
|
|
|
|
({ if (*cell) cell = &(*cell)->tail; }))
|
|
|
|
|
for (cell = &unclaimed_categories; *cell; )
|
|
|
|
|
{
|
|
|
|
|
Category_t category = (*cell)->head;
|
|
|
|
|
Class class = objc_lookup_class (category->class_name);
|
|
|
|
|
@ -630,11 +643,14 @@ __objc_exec_class (Module_t module)
|
|
|
|
|
only done for root classes. */
|
|
|
|
|
__objc_register_instance_methods_to_class (class);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
cell = &(*cell)->tail;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (unclaimed_proto_list && objc_lookup_class ("Protocol"))
|
|
|
|
|
{
|
|
|
|
|
list_mapcar (unclaimed_proto_list,(void(*)(void*))__objc_init_protocols);
|
|
|
|
|
list_mapcar (unclaimed_proto_list,
|
|
|
|
|
(void (*) (void *))__objc_init_protocols);
|
|
|
|
|
list_free (unclaimed_proto_list);
|
|
|
|
|
unclaimed_proto_list = 0;
|
|
|
|
|
}
|
|
|
|
|
@ -644,15 +660,16 @@ __objc_exec_class (Module_t module)
|
|
|
|
|
objc_mutex_unlock (__objc_runtime_mutex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void objc_send_load (void)
|
|
|
|
|
static void
|
|
|
|
|
objc_send_load (void)
|
|
|
|
|
{
|
|
|
|
|
if (! __objc_module_list)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Try to find out if all the classes loaded so far also have their
|
|
|
|
|
superclasses known to the runtime. We suppose that the objects that are
|
|
|
|
|
allocated in the +load method are in general of a class declared in the
|
|
|
|
|
same module. */
|
|
|
|
|
superclasses known to the runtime. We suppose that the objects
|
|
|
|
|
that are allocated in the +load method are in general of a class
|
|
|
|
|
declared in the same module. */
|
|
|
|
|
if (unresolved_classes)
|
|
|
|
|
{
|
|
|
|
|
Class class = unresolved_classes->head;
|
|
|
|
|
@ -666,10 +683,9 @@ static void objc_send_load (void)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* If we still have classes for whom we don't have yet their super
|
|
|
|
|
* classes known to the runtime we don't send the +load messages.
|
|
|
|
|
*/
|
|
|
|
|
/* If we still have classes for whom we don't have yet their
|
|
|
|
|
super classes known to the runtime we don't send the +load
|
|
|
|
|
messages. */
|
|
|
|
|
if (unresolved_classes)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
@ -693,10 +709,11 @@ static void objc_send_load (void)
|
|
|
|
|
return;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Iterate over all modules in the __objc_module_list and call on them the
|
|
|
|
|
__objc_create_classes_tree function. This function creates a tree of
|
|
|
|
|
classes that resembles the class hierarchy. */
|
|
|
|
|
list_mapcar (__objc_module_list, (void(*)(void*))__objc_create_classes_tree);
|
|
|
|
|
/* Iterate over all modules in the __objc_module_list and call on
|
|
|
|
|
them the __objc_create_classes_tree function. This function
|
|
|
|
|
creates a tree of classes that resembles the class hierarchy. */
|
|
|
|
|
list_mapcar (__objc_module_list,
|
|
|
|
|
(void (*) (void *)) __objc_create_classes_tree);
|
|
|
|
|
|
|
|
|
|
while (__objc_class_tree_list)
|
|
|
|
|
{
|
|
|
|
|
@ -724,8 +741,8 @@ __objc_create_classes_tree (Module_t module)
|
|
|
|
|
Symtab_t symtab = module->symtab;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* Iterate thru classes defined in this module and insert them in the classes
|
|
|
|
|
tree hierarchy. */
|
|
|
|
|
/* Iterate thru classes defined in this module and insert them in
|
|
|
|
|
the classes tree hierarchy. */
|
|
|
|
|
for (i = 0; i < symtab->cls_def_cnt; i++)
|
|
|
|
|
{
|
|
|
|
|
Class class = (Class) symtab->defs[i];
|
|
|
|
|
@ -737,13 +754,13 @@ __objc_create_classes_tree (Module_t module)
|
|
|
|
|
static void
|
|
|
|
|
__objc_call_callback (Module_t module)
|
|
|
|
|
{
|
|
|
|
|
/* The runtime mutex is locked in this point */
|
|
|
|
|
/* The runtime mutex is locked in this point. */
|
|
|
|
|
|
|
|
|
|
Symtab_t symtab = module->symtab;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* Iterate thru classes defined in this module and call the callback for
|
|
|
|
|
each one. */
|
|
|
|
|
/* Iterate thru classes defined in this module and call the callback
|
|
|
|
|
for each one. */
|
|
|
|
|
for (i = 0; i < symtab->cls_def_cnt; i++)
|
|
|
|
|
{
|
|
|
|
|
Class class = (Class) symtab->defs[i];
|
|
|
|
|
@ -753,9 +770,9 @@ __objc_call_callback (Module_t module)
|
|
|
|
|
_objc_load_callback (class, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Call the _objc_load_callback for categories. Don't register the instance
|
|
|
|
|
methods as class methods for categories to root classes since they were
|
|
|
|
|
already added in the class. */
|
|
|
|
|
/* Call the _objc_load_callback for categories. Don't register the
|
|
|
|
|
instance methods as class methods for categories to root classes
|
|
|
|
|
since they were already added in the class. */
|
|
|
|
|
for (i = 0; i < symtab->cat_def_cnt; i++)
|
|
|
|
|
{
|
|
|
|
|
Category_t category = symtab->defs[i + symtab->cls_def_cnt];
|
|
|
|
|
@ -766,8 +783,10 @@ __objc_call_callback (Module_t module)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Sanity check the version of gcc used to compile `module'*/
|
|
|
|
|
static void init_check_module_version(Module_t module)
|
|
|
|
|
/* Sanity check the version of gcc used to compile `module'. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
init_check_module_version (Module_t module)
|
|
|
|
|
{
|
|
|
|
|
if ((module->version != OBJC_VERSION) || (module->size != sizeof (Module)))
|
|
|
|
|
{
|
|
|
|
|
@ -788,7 +807,7 @@ static void init_check_module_version(Module_t module)
|
|
|
|
|
static void
|
|
|
|
|
__objc_init_protocols (struct objc_protocol_list *protos)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
size_t i;
|
|
|
|
|
static Class proto_class = 0;
|
|
|
|
|
|
|
|
|
|
if (! protos)
|
|
|
|
|
@ -825,7 +844,8 @@ __objc_init_protocols (struct objc_protocol_list* protos)
|
|
|
|
|
{
|
|
|
|
|
objc_error (nil, OBJC_ERR_PROTOCOL_VERSION,
|
|
|
|
|
"Version %d doesn't match runtime protocol version %d\n",
|
|
|
|
|
(int)((char*)protos->list[i]->class_pointer-(char*)0),
|
|
|
|
|
(int) ((char *) protos->list[i]->class_pointer
|
|
|
|
|
- (char *) 0),
|
|
|
|
|
PROTOCOL_VERSION);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -833,8 +853,8 @@ __objc_init_protocols (struct objc_protocol_list* protos)
|
|
|
|
|
objc_mutex_unlock (__objc_runtime_mutex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void __objc_class_add_protocols (Class class,
|
|
|
|
|
struct objc_protocol_list* protos)
|
|
|
|
|
static void
|
|
|
|
|
__objc_class_add_protocols (Class class, struct objc_protocol_list *protos)
|
|
|
|
|
{
|
|
|
|
|
/* Well... */
|
|
|
|
|
if (! protos)
|
|
|
|
|
|