ObjFW runtime: Add objc_msg_lookup(_super)_{fp,st}ret

Jonathan Schleifer js at webkeks.org
Mon Jul 8 17:56:41 PDT 2013

Am 08.07.2013 um 23:47 schrieb Eli Friedman:

> Err, sorry, I'm not familiar with the details of the forwarding
> handler; I was sort of assuming objc_msg_lookup just returned the
> function to call. :)

Yes, it does. However, for forwarding, it returns a function that does the forwarding instead. This function then - for the simple case - switches the target object by changing the first argument (it calls another method to retrieve that target).

For structs, however, the first argument is a pointer to the struct to return. Thus objc_msg_lookup_stret is the same as objc_msg_lookup, except that it returns a function for forwarding that switches the second argument instead of the first.

For floats (i.e. x87), this should not be required, as the first argument is still the object and the function forwarded to is required to handle the return. And I don't think there is an architecture which passes a pointer to the float to return as the first (non-float) argument, is there?

> Is this patch going to work correctly for other GNU-style runtimes
> without an objc_msg_lookup_stret function?

Yes, it only touches the behaviour for -fobjc-runtime=objfw. However, I attached a new patch to this e-mail that only adds objc_msg_lookup_stret and not objc_msg_lookup_fpret, as we already agreed that handling non-integer messages to nil should be the compiler's job and that it is not necessary for forwarding ;). Please use the new patch instead! Thanks :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Issue-calls-to-objc_msg_lookup_stret-for-the-ObjFW-r.patch
Type: application/octet-stream
Size: 7585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130709/3438540b/attachment.obj>
-------------- next part --------------


More information about the cfe-commits mailing list