Fixed hash functions.

Tweaked class resolve function to make sure that it keeps scanning the list as long as one or more classes is resolved while scanning it.
main
theraven 16 years ago
parent 13964517ef
commit 4ea82e14da

@ -16,13 +16,13 @@ void __objc_compute_ivar_offsets(Class class);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// +load method hash table // +load method hash table
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static int imp_compare(IMP i1, IMP i2) static int imp_compare(const void *i1, void *i2)
{ {
return i1 == i2; return i1 == i2;
} }
static int imp_hash(const IMP imp) static int32_t imp_hash(const void *imp)
{ {
return ((int)(intptr_t)imp) >> 4; return (int32_t)(((uintptr_t)imp) >> 4);
} }
#define MAP_TABLE_NAME load_messages #define MAP_TABLE_NAME load_messages
#define MAP_TABLE_COMPARE_FUNCTION imp_compare #define MAP_TABLE_COMPARE_FUNCTION imp_compare
@ -230,12 +230,22 @@ void __objc_resolve_class_links(void)
{ {
LOCK_UNTIL_RETURN(__objc_runtime_mutex); LOCK_UNTIL_RETURN(__objc_runtime_mutex);
Class class = unresolved_class_list; Class class = unresolved_class_list;
while ((Nil != class)) BOOL resolvedClass;
do
{ {
Class next = class->unresolved_class_next; resolvedClass = NO;
objc_resolve_class(class); while ((Nil != class))
class = next; {
} Class next = class->unresolved_class_next;
objc_resolve_class(class);
if (resolvedClass ||
objc_test_class_flag(class, objc_class_flag_resolved))
{
resolvedClass = YES;
}
class = next;
}
} while (resolvedClass);
} }
// FIXME: Remove this once all uses of it in the runtime have been removed // FIXME: Remove this once all uses of it in the runtime have been removed

Loading…
Cancel
Save