• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Returning values from objc_msgSend etc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Returning values from objc_msgSend etc


  • Subject: Re: Returning values from objc_msgSend etc
  • From: "Sherm Pendley" <email@hidden>
  • Date: Mon, 3 Mar 2008 06:54:22 -0500

On Mon, Mar 3, 2008 at 6:10 AM, Ronald Oussoren <email@hidden>
wrote:

>
> On Monday, March 03, 2008, at 11:53AM, "Duncan McGregor" <
> email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden

References: 
 >Re: Returning values from objc_msgSend etc (From: "Sherm Pendley" <email@hidden>)
 >Re: Returning values from objc_msgSend etc (From: Greg Parker <email@hidden>)
 >Re: Returning values from objc_msgSend etc (From: "Sherm Pendley" <email@hidden>)
 >Re: Returning values from objc_msgSend etc (From: "Duncan McGregor" <email@hidden>)
 >Re: Returning values from objc_msgSend etc (From: Ronald Oussoren <email@hidden>)

  • Prev by Date: Re. Cascading windows in document architectures
  • Next by Date: Unit Tests - mainWindow, keyWindow
  • Previous by thread: Re: Returning values from objc_msgSend etc
  • Next by thread: Re: Returning values from objc_msgSend etc
  • Index(es):
    • Date
    • Thread