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:
parent
a73cc93d21
commit
b0cf41de08
@ -566,8 +566,19 @@ jit_rewind:
|
|||||||
|
|
||||||
if ((pRet->type == PassType_Object) && (pRet->flags & PASSFLAG_BYVAL))
|
if ((pRet->type == PassType_Object) && (pRet->flags & PASSFLAG_BYVAL))
|
||||||
{
|
{
|
||||||
#ifdef PLATFORM_POSIX
|
#ifdef PLATFORM_LINUX
|
||||||
Needs_Retbuf = true;
|
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
|
#elif defined PLATFORM_WINDOWS
|
||||||
if ((Convention == CallConv_ThisCall) ||
|
if ((Convention == CallConv_ThisCall) ||
|
||||||
((Convention == CallConv_Cdecl) &&
|
((Convention == CallConv_Cdecl) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user