diff options
author | Herbert Dürr <hdu@apache.org> | 2013-04-30 11:57:36 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-29 10:03:27 +0100 |
commit | c759d349f235d74508c2f8af4e85cc313897a361 (patch) | |
tree | 0c7136cb4e27572c7c7627479d0bf60a3ade54e4 /bridges | |
parent | 6526fda99f9133736906f326dde5cf48f967fcee (diff) |
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 254359b9ed96152091b8f7a74a3442cf6c553e04)
Conflicts:
bridges/source/cpp_uno/gcc3_freebsd_x86-64/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
Change-Id: I5ba7713c2630bb3ecc4343632e796c38541bcd0e
Diffstat (limited to 'bridges')
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx index 3b6cd4a000e9..47b8f13a9c29 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx @@ -63,11 +63,12 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod( pMethod = *((sal_uInt64 *)pMethod); // Load parameters to stack, if necessary + sal_uInt64* pCallStack = NULL; if ( nStack ) { // 16-bytes aligned 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 ); } @@ -112,7 +113,8 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod( "movsd %%xmm0, %2\n\t" "movsd %%xmm1, %3\n\t" : "=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", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15" |