diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2009-01-20 16:36:21 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2009-01-20 16:36:21 +0000 |
commit | 314e33493a9f3ea455fc2aead0d1b0fd683db2be (patch) | |
tree | be19cd93f360dec57c3a59008a2697588fd29e0d | |
parent | CWS-TOOLING: integrate CWS selinux01 (diff) | |
download | core-314e33493a9f3ea455fc2aead0d1b0fd683db2be.tar.gz core-314e33493a9f3ea455fc2aead0d1b0fd683db2be.zip |
CWS-TOOLING: integrate CWS mingwport16
2009-01-15 13:11:20 +0100 releng r266363 : tidy-up tabs
2008-11-28 15:33:23 +0100 tono r264557 : i95203: mingw build without stlport
2008-11-22 07:19:50 +0100 tono r264180 : i96436: make mingw bridge conform with reg-struct-return
2008-11-22 05:14:58 +0100 tono r264179 : i96436: make mingw bridge conform with reg-struct-return
2008-11-21 17:09:04 +0100 tono r264153 : i95203: mingw build without stlport
2008-11-21 16:59:55 +0100 tono r264152 : i96436: make mingw bridge conform with reg-struct-return
2008-11-21 16:59:18 +0100 tono r264151 : i96436: make mingw bridge conform with reg-struct-return
2008-11-21 16:57:01 +0100 tono r264150 : i96436: make mingw bridge conform with reg-struct-return
2008-11-21 16:53:19 +0100 tono r264149 : i96100: mingw port for icu 4.0
2008-11-13 13:41:13 +0100 tono r263643 : i95203: mingw: Build without stlport
2008-11-13 13:29:38 +0100 tono r263640 : i96100: MinGW port for icu 4.0
2008-11-13 13:17:10 +0100 tono r263634 : i96098: MinGW port fix for new Windows API
2008-11-09 15:22:59 +0100 tono r263497 : i95198: mingwport do not interfere with Cygwin
2008-11-09 14:44:54 +0100 tono r263496 : i95190: mingwport avoid use of MS assembler
2008-11-09 14:32:26 +0100 tono r263495 : i95190: mingwport trivial build fixes
-rw-r--r-- | bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx | 49 | ||||
-rw-r--r-- | bridges/source/cpp_uno/mingw_intel/makefile.mk | 1 | ||||
-rw-r--r-- | bridges/source/cpp_uno/mingw_intel/smallstruct.cxx | 82 | ||||
-rw-r--r-- | bridges/source/cpp_uno/mingw_intel/smallstruct.hxx | 38 | ||||
-rw-r--r-- | bridges/source/cpp_uno/mingw_intel/uno2cpp.cxx | 36 | ||||
-rw-r--r-- | sal/util/makefile.mk | 9 |
6 files changed, 193 insertions, 22 deletions
diff --git a/bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx b/bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx index 73a32a67f9e7..f9ffe7c1a46d 100644 --- a/bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx +++ b/bridges/source/cpp_uno/mingw_intel/cpp2uno.cxx @@ -43,6 +43,7 @@ #include "bridges/cpp_uno/shared/vtablefactory.hxx" #include "share.hxx" +#include "smallstruct.hxx" using namespace ::com::sun::star::uno; @@ -77,8 +78,13 @@ void cpp2uno_call( } else // complex return via ptr (pCppReturn) { - pCppReturn = *(void **)pCppStack; - pCppStack += sizeof(void *); + if (!bridges::cpp_uno::shared::isSmallStruct(pReturnTypeDescr)) { + pCppReturn = *(void **)pCppStack; + pCppStack += sizeof(void *); + } + else { + pCppReturn = pReturnValue; + } pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr ) @@ -216,8 +222,9 @@ void cpp2uno_call( // destroy temp uno return uno_destructData( pUnoReturn, pReturnTypeDescr, 0 ); } - // complex return ptr is set to eax - *static_cast< void ** >(pReturnValue) = pCppReturn; + if (pReturnValue != pCppReturn) + // complex return ptr is set to eax + *static_cast< void ** >(pReturnValue) = pCppReturn; } if (pReturnTypeDescr) { @@ -364,9 +371,15 @@ int const codeSnippetSize = 16; unsigned char * codeSnippet( unsigned char * code, sal_Int32 functionIndex, sal_Int32 vtableOffset, - typelib_TypeClass returnTypeClass) + typelib_TypeDescriptionReference * returnType) { - if (!bridges::cpp_uno::shared::isSimpleType(returnTypeClass)) { + typelib_TypeDescription * returnTypeDescr = 0; + if (returnType) + TYPELIB_DANGER_GET( &returnTypeDescr, returnType ); + + typelib_TypeClass returnTypeClass = returnType ? returnType->eTypeClass : typelib_TypeClass_VOID; + if (!bridges::cpp_uno::shared::isSimpleType(returnTypeClass) && + !bridges::cpp_uno::shared::isSmallStruct(returnTypeDescr)) { functionIndex |= 0x80000000; } PrivateSnippetExecutor exec; @@ -384,18 +397,32 @@ unsigned char * codeSnippet( case typelib_TypeClass_DOUBLE: exec = privateSnippetExecutorDouble; break; + case typelib_TypeClass_STRUCT: + if (bridges::cpp_uno::shared::isSmallStruct(returnTypeDescr)) { + if (returnType->pType->nSize <= 4) { + exec = privateSnippetExecutorGeneral; + } + else if (returnType->pType->nSize <= 8) { + exec = privateSnippetExecutorHyper; + } + } + else { + exec = privateSnippetExecutorClass; + } + break; case typelib_TypeClass_STRING: case typelib_TypeClass_TYPE: case typelib_TypeClass_ANY: case typelib_TypeClass_SEQUENCE: - case typelib_TypeClass_STRUCT: case typelib_TypeClass_INTERFACE: - exec = privateSnippetExecutorClass; + exec = privateSnippetExecutorClass; break; default: exec = privateSnippetExecutorGeneral; break; } + if (returnType) + TYPELIB_DANGER_RELEASE( returnTypeDescr ); unsigned char * p = code; OSL_ASSERT(sizeof (sal_Int32) == 4); // mov function_index, %eax: @@ -459,7 +486,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( code = codeSnippet( code, functionOffset++, vtableOffset, reinterpret_cast< typelib_InterfaceAttributeTypeDescription * >( - member)->pAttributeTypeRef->eTypeClass); + member)->pAttributeTypeRef); // Setter: if (!reinterpret_cast< typelib_InterfaceAttributeTypeDescription * >( @@ -468,7 +495,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( (s++)->fn = code; code = codeSnippet( code, functionOffset++, vtableOffset, - typelib_TypeClass_VOID); + NULL); } break; @@ -477,7 +504,7 @@ unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions( code = codeSnippet( code, functionOffset++, vtableOffset, reinterpret_cast< typelib_InterfaceMethodTypeDescription * >( - member)->pReturnTypeRef->eTypeClass); + member)->pReturnTypeRef); break; default: diff --git a/bridges/source/cpp_uno/mingw_intel/makefile.mk b/bridges/source/cpp_uno/mingw_intel/makefile.mk index 6cd5e2f840d0..823c3888516b 100644 --- a/bridges/source/cpp_uno/mingw_intel/makefile.mk +++ b/bridges/source/cpp_uno/mingw_intel/makefile.mk @@ -56,6 +56,7 @@ CFLAGSNOOPT=-O0 SLOFILES= \ $(SLO)$/dllinit.obj \ + $(SLO)$/smallstruct.obj \ $(SLO)$/except.obj \ $(SLO)$/cpp2uno.obj \ $(SLO)$/uno2cpp.obj \ diff --git a/bridges/source/cpp_uno/mingw_intel/smallstruct.cxx b/bridges/source/cpp_uno/mingw_intel/smallstruct.cxx new file mode 100644 index 000000000000..26e05ba73b51 --- /dev/null +++ b/bridges/source/cpp_uno/mingw_intel/smallstruct.cxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_bridges.hxx" + +#include "bridges/cpp_uno/shared/types.hxx" + +#include "typelib/typeclass.h" +#include "typelib/typedescription.h" + +namespace bridges { namespace cpp_uno { namespace shared { + +namespace { +bool isSimpleStruct(typelib_TypeDescription const * type) { + switch (type->eTypeClass) { + case typelib_TypeClass_STRUCT: + { + typelib_CompoundTypeDescription const * p + = reinterpret_cast< typelib_CompoundTypeDescription const * >( + type); + for (sal_Int32 i = 0; i < p->nMembers; ++i) { + switch (p->ppTypeRefs[i]->eTypeClass) { + case typelib_TypeClass_STRUCT: + { + typelib_TypeDescription * t = 0; + TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]); + bool b = isSimpleStruct(t); + TYPELIB_DANGER_RELEASE(t); + if (!b) { + return false; + } + } + break; + + default: + if (!isSimpleType(p->ppTypeRefs[i]->eTypeClass)) + return false; + break; + } + } + } + return true; + + default: + return false; + } +} +} + +bool isSmallStruct(typelib_TypeDescription const * type) { + return (type->nSize <= 8 && isSimpleStruct(type)); +} + +} } } diff --git a/bridges/source/cpp_uno/mingw_intel/smallstruct.hxx b/bridges/source/cpp_uno/mingw_intel/smallstruct.hxx new file mode 100644 index 000000000000..e676778a8430 --- /dev/null +++ b/bridges/source/cpp_uno/mingw_intel/smallstruct.hxx @@ -0,0 +1,38 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: $ + * $Revision: $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "typelib/typeclass.h" +#include "typelib/typedescription.h" + +namespace bridges { namespace cpp_uno { namespace shared { + +bool isSmallStruct(typelib_TypeDescription const * type); + +} } } diff --git a/bridges/source/cpp_uno/mingw_intel/uno2cpp.cxx b/bridges/source/cpp_uno/mingw_intel/uno2cpp.cxx index 92a22ffdca67..0c12fac5c93f 100644 --- a/bridges/source/cpp_uno/mingw_intel/uno2cpp.cxx +++ b/bridges/source/cpp_uno/mingw_intel/uno2cpp.cxx @@ -42,6 +42,7 @@ #include "bridges/cpp_uno/shared/vtables.hxx" #include "share.hxx" +#include "smallstruct.hxx" #ifdef __MINGW32__ #define BROKEN_ALLOCA @@ -64,7 +65,7 @@ void callVirtualMethod( void * pAdjustedThisPtr, sal_Int32 nVtableIndex, void * pRegisterReturn, - typelib_TypeClass eReturnType, + typelib_TypeDescription const * returnType, sal_Int32 * pStackLongs, sal_Int32 nStackLongs ) __attribute__((noinline)); @@ -72,7 +73,7 @@ void callVirtualMethod( void * pAdjustedThisPtr, sal_Int32 nVtableIndex, void * pRegisterReturn, - typelib_TypeClass eReturnType, + typelib_TypeDescription const * returnType, sal_Int32 * pStackLongs, sal_Int32 nStackLongs ) { @@ -118,8 +119,10 @@ void callVirtualMethod( : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr), "m"(nVtableIndex), "m"(eax), "m"(edx), "m"(stackptr) : "eax", "edx" ); - switch( eReturnType ) + switch( returnType->eTypeClass ) { + case typelib_TypeClass_VOID: + break; case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: ((long*)pRegisterReturn)[1] = edx; @@ -143,8 +146,24 @@ void callVirtualMethod( case typelib_TypeClass_DOUBLE: asm ( "fstpl %0\n\t" : : "m"(*(char *)pRegisterReturn) ); break; - default: + case typelib_TypeClass_STRUCT: + if (bridges::cpp_uno::shared::isSmallStruct(returnType)) { + if (returnType->nSize <= 1) { + *(unsigned char*)pRegisterReturn = eax; + } + else if (returnType->nSize <= 2) { + *(unsigned short*)pRegisterReturn = eax; + } + else if (returnType->nSize <= 8) { + ((long*)pRegisterReturn)[0] = eax; + if (returnType->nSize > 4) { + ((long*)pRegisterReturn)[1] = edx; + } + } + } break; + default: + break; } } @@ -181,7 +200,7 @@ static void cpp_call( else { // complex return via ptr - pCppReturn = *(void **)pCppStack + pCppReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr ) #ifdef BROKEN_ALLOCA @@ -190,7 +209,10 @@ static void cpp_call( ? alloca( pReturnTypeDescr->nSize ) #endif : pUnoReturn); // direct way - pCppStack += sizeof(void *); + if (!bridges::cpp_uno::shared::isSmallStruct(pReturnTypeDescr)) { + *(void **)pCppStack = pCppReturn; + pCppStack += sizeof(void *); + } } } // push this @@ -287,7 +309,7 @@ static void cpp_call( OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" ); callVirtualMethod( pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr->eTypeClass, + pCppReturn, pReturnTypeDescr, (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) ); // NO exception occured... *ppUnoExc = 0; diff --git a/sal/util/makefile.mk b/sal/util/makefile.mk index 04382b956ddd..f56e6f88f058 100644 --- a/sal/util/makefile.mk +++ b/sal/util/makefile.mk @@ -97,7 +97,12 @@ SHL1VERSIONMAP= $(TARGET).map SHL1RPATH=URELIB .IF "$(GUI)"=="WNT" + +.IF "$(COM)"=="GCC" +UWINAPILIB= -luwinapi +.ELSE UWINAPILIB= $(LB)$/uwinapi.lib +.ENDIF SHL1STDLIBS= \ $(UWINAPILIB)\ @@ -169,11 +174,7 @@ SHL1OBJS= \ .ENDIF # UNX .ENDIF # lincinc -.IF "$(GUI)"=="WNT" -SHL1DEPN= $(UWINAPILIB) -.ELSE SHL1DEPN= -.ENDIF SHL1DEF= $(MISC)$/$(SHL1TARGET).def DEF1NAME= $(SHL1TARGET) |