From 535ba87a8e202bed17d6be317c867d70cb707b5f Mon Sep 17 00:00:00 2001 From: theraven Date: Fri, 22 Apr 2011 12:13:28 +0000 Subject: [PATCH] Store the selector, not the type encoding, in slots. --- objc/slot.h | 4 ++-- runtime.c | 2 +- sendmsg2.c | 2 +- slot_pool.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/objc/slot.h b/objc/slot.h index ef737ba..761c6df 100644 --- a/objc/slot.h +++ b/objc/slot.h @@ -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; diff --git a/runtime.c b/runtime.c index 8c982d1..22bf00a 100644 --- a/runtime.c +++ b/runtime.c @@ -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); diff --git a/sendmsg2.c b/sendmsg2.c index d55c397..f521e53 100644 --- a/sendmsg2.c +++ b/sendmsg2.c @@ -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; diff --git a/slot_pool.h b/slot_pool.h index 42e2e9c..7bbd0ee 100644 --- a/slot_pool.h +++ b/slot_pool.h @@ -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;