incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r1180518 - in /incubator/ooo/trunk/main/bridges: inc/bridges/cpp_uno/shared/ source/cpp_uno/gcc3_freebsd_x86-64/
Date Sun, 09 Oct 2011 02:07:51 GMT
Author: pfg
Date: Sun Oct  9 02:07:51 2011
New Revision: 1180518

URL: http://svn.apache.org/viewvc?rev=1180518&view=rev
Log:
i85126 - FreeBSD port: newer bridge code for amd64.

Modified:
    incubator/ooo/trunk/main/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx
    incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/abi.cxx
    incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/abi.hxx
    incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/call.s
    incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/cpp2uno.cxx
    incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/except.cxx
    incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/uno2cpp.cxx

Modified: incubator/ooo/trunk/main/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx?rev=1180518&r1=1180517&r2=1180518&view=diff
==============================================================================
--- incubator/ooo/trunk/main/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx (original)
+++ incubator/ooo/trunk/main/bridges/inc/bridges/cpp_uno/shared/vtablefactory.hxx Sun Oct
 9 02:07:51 2011
@@ -37,7 +37,7 @@
 #include <hash_map>
 
 /*See: http://people.redhat.com/drepper/selinux-mem.html*/
-#ifdef LINUX
+#if defined (LINUX) || defined (FREEBSD)
 #define USE_DOUBLE_MMAP
 #endif
 

Modified: incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/abi.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/abi.cxx?rev=1180518&r1=1180517&r2=1180518&view=diff
==============================================================================
--- incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/abi.cxx (original)
+++ incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/abi.cxx Sun Oct  9
02:07:51 2011
@@ -226,6 +226,7 @@ classify_argument( typelib_TypeDescripti
                 for ( sal_Int32 nMember = 0; nMember < pStruct->nMembers; ++nMember
)
                 {
                     typelib_TypeDescriptionReference *pTypeInStruct = pStruct->ppTypeRefs[
nMember ];
+                    rByteOffset = pStruct->pMemberOffsets[ nMember ];
 
                     int num = classify_argument( pTypeInStruct, subclasses, rByteOffset );
 
@@ -240,9 +241,6 @@ classify_argument( typelib_TypeDescripti
                         int pos = rByteOffset / 8;
                         classes[i + pos] = merge_classes( subclasses[i], classes[i + pos]
);
                     }
-
-                    if ( pTypeInStruct->eTypeClass != typelib_TypeClass_STRUCT )
-                        rByteOffset = pStruct->pMemberOffsets[ nMember ];
                 }
 
                 TYPELIB_DANGER_RELEASE( pTypeDescr );
@@ -329,7 +327,7 @@ bool x86_64::return_in_hidden_param( typ
     return examine_argument( pTypeRef, true, g, s ) == 0;
 }
 
-void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef, void * const *pGPR,
void * const *pSSE, void *pStruct )
+void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64 *pGPR,
const double *pSSE, void *pStruct )
 {
     enum x86_64_reg_class classes[MAX_CLASSES];
     int offset = 0;
@@ -343,12 +341,14 @@ void x86_64::fill_struct( typelib_TypeDe
         {
             case X86_64_INTEGER_CLASS:
             case X86_64_INTEGERSI_CLASS:
-                *pStructAlign++ = *reinterpret_cast<sal_uInt64 *>( *pGPR++ );
+                *pStructAlign++ = *pGPR++;
                 break;
             case X86_64_SSE_CLASS:
             case X86_64_SSESF_CLASS:
             case X86_64_SSEDF_CLASS:
-                *pStructAlign++ = *reinterpret_cast<sal_uInt64 *>( *pSSE++ );
+                *pStructAlign++ = *reinterpret_cast<const sal_uInt64 *>( pSSE++ );
+                break;
+            default:
                 break;
         }
 }

Modified: incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/abi.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/abi.hxx?rev=1180518&r1=1180517&r2=1180518&view=diff
==============================================================================
--- incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/abi.hxx (original)
+++ incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/abi.hxx Sun Oct  9
02:07:51 2011
@@ -60,7 +60,7 @@ bool examine_argument( typelib_TypeDescr
 */
 bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef );
 
-void fill_struct( typelib_TypeDescriptionReference *pTypeRef, void * const *pGPR, void *
const *pSSE, void *pStruct );
+void fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64* pGPR, const
double* pSSE, void *pStruct );
 
 } // namespace x86_64
 

Modified: incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/call.s
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/call.s?rev=1180518&r1=1180517&r2=1180518&view=diff
==============================================================================
--- incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/call.s (original)
+++ incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/call.s Sun Oct  9
02:07:51 2011
@@ -43,6 +43,9 @@ privateSnippetExecutor:
 	je	.Lfloat
 
 	movq	-144(%rbp), %rax		# Return value (int case)
+	movq	-136(%rbp), %rdx		# Return value (int case)
+	movq	-144(%rbp), %xmm0		# Return value (int case)
+	movq	-136(%rbp), %xmm1		# Return value (int case)
 	jmp	.Lfinish
 .Lfloat:
 	movlpd	-144(%rbp), %xmm0		# Return value (float/double case)

Modified: incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/cpp2uno.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/cpp2uno.cxx?rev=1180518&r1=1180517&r2=1180518&view=diff
==============================================================================
--- incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/cpp2uno.cxx (original)
+++ incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/cpp2uno.cxx Sun Oct
 9 02:07:51 2011
@@ -74,8 +74,8 @@ static typelib_TypeClass cpp2uno_call(
 	void ** gpreg, void ** fpreg, void ** ovrflw,
 	sal_uInt64 * pRegisterReturn /* space for register return */ )
 {
-	int nr_gpr = 0; //number of gpr registers used 
-	int nr_fpr = 0; //number of fpr regsiters used
+	unsigned int nr_gpr = 0; //number of gpr registers used
+	unsigned int nr_fpr = 0; //number of fpr registers used
        
 	// return
 	typelib_TypeDescription * pReturnTypeDescr = 0;
@@ -123,7 +123,10 @@ static typelib_TypeClass cpp2uno_call(
 
 		int nUsedGPR = 0;
 		int nUsedSSE = 0;
-		bool bFitsRegisters = x86_64::examine_argument( rParam.pTypeRef, false, nUsedGPR, nUsedSSE
);
+#if OSL_DEBUG_LEVEL > 1
+		bool bFitsRegisters =
+#endif
+			x86_64::examine_argument( rParam.pTypeRef, false, nUsedGPR, nUsedSSE );
 		if ( !rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )
) // value
 		{
 			// Simple types must fit exactly one register on x86_64
@@ -156,28 +159,7 @@ static typelib_TypeClass cpp2uno_call(
 		else // struct <= 16 bytes || ptr to complex value || ref
 		{
 			void *pCppStack;
-			char pTmpStruct[16];
-
-			if ( bFitsRegisters && !rParam.bOut &&
-				 ( pParamTypeDescr->eTypeClass == typelib_TypeClass_STRUCT ||
-				   pParamTypeDescr->eTypeClass == typelib_TypeClass_EXCEPTION ) )
-			{
-				if ( ( nr_gpr + nUsedGPR <= x86_64::MAX_GPR_REGS ) && ( nr_fpr + nUsedSSE
<= x86_64::MAX_SSE_REGS ) )
-				{
-					x86_64::fill_struct( rParam.pTypeRef, gpreg, fpreg, pTmpStruct );
-#if OSL_DEBUG_LEVEL > 1
-					fprintf( stderr, "nUsedGPR == %d, nUsedSSE == %d, pTmpStruct[0] == 0x%x, pTmpStruct[1]
== 0x%x, **gpreg == 0x%lx\n",
-							nUsedGPR, nUsedSSE, pTmpStruct[0], pTmpStruct[1], *(sal_uInt64*)*gpreg );
-#endif
-
-					pCppArgs[nPos] = pCppStack = reinterpret_cast<void *>( pTmpStruct );
-					gpreg += nUsedGPR;
-					fpreg += nUsedSSE;
-				}
-				else
-					pCppArgs[nPos] = pCppStack = *ovrflw++;
-			}
-			else if ( nr_gpr < x86_64::MAX_GPR_REGS )
+			if ( nr_gpr < x86_64::MAX_GPR_REGS )
 			{ 
 				pCppArgs[nPos] = pCppStack = *gpreg++;
 				nr_gpr++;
@@ -486,13 +468,12 @@ bridges::cpp_uno::shared::VtableFactory:
 //==================================================================================================
 
 unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
-	Slot ** slots, unsigned char * code,
+	Slot ** slots, unsigned char * code, sal_PtrDiff writetoexecdiff,
 	typelib_InterfaceTypeDescription const * type, sal_Int32 nFunctionOffset,
 	sal_Int32 functionCount, sal_Int32 nVtableOffset )
 {
 	(*slots) -= functionCount;
 	Slot * s = *slots;
-
 	for ( sal_Int32 nPos = 0; nPos < type->nMembers; ++nPos )
 	{
 		typelib_TypeDescription * pTD = 0;
@@ -506,14 +487,14 @@ unsigned char * bridges::cpp_uno::shared
 				reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>( pTD );
 
 			// get method
-			(s++)->fn = code;
+			(s++)->fn = code + writetoexecdiff;
 			code = codeSnippet( code, nFunctionOffset++, nVtableOffset,
 								x86_64::return_in_hidden_param( pAttrTD->pAttributeTypeRef ) );
 
 			if ( ! pAttrTD->bReadOnly )
 			{
 				// set method
-				(s++)->fn = code;
+				(s++)->fn = code + writetoexecdiff;
 				code = codeSnippet( code, nFunctionOffset++, nVtableOffset, false );
 			}
 		}
@@ -522,7 +503,7 @@ unsigned char * bridges::cpp_uno::shared
 			typelib_InterfaceMethodTypeDescription *pMethodTD =
 				reinterpret_cast<typelib_InterfaceMethodTypeDescription *>( pTD );
 			
-			(s++)->fn = code;
+			(s++)->fn = code + writetoexecdiff;
 			code = codeSnippet( code, nFunctionOffset++, nVtableOffset,
 								x86_64::return_in_hidden_param( pMethodTD->pReturnTypeRef ) );
 		}

Modified: incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/except.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/except.cxx?rev=1180518&r1=1180517&r2=1180518&view=diff
==============================================================================
--- incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/except.cxx (original)
+++ incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/except.cxx Sun Oct
 9 02:07:51 2011
@@ -29,6 +29,7 @@
 #include "precompiled_bridges.hxx"
 
 #include <stdio.h>
+#include <string.h>
 #include <dlfcn.h>
 #include <cxxabi.h>
 #include <hash_map>
@@ -118,7 +119,7 @@ public:
 };
 //__________________________________________________________________________________________________
 RTTI::RTTI() SAL_THROW( () )
-#if __FreeBSD_version < 602103
+#if __FreeBSD_version < 702104 /* #i22253# */
     : m_hApp( dlopen( 0, RTLD_NOW | RTLD_GLOBAL ) )
 #else
     : m_hApp( dlopen( 0, RTLD_LAZY ) )
@@ -157,7 +158,7 @@ type_info * RTTI::getRTTI( typelib_Compo
         buf.append( 'E' );
         
         OString symName( buf.makeStringAndClear() );
-#if __FreeBSD_version < 602103  /* #i22253# */
+#if __FreeBSD_version < 702104 /* #i22253# */
         rtti = (type_info *)dlsym( RTLD_DEFAULT, symName.getStr() );
 #else
         rtti = (type_info *)dlsym( m_hApp, symName.getStr() );
@@ -172,8 +173,8 @@ type_info * RTTI::getRTTI( typelib_Compo
         else
         {
             // try to lookup the symbol in the generated rtti map
-            t_rtti_map::const_iterator iFind( m_generatedRttis.find( unoName ) );
-            if (iFind == m_generatedRttis.end())
+            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,
@@ -202,7 +203,7 @@ type_info * RTTI::getRTTI( typelib_Compo
             }
             else // taking already generated rtti
             {
-                rtti = iFind->second;
+                rtti = iFind2->second;
             }
         }
     }

Modified: incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/uno2cpp.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/uno2cpp.cxx?rev=1180518&r1=1180517&r2=1180518&view=diff
==============================================================================
--- incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/uno2cpp.cxx (original)
+++ incubator/ooo/trunk/main/bridges/source/cpp_uno/gcc3_freebsd_x86-64/uno2cpp.cxx Sun Oct
 9 02:07:51 2011
@@ -50,13 +50,13 @@ using namespace ::com::sun::star::uno;
 
 //==================================================================================================
 static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
-                              void * pRegisterReturn, typelib_TypeDescription * pReturnTypeDescr,
bool bSimpleReturn,
+                              void * pRegisterReturn, typelib_TypeDescriptionReference *
pReturnTypeRef, bool bSimpleReturn,
                               sal_uInt64 *pStack, sal_uInt32 nStack,
                               sal_uInt64 *pGPR, sal_uInt32 nGPR,
                               double *pFPR, sal_uInt32 nFPR) __attribute__((noinline));
 
 static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
-                              void * pRegisterReturn, typelib_TypeDescription * pReturnTypeDescr,
bool bSimpleReturn,
+                              void * pRegisterReturn, typelib_TypeDescriptionReference *
pReturnTypeRef, bool bSimpleReturn,
                               sal_uInt64 *pStack, sal_uInt32 nStack,
                               sal_uInt64 *pGPR, sal_uInt32 nGPR,
                               double *pFPR, sal_uInt32 nFPR)
@@ -65,13 +65,13 @@ static void callVirtualMethod(void * pTh
     // Let's figure out what is really going on here
     {
         fprintf( stderr, "= callVirtualMethod() =\nGPR's (%d): ", nGPR );
-        for ( int i = 0; i < nGPR; ++i )
+        for ( unsigned int i = 0; i < nGPR; ++i )
             fprintf( stderr, "0x%lx, ", pGPR[i] );
         fprintf( stderr, "\nFPR's (%d): ", nFPR );
-        for ( int i = 0; i < nFPR; ++i )
+        for ( unsigned int i = 0; i < nFPR; ++i )
             fprintf( stderr, "%f, ", pFPR[i] );
         fprintf( stderr, "\nStack (%d): ", nStack );
-        for ( int i = 0; i < nStack; ++i )
+        for ( unsigned int i = 0; i < nStack; ++i )
             fprintf( stderr, "0x%lx, ", pStack[i] );
         fprintf( stderr, "\n" );
     }
@@ -110,6 +110,7 @@ static void callVirtualMethod(void * pTh
     sal_uInt64 rax;
     sal_uInt64 rdx;
     double xmm0;
+    double xmm1;
 
     asm volatile (
         
@@ -144,13 +145,14 @@ static void callVirtualMethod(void * pTh
         "movq   %%rax, %4\n\t"
         "movq   %%rdx, %5\n\t"
         "movsd %%xmm0, %6\n\t"
+        "movsd %%xmm1, %7\n\t"
         :
         : "m" ( pMethod ), "m" ( pGPR ), "m" ( pFPR ), "m" ( nFPR ),
-          "m" ( rax ), "m" ( rdx ), "m" ( xmm0 )
+          "m" ( rax ), "m" ( rdx ), "m" ( xmm0 ), "m" ( xmm1 )
         : "rax", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r11"
     );
 
-    switch (pReturnTypeDescr->eTypeClass)
+    switch (pReturnTypeRef->eTypeClass)
     {
     case typelib_TypeClass_HYPER:
     case typelib_TypeClass_UNSIGNED_HYPER:
@@ -176,12 +178,17 @@ static void callVirtualMethod(void * pTh
         break;
     default:
         {
-            sal_Int32 const nRetSize = pReturnTypeDescr->nSize;
+            sal_Int32 const nRetSize = pReturnTypeRef->pType->nSize;
             if (bSimpleReturn && nRetSize <= 16 && nRetSize > 0)
             {
-                if (nRetSize > 8)
-                    static_cast<sal_uInt64 *>(pRegisterReturn)[1] = rdx;
-                static_cast<sal_uInt64 *>(pRegisterReturn)[0] = rax;
+                sal_uInt64 longs[2];
+                longs[0] = rax;
+                longs[1] = rdx;
+
+                double doubles[2];
+                doubles[0] = xmm0;
+                doubles[1] = xmm1;
+                x86_64::fill_struct( pReturnTypeRef, &longs[0], &doubles[0], pRegisterReturn);
             }
             break;
         }
@@ -320,6 +327,8 @@ static void cpp_call(
 			case typelib_TypeClass_DOUBLE:
 				INSERT_FLOAT_DOUBLE( pCppArgs[nPos], nFPR, pFPR, pStack );
 				break;
+			default:
+				break;
 			}
 
 			// no longer needed
@@ -362,7 +371,7 @@ static void cpp_call(
 	{
 		callVirtualMethod(
 			pAdjustedThisPtr, aVtableSlot.index,
-			pCppReturn, pReturnTypeDescr, bSimpleReturn,
+			pCppReturn, pReturnTypeRef, bSimpleReturn,
 			pStackStart, ( pStack - pStackStart ),
 			pGPR, nGPR,
 			pFPR, nFPR );
@@ -432,16 +441,19 @@ void unoInterfaceProxyDispatch(
 	// is my surrogate
 	bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
 		= static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * >(pUnoI);
+#if OSL_DEBUG_LEVEL > 0
 	typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr;
+#endif
 	
 	switch (pMemberDescr->eTypeClass)
 	{
 	case typelib_TypeClass_INTERFACE_ATTRIBUTE:
 	{
+#if OSL_DEBUG_LEVEL > 0
 		// determine vtable call index
 		sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition;
 		OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!"
);
-		
+#endif
 		VtableSlot aVtableSlot(
 				getVtableSlot(
 					reinterpret_cast<
@@ -486,10 +498,11 @@ void unoInterfaceProxyDispatch(
 	}
 	case typelib_TypeClass_INTERFACE_METHOD:
 	{
+#if OSL_DEBUG_LEVEL > 0
 		// determine vtable call index
 		sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition;
 		OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!"
);
-		
+#endif
 		VtableSlot aVtableSlot(
 				getVtableSlot(
 					reinterpret_cast<



Mime
View raw message