On Mon, Mar 3, 2008 at 6:10 AM, Ronald Oussoren <[EMAIL PROTECTED]>
wrote:

>
> On Monday, March 03, 2008, at 11:53AM, "Duncan McGregor" <
> [EMAIL PROTECTED]> wrote:
>
> >> I can simply check the calculated size after calling ffi_prep_cif(),
> and compare that to sizeof(void*) to see if the return value will fit in a
> register.
> >
> >Is that right? 8 byte structs are returned in EAX and EDX on IA-32, so
> >I'd expect to call objc_msgSend.
>
> The rules are a bit more complex than this (at least on x86). Small
> structs are returned in registers (upto 8 bytes), but only if the size of
> the struct is a power of 2. That is, a 6-byte struct will not be returned in
> registers. I haven't checked recently if the ABI documentation reflects
> reality, in 10.4 days it didn't.


Thanks for the tip. I shall have to go diving into libffi to see exactly
what the rules really are then. I suspect they might be different for PPC &
Intel, because the PPC32 docs still say that only r3 is used, for a limit of
4 bytes.

sherm--
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to