Kaydet (Commit) c759d349 authored tarafından Herbert Dürr's avatar Herbert Dürr Kaydeden (comit) Caolán McNamara

optimization fix to UNO bridge's callVirtualMethod() for generic x86_64

if the pCallStack variable is optimized out then any assumptions of the
method's inlined assembler about stack layout collapse. Adding a pseudo
dependency to the pCallStack variable solves that problem

(cherry picked from commit 254359b9)

Conflicts:
	bridges/source/cpp_uno/gcc3_freebsd_x86-64/uno2cpp.cxx
	bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx

Change-Id: I5ba7713c2630bb3ecc4343632e796c38541bcd0e
üst 6526fda9
...@@ -63,11 +63,12 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod( ...@@ -63,11 +63,12 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod(
pMethod = *((sal_uInt64 *)pMethod); pMethod = *((sal_uInt64 *)pMethod);
// Load parameters to stack, if necessary // Load parameters to stack, if necessary
sal_uInt64* pCallStack = NULL;
if ( nStack ) if ( nStack )
{ {
// 16-bytes aligned // 16-bytes aligned
sal_uInt32 nStackBytes = ( ( nStack + 1 ) >> 1 ) * 16; sal_uInt32 nStackBytes = ( ( nStack + 1 ) >> 1 ) * 16;
sal_uInt64 *pCallStack = (sal_uInt64 *) __builtin_alloca( nStackBytes ); pCallStack = (sal_uInt64 *) __builtin_alloca( nStackBytes );
std::memcpy( pCallStack, pStack, nStackBytes ); std::memcpy( pCallStack, pStack, nStackBytes );
} }
...@@ -112,7 +113,8 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod( ...@@ -112,7 +113,8 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod(
"movsd %%xmm0, %2\n\t" "movsd %%xmm0, %2\n\t"
"movsd %%xmm1, %3\n\t" "movsd %%xmm1, %3\n\t"
: "=m" ( rax ), "=m" ( rdx ), "=m" ( xmm0 ), "=m" ( xmm1 ) : "=m" ( rax ), "=m" ( rdx ), "=m" ( xmm0 ), "=m" ( xmm1 )
: "m" ( pMethod ), "m" ( pGPR ), "m" ( pFPR ), "m" ( nFPR ) : "m" ( pMethod ), "m" ( pGPR ), "m" ( pFPR ), "m" ( nFPR ),
"m" ( pCallStack ) // dummy input to prevent the compiler from optimizing the alloca out
: "rax", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r10", "r11", : "rax", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r10", "r11",
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
"xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15" "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment