diff options
Diffstat (limited to 'bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx')
-rw-r--r-- | bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx index de393582f99a..14673ab7d5e2 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx @@ -18,10 +18,6 @@ */ -#include <stdio.h> -#include <stdlib.h> - -#include <rtl/alloc.h> #include <sal/log.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -37,9 +33,12 @@ #include "abi.hxx" #include "call.hxx" -#include "rtti.hxx" #include "share.hxx" +#if !ENABLE_RUNTIME_OPTIMIZATIONS +#include "rtti.hxx" +#endif + using namespace ::com::sun::star::uno; // Perform the UNO call @@ -442,16 +441,10 @@ static unsigned char * codeSnippet( unsigned char * code, // jmpq *%r11 *reinterpret_cast<sal_uInt32 *>( code + 20 ) = 0x00e3ff49; -#if OSL_DEBUG_LEVEL > 1 - fprintf(stderr, - "==> codeSnippet, functionIndex=%d%s, vtableOffset=%d\n", - nFunctionIndex, (bHasHiddenParam ? "|0x80000000":""), nVtableOffset); -#endif - return code + codeSnippetSize; } -struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; }; +struct bridges::cpp_uno::shared::VtableFactory::Slot { void const * fn; }; bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block) @@ -465,17 +458,27 @@ std::size_t bridges::cpp_uno::shared::VtableFactory::getBlockSize( return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize; } +#if ENABLE_RUNTIME_OPTIMIZATIONS +namespace { +// Some dummy type whose RTTI is used in the synthesized proxy vtables to make uses of dynamic_cast +// on such proxy objects not crash: +struct ProxyRtti {}; +} +#endif + bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( void * block, sal_Int32 slotCount, sal_Int32 vtableNumber, typelib_InterfaceTypeDescription * type) { Slot * slots = mapBlockToVtable(block); - slots[-2].fn = reinterpret_cast<void *>(-(vtableNumber * sizeof (void *))); #if ENABLE_RUNTIME_OPTIMIZATIONS - slots[-1].fn = nullptr; + slots[-2].fn = nullptr; + slots[-1].fn = &typeid(ProxyRtti); + (void)vtableNumber; (void)type; #else + slots[-2].fn = reinterpret_cast<void *>(-(vtableNumber * sizeof (void *))); slots[-1].fn = x86_64::getRtti(type->aBase); #endif return slots + slotCount; |