Fixed potential problem when using bintools to call functions that return objects by value on OS X (bug 4392, r=dvander).

Objects are only returned in memory when their sizes are greater than 8 or are not a power of 2.
This commit is contained in:
Scott Ehlert 2010-05-29 00:22:21 -05:00
parent a73cc93d21
commit b0cf41de08

View File

@ -566,8 +566,19 @@ jit_rewind:
if ((pRet->type == PassType_Object) && (pRet->flags & PASSFLAG_BYVAL))
{
#ifdef PLATFORM_POSIX
#ifdef PLATFORM_LINUX
Needs_Retbuf = true;
#elif defined PLATFORM_APPLE
/*
* On OS X, need retbuf if size > 8 or not power of 2.
*
* See Mac OS X ABI Function Call Guide:
* http://developer.apple.com/mac/library/DOCUMENTATION/DeveloperTools/Conceptual/LowLevelABI/130-IA-32_Function_Calling_Conventions/IA32.html#//apple_ref/doc/uid/TP40002492-SW5
*/
if (pRet->size > 8 || (pRet->size & (pRet->size - 1)) != 0)
{
Needs_Retbuf = true;
}
#elif defined PLATFORM_WINDOWS
if ((Convention == CallConv_ThisCall) ||
((Convention == CallConv_Cdecl) &&