mirror of
https://github.com/darlinghq/darling-libobjc2.git
synced 2024-11-23 20:29:50 +00:00
Store the selector, not the type encoding, in slots.
This commit is contained in:
parent
bd48461fb9
commit
535ba87a8e
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user