bridges/Library_cpp_uno.mk | 2 bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx | 14 + bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm.cxx | 3 bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx | 3 bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-i386.cxx | 3 bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx | 2 bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx | 11 + bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx | 130 ---------------- bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx | 1 bridges/source/cpp_uno/gcc3_macosx_intel/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_solaris_intel/cpp2uno.cxx | 3 bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx | 3 bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx | 3 bridges/source/cpp_uno/mingw_x86-64/cpp2uno.cxx | 3 bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx | 3 bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx | 3 bridges/source/cpp_uno/shared/vtablefactory.cxx | 15 + 31 files changed, 83 insertions(+), 164 deletions(-)
New commits: commit 9c9f0ea2c38929d133b0fe2faf616ecab17e07c9 Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Aug 7 18:21:08 2014 +0200 Include RTTI in generated vtables for ubsan's vptr-based checks ...though only on gcc3_linux_x86-64 for now. Change-Id: Id90554425e78b38a5a97149f2a7d3ac04cbe0c9b diff --git a/bridges/Library_cpp_uno.mk b/bridges/Library_cpp_uno.mk index d929c86..e971442 100644 --- a/bridges/Library_cpp_uno.mk +++ b/bridges/Library_cpp_uno.mk @@ -125,7 +125,7 @@ ifneq ($(filter DRAGONFLY FREEBSD LINUX NETBSD OPENBSD,$(OS)),) bridges_SELECTED_BRIDGE := gcc3_linux_x86-64 bridge_asm_objects := call bridge_noncallexception_noopt_objects := callvirtualmethod -bridge_exception_objects := abi cpp2uno except uno2cpp +bridge_exception_objects := abi cpp2uno except rtti uno2cpp else ifeq ($(OS),MACOSX) bridges_SELECTED_BRIDGE := gcc3_macosx_x86-64 bridge_exception_objects := abi call cpp2uno except uno2cpp diff --git a/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx b/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx index 613358d..5b4b06b 100644 --- a/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx +++ b/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx @@ -128,9 +128,11 @@ private: void freeBlock(Block const & block) const; - void createVtables( + sal_Int32 createVtables( GuardedBlocks & blocks, BaseOffset const & baseOffset, - typelib_InterfaceTypeDescription * type, bool includePrimary) const; + typelib_InterfaceTypeDescription * type, sal_Int32 vtableNumber, + typelib_InterfaceTypeDescription * mostDerived, bool includePrimary) + const; // This function is not defined in the generic part, but instead has to be // defined individually for each CPP--UNO bridge: @@ -150,9 +152,15 @@ private: @param block the start address of the raw vtable block @param slotCount the number of slots + @param vtableNumber zero-based count across all the most derived type's + vtables (for vtable's "offset to top" slot) + @param type non-null most derived type (for vtable's "typeinfo pointer" + slot) @return a pointer past the last vtable slot */ - static Slot * initializeBlock(void * block, sal_Int32 slotCount); + static Slot * initializeBlock( + void * block, sal_Int32 slotCount, sal_Int32 vtableNumber, + typelib_InterfaceTypeDescription * type); // This function is not defined in the generic part, but instead has to be // defined individually for each CPP--UNO bridge: diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx index d98d32f..33bb5fa 100644 --- a/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_aix_powerpc/cpp2uno.cxx @@ -579,7 +579,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm.cxx index 526ba8b..2c02610 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm.cxx @@ -507,7 +507,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx index bfea969..3a67648 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-arm64.cxx @@ -498,7 +498,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-i386.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-i386.cxx index 4d10b1c..0aa8f5b 100644 --- a/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-i386.cxx +++ b/bridges/source/cpp_uno/gcc3_ios_arm/cpp2uno-i386.cxx @@ -469,7 +469,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx index 7996762..c784d01 100644 --- a/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/cpp2uno.cxx @@ -592,7 +592,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx index 0c7666a..b717a4f 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/cpp2uno.cxx @@ -497,7 +497,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx index bff59bf..b04928f 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/cpp2uno.cxx @@ -642,7 +642,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx index b638d6c..e8ef62e 100644 --- a/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_ia64/cpp2uno.cxx @@ -598,7 +598,7 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize; } -bridges::cpp_uno::shared::VtableFactory::Slot* bridges::cpp_uno::shared::VtableFactory::initializeBlock(void * block, sal_Int32 slotCount) +bridges::cpp_uno::shared::VtableFactory::Slot* bridges::cpp_uno::shared::VtableFactory::initializeBlock(void * block, sal_Int32 slotCount, sal_Int32, typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); Slot foo = {0,0}; diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx index defe5aa..d73d2c0 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/cpp2uno.cxx @@ -443,7 +443,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx index aa78fce..5e963eb 100644 --- a/bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_m68k/cpp2uno.cxx @@ -454,7 +454,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx index f54ec5e..96b7cbf 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips/cpp2uno.cxx @@ -731,7 +731,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; //null diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx index 889046c..fed9622 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/cpp2uno.cxx @@ -709,7 +709,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx index 5d7d9d9..a4a08c5 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx @@ -639,7 +639,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx index 7fcefed..3ffe81b 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390/cpp2uno.cxx @@ -609,7 +609,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx index 35b26d7..edcdd9c 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390x/cpp2uno.cxx @@ -572,7 +572,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx index b4fddaa..52eb13f 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc/cpp2uno.cxx @@ -487,7 +487,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; //null 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 9bb5149..dd6537d 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/uno/genfunc.hxx> #include "com/sun/star/uno/RuntimeException.hpp" +#include <config_options.h> #include <uno/data.h> #include <typelib/typedescription.hxx> @@ -37,6 +38,7 @@ #include "abi.hxx" #include "call.hxx" +#include "rtti.hxx" #include "share.hxx" using namespace ::osl; @@ -448,11 +450,16 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32 vtableNumber, + typelib_InterfaceTypeDescription * type) { Slot * slots = mapBlockToVtable(block); - slots[-2].fn = 0; + slots[-2].fn = reinterpret_cast<void *>(-(vtableNumber * sizeof (void *))); +#if ENABLE_RUNTIME_OPTIMIZATIONS slots[-1].fn = 0; +#else + slots[-1].fn = x86_64::getRtti(type->aBase); +#endif return slots + slotCount; } diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx index 64386b3..ad3ce26 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/except.cxx @@ -20,15 +20,9 @@ #include <stdio.h> #include <string.h> -#include <dlfcn.h> -#include <boost/unordered_map.hpp> - -#include <rtl/strbuf.hxx> #include <rtl/ustrbuf.hxx> -#include <rtl/instance.hxx> #include <osl/diagnose.h> -#include <osl/mutex.hxx> #include <sal/log.hxx> #include <com/sun/star/uno/genfunc.hxx> @@ -36,6 +30,7 @@ #include <typelib/typedescription.hxx> #include <uno/any2.h> +#include "rtti.hxx" #include "share.hxx" @@ -86,121 +81,6 @@ static OUString toUNOname( char const * p ) #endif } -class RTTI -{ - typedef boost::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map; - - Mutex m_mutex; - t_rtti_map m_rttis; - t_rtti_map m_generatedRttis; - - void * m_hApp; - -public: - RTTI(); - ~RTTI(); - - type_info * getRTTI( typelib_CompoundTypeDescription * ); -}; - -RTTI::RTTI() -#if defined(FREEBSD) && __FreeBSD_version < 702104 - : m_hApp( dlopen( 0, RTLD_NOW | RTLD_GLOBAL ) ) -#else - : m_hApp( dlopen( 0, RTLD_LAZY ) ) -#endif -{ -} - -RTTI::~RTTI() -{ - dlclose( m_hApp ); -} - - -type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) -{ - type_info * rtti; - - OUString const & unoName = *(OUString const *)&pTypeDescr->aBase.pTypeName; - - MutexGuard guard( m_mutex ); - t_rtti_map::const_iterator iFind( m_rttis.find( unoName ) ); - if (iFind == m_rttis.end()) - { - // RTTI symbol - OStringBuffer buf( 64 ); - buf.append( "_ZTIN" ); - sal_Int32 index = 0; - do - { - OUString token( unoName.getToken( 0, '.', index ) ); - buf.append( token.getLength() ); - OString c_token( OUStringToOString( token, RTL_TEXTENCODING_ASCII_US ) ); - buf.append( c_token ); - } - while (index >= 0); - buf.append( 'E' ); - - OString symName( buf.makeStringAndClear() ); -#if defined(FREEBSD) && __FreeBSD_version < 702104 /* #i22253# */ - rtti = (type_info *)dlsym( RTLD_DEFAULT, symName.getStr() ); -#else - rtti = (type_info *)dlsym( m_hApp, symName.getStr() ); -#endif - - if (rtti) - { - pair< t_rtti_map::iterator, bool > insertion ( - m_rttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - SAL_WARN_IF( !insertion.second, "bridges", "key " << unoName << " already in rtti map" ); - } - else - { - // try to lookup the symbol in the generated rtti map - t_rtti_map::const_iterator iFind2( m_generatedRttis.find( unoName ) ); - if (iFind2 == m_generatedRttis.end()) - { - // we must generate it ! - // symbol and rtti-name is nearly identical, - // the symbol is prefixed with _ZTI - char const * rttiName = symName.getStr() +4; -#if OSL_DEBUG_LEVEL > 1 - fprintf( stderr,"generated rtti for %s\n", rttiName ); -#endif - if (pTypeDescr->pBaseTypeDescription) - { - // ensure availability of base - type_info * base_rtti = getRTTI( - (typelib_CompoundTypeDescription *)pTypeDescr->pBaseTypeDescription ); - rtti = new __si_class_type_info( - strdup( rttiName ), (__class_type_info *)base_rtti ); - } - else - { - // this class has no base class - rtti = new __class_type_info( strdup( rttiName ) ); - } - - pair< t_rtti_map::iterator, bool > insertion ( - m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); - SAL_WARN_IF( !insertion.second, "bridges", "key " << unoName << " already in generated rtti map" ); - } - else // taking already generated rtti - { - rtti = iFind2->second; - } - } - } - else - { - rtti = iFind->second; - } - - return rtti; -} - - extern "C" { static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc ) { @@ -217,11 +97,6 @@ static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc ) } } -namespace -{ - struct theRTTI : public rtl::Static<RTTI, theRTTI> {}; -} - void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) { #if OSL_DEBUG_LEVEL > 1 @@ -252,8 +127,7 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) // destruct uno exception ::uno_any_destruct( pUnoExc, 0 ); // avoiding locked counts - static RTTI &rRTTI = theRTTI::get(); - rtti = rRTTI.getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr ); + rtti = x86_64::getRtti(*pTypeDescr); TYPELIB_DANGER_RELEASE( pTypeDescr ); OSL_ENSURE( rtti, "### no rtti for throwing exception!" ); if (! rtti) diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx index 732fe5b..96ddfc0 100644 --- a/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx +++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/share.hxx @@ -29,6 +29,7 @@ #endif #include "config_gcc.h" +#include "uno/any2.h" #include "uno/mapping.h" #ifdef _LIBCPP_VERSION diff --git a/bridges/source/cpp_uno/gcc3_macosx_intel/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_macosx_intel/cpp2uno.cxx index 2ab17ef..47a21f1 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_intel/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_intel/cpp2uno.cxx @@ -450,7 +450,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx index f9e1cde..0cba20d 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/cpp2uno.cxx @@ -665,7 +665,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx index 9925937..d6d23f9 100644 --- a/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_macosx_x86-64/cpp2uno.cxx @@ -441,7 +441,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_solaris_intel/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_solaris_intel/cpp2uno.cxx index 2b3576b..5957a0d 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_intel/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_intel/cpp2uno.cxx @@ -438,7 +438,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx index f42a455..a1c65ef 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/cpp2uno.cxx @@ -485,7 +485,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; //null diff --git a/bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx b/bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx index 184c468..3cbff63 100644 --- a/bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx +++ b/bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx @@ -434,7 +434,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/mingw_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/mingw_x86-64/cpp2uno.cxx index 25d9497..39eb28b 100644 --- a/bridges/source/cpp_uno/mingw_x86-64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/mingw_x86-64/cpp2uno.cxx @@ -441,7 +441,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { Slot * slots = mapBlockToVtable(block); slots[-2].fn = 0; diff --git a/bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx b/bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx index 58e3fbc..3712547 100644 --- a/bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx +++ b/bridges/source/cpp_uno/msvc_win32_intel/cpp2uno.cxx @@ -432,7 +432,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( - void * block, sal_Int32 slotCount) + void * block, sal_Int32 slotCount, sal_Int32, + typelib_InterfaceTypeDescription *) { struct Rtti { sal_Int32 n0, n1, n2; diff --git a/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx index 43cdf94..555bee1 100644 --- a/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx +++ b/bridges/source/cpp_uno/msvc_win32_x86-64/cpp2uno.cxx @@ -447,7 +447,8 @@ sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize( bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::initializeBlock( void * block, - sal_Int32 slotCount ) + sal_Int32 slotCount, + sal_Int32, typelib_InterfaceTypeDescription * ) { struct Rtti { sal_Int32 n0, n1, n2; diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx index 2589f64..325f9e3 100644 --- a/bridges/source/cpp_uno/shared/vtablefactory.cxx +++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx @@ -207,7 +207,7 @@ VtableFactory::Vtables VtableFactory::getVtables( Map::iterator i(m_map.find(name)); if (i == m_map.end()) { GuardedBlocks blocks(*this); - createVtables(blocks, BaseOffset(type), type, true); + createVtables(blocks, BaseOffset(type), type, 0, type, true); Vtables vtables; OSL_ASSERT(blocks.size() <= SAL_MAX_INT32); vtables.count = static_cast< sal_Int32 >(blocks.size()); @@ -323,9 +323,10 @@ void VtableFactory::freeBlock(Block const & block) const { } #endif -void VtableFactory::createVtables( +sal_Int32 VtableFactory::createVtables( GuardedBlocks & blocks, BaseOffset const & baseOffset, - typelib_InterfaceTypeDescription * type, bool includePrimary) const + typelib_InterfaceTypeDescription * type, sal_Int32 vtableNumber, + typelib_InterfaceTypeDescription * mostDerived, bool includePrimary) const { if (includePrimary) { sal_Int32 slotCount @@ -335,7 +336,8 @@ void VtableFactory::createVtables( throw std::bad_alloc(); } try { - Slot * slots = initializeBlock(block.start, slotCount); + Slot * slots = initializeBlock( + block.start, slotCount, vtableNumber, mostDerived); unsigned char * codeBegin = reinterpret_cast< unsigned char * >(slots); unsigned char * code = codeBegin; @@ -366,8 +368,11 @@ void VtableFactory::createVtables( } } for (sal_Int32 i = 0; i < type->nBaseTypes; ++i) { - createVtables(blocks, baseOffset, type->ppBaseTypes[i], i != 0); + vtableNumber = createVtables( + blocks, baseOffset, type->ppBaseTypes[i], + vtableNumber + (i == 0 ? 0 : 1), mostDerived, i != 0); } + return vtableNumber; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits