On 05 Jun 08, at 22:58, Graham Cox wrote:
        call    L_objc_msgSend$stub
        leal    LC17-"L00000000012$pb"(%ebx), %ecx
        movl    %eax, %edx
        andl    $65535, %edx
        shrl    $16, %eax
        cvtsi2ss        %eax, %xmm0
        cvtsi2ss        %edx, %xmm1
        mulss   (%ecx), %xmm0
        addss   %xmm1, %xmm0
        movss   %xmm0, -44(%ebp)

This'll take the return value of objc_msgSend (in eax) and convert it to floating-point. The shift/multiply/add bit is a bit strange, but the cvtsi2ss is a clear sign of an integer->float conversion. GCC is assuming that the return value should be interpreted as an integer, then cast to a float.

        call    L_objc_msgSend_fpret$stub
        fstps   -16(%ebp)

As the _fpret suggests, this is behaving correctly.

Keep in mind that, in the x86 architecture (along with most other modern architectures), floating-point values are kept in separate registers from other values. As the Mach-O x86 ABI mandates that (non- struct) return values are returned in registers, rather than on the stack, it's therefore crucial that functions which return floating- point values have explicit prototypes.
_______________________________________________

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