From 160d1ce829f4ab8358f94ce806417eb2cca4699e Mon Sep 17 00:00:00 2001 From: theraven Date: Sat, 1 May 2010 13:54:47 +0000 Subject: [PATCH] Added cachable version of the message-to-super lookup function. Clang now calls this in preference to the other one when -fobjc-nonfragile-abi is specified. --- sendmsg2.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sendmsg2.c b/sendmsg2.c index 4b7fd19..ab3f304 100644 --- a/sendmsg2.c +++ b/sendmsg2.c @@ -111,6 +111,27 @@ Slot_t objc_msg_lookup_sender(id *receiver, SEL selector, id sender) return objc_plane_lookup(receiver, selector, sender); } +Slot_t objc_slot_lookup_super(Super_t super, SEL selector) +{ + id receiver = super->self; + if (receiver) + { + Class class = super->class; + Slot_t result = sarray_get_safe(class->dtable, (sidx)selector->sel_id); + if (0 == result) + { + // Dtable should always be installed in the superclass + assert(dtable_for_class(class) != __objc_uninstalled_dtable); + result = &nil_slot; + } + return result; + } + else + { + return &nil_slot; + } +} + #ifdef PROFILE /** * Mutex used to protect non-thread-safe parts of the profiling subsystem. @@ -119,11 +140,11 @@ static mutex_t profileLock; /** * File used for writing the profiling symbol table. */ -FILE *profileSymbols; +static FILE *profileSymbols; /** * File used for writing the profiling data. */ -FILE *profileData; +static FILE *profileData; struct profile_info {