173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
{
const char *superclass;
if (cls->info & OBJC_CLASS_INFO_SETUP)
return;
if ((superclass = ((struct objc_abi_class*)cls)->superclass) != NULL) {
if ((cls->superclass = objc_lookup_class(superclass)) == Nil)
return;
cls->isa->superclass = cls->superclass->isa;
add_subclass(cls);
add_subclass(cls->isa);
} else
cls->isa->superclass = cls;
objc_update_dtable(cls);
objc_update_dtable(cls->isa);
cls->info |= OBJC_CLASS_INFO_SETUP;
cls->isa->info |= OBJC_CLASS_INFO_SETUP;
}
void
objc_register_all_classes(struct objc_abi_symtab *symtab)
{
size_t i;
for (i = 0; i < symtab->cls_def_cnt; i++)
|
>
>
>
>
>
|
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
{
const char *superclass;
if (cls->info & OBJC_CLASS_INFO_SETUP)
return;
if ((superclass = ((struct objc_abi_class*)cls)->superclass) != NULL) {
Class super = objc_classname_to_class(superclass);
if (super == nil)
return;
setup_class(super);
if (!(super->info & OBJC_CLASS_INFO_SETUP))
return;
cls->superclass = super;
cls->isa->superclass = super->isa;
add_subclass(cls);
add_subclass(cls->isa);
} else
cls->isa->superclass = cls;
objc_update_dtable(cls);
objc_update_dtable(cls->isa);
cls->info |= OBJC_CLASS_INFO_SETUP;
cls->isa->info |= OBJC_CLASS_INFO_SETUP;
}
static void
initialize_class(Class cls)
{
if (cls->info & OBJC_CLASS_INFO_INITIALIZED)
return;
if (cls->superclass)
initialize_class(cls->superclass);
/*
* Set it first to prevent calling it recursively due to message sends
* in the initialize method
*/
cls->info |= OBJC_CLASS_INFO_INITIALIZED;
cls->isa->info |= OBJC_CLASS_INFO_INITIALIZED;
call_method(cls, "initialize");
}
void
objc_register_all_classes(struct objc_abi_symtab *symtab)
{
size_t i;
for (i = 0; i < symtab->cls_def_cnt; i++)
|
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
|
setup_class(cls);
if (!(cls->info & OBJC_CLASS_INFO_SETUP)) {
objc_global_mutex_unlock();
return Nil;
}
/* Set it first to prevent calling it recursively */
cls->info |= OBJC_CLASS_INFO_INITIALIZED;
cls->isa->info |= OBJC_CLASS_INFO_INITIALIZED;
call_method(cls, "initialize");
objc_global_mutex_unlock();
return cls;
}
Class
|
<
<
<
<
|
|
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
setup_class(cls);
if (!(cls->info & OBJC_CLASS_INFO_SETUP)) {
objc_global_mutex_unlock();
return Nil;
}
initialize_class(cls);
objc_global_mutex_unlock();
return cls;
}
Class
|