[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Forwarding and the GNU runtime one more time (was ANN: GNUstep 2.6.0
From: |
David Chisnall |
Subject: |
Re: Forwarding and the GNU runtime one more time (was ANN: GNUstep 2.6.0 for openSUSE 11.4) |
Date: |
Wed, 22 Jun 2011 09:45:43 +0100 |
On 22 Jun 2011, at 09:37, Nat! wrote:
> Well what I am trying to achieve, is just what I wrote (why doesn't anyone
> seem to believe me :)). I want to lookup an implementation as fast as
> possible and note if it is forwarding or not at the same time. If I have to
> do it in two steps, it's just going to be a bit slower. But I'll probably
> have to do that.
You can't do this with a single step in GNUstep, because the IMP that you
actually get for forwarding is a closure generated with libffi based on the
types of the arguments. Note that this ignores the case where you're using a
mechanism like -forwardingTargetForSelector: (which you can't currently with
the GCC runtime, but can with the GNUstep runtime and the non-fragile ABI) that
modifies the receiver but does a normal message send without constructing an
NSInvocation.
The only reliable way of doing this is to first call
class_respondsToSelector(), then call class_getMethodImplementation().
Trying to combine the two steps is almost certainly a case of premature
optimisation. Why do you care if it's forwarded or not? If it's likely to be
invoking the forwarding mechanism, then it costs around 300 times as much as a
normal message send, so avoiding one call is basically a waste of effort.
David
-- Sent from my Apple II
- Forwarding and the GNU runtime one more time (was ANN: GNUstep 2.6.0 for openSUSE 11.4), Nat!, 2011/06/21
- RE: Forwarding and the GNU runtime one more time (was ANN : GNUstep 2.6.0 for openSUSE 11.4), Nicola Pero, 2011/06/21
- Re: Forwarding and the GNU runtime one more time (was ANN: GNUstep 2.6.0 for openSUSE 11.4), David Chisnall, 2011/06/22
- Re: Forwarding and the GNU runtime one more time (was ANN: GNUstep 2.6.0 for openSUSE 11.4), Nat!, 2011/06/22
- Re: Forwarding and the GNU runtime one more time (was ANN: GNUstep 2.6.0 for openSUSE 11.4), David Chisnall, 2011/06/22
- Re: Forwarding and the GNU runtime one more time (was ANN : GNUstep 2.6.0 for openSUSE 11.4), Nicola Pero, 2011/06/22
- Re: Forwarding and the GNU runtime one more time (was ANN: GNUstep 2.6.0 for openSUSE 11.4), Nat!, 2011/06/22
- Re: Forwarding and the GNU runtime one more time (was ANN : GNUstep 2.6.0 for openSUSE 11.4), Nicola Pero, 2011/06/22
- Re: Forwarding and the GNU runtime one more time (was ANN: GNUstep 2.6.0 for openSUSE 11.4), David Chisnall, 2011/06/22