Store the selector, not the type encoding, in slots.

This commit is contained in:
theraven 2011-04-22 12:13:28 +00:00
parent bd48461fb9
commit 535ba87a8e
4 changed files with 5 additions and 5 deletions

View File

@ -31,8 +31,8 @@ struct objc_slot
* to the same object and sharing a cached slot then it may also improve
* cache hits. Profiling is probably required here. */
Class cachedFor;
/** The type encoding for the method identified by this slot. */
const char *types;
/** The (typed) selector for the method identified by this slot. */
SEL selector;
/** The current version. This changes if the method changes or if a
* subclass overrides this method, potentially invalidating this cache. */
int version;

View File

@ -302,7 +302,7 @@ Method class_getInstanceMethod(Class aClass, SEL aSelector)
if (NULL == slot) { return NULL; }
// Now find the typed variant of the selector, with the correct types.
aSelector = sel_registerTypedName_np(sel_getName(aSelector), slot->types);
aSelector = slot->selector;
// Then do the slow lookup to find the method.
return class_getInstanceMethodNonrecursive(slot->owner, aSelector);

View File

@ -12,7 +12,7 @@ void objc_send_initialize(id object);
static id nil_method(id self, SEL _cmd) { return nil; }
static struct objc_slot nil_slot = { Nil, Nil, "", 1, (IMP)nil_method };
static struct objc_slot nil_slot = { Nil, Nil, 0, 1, (IMP)nil_method };
typedef struct objc_slot *Slot_t;

View File

@ -10,7 +10,7 @@ static inline struct objc_slot *new_slot_for_method_in_class(Method method,
{
struct objc_slot *slot = slot_pool_alloc();
slot->owner = class;
slot->types = method->types;
slot->selector = method->selector;
slot->method = method->imp;
slot->version = 1;
return slot;