Index: bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx =================================================================== --- bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx (revision 277985) +++ bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx (revision 277986) @@ -63,7 +63,7 @@ */ 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 Index: bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx =================================================================== --- bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx (revision 277985) +++ bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx (revision 277986) @@ -121,13 +121,14 @@ for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) { const typelib_MethodParameter & rParam = pParams[nPos]; - typelib_TypeDescription * pParamTypeDescr = 0; - TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef ); int nUsedGPR = 0; int nUsedSSE = 0; - bool bFitsRegisters = x86_64::examine_argument( rParam.pTypeRef, false, nUsedGPR, nUsedSSE ); - if ( !rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ) ) // value +#if OSL_DEBUG_LEVEL > 0 + bool bFitsRegisters = +#endif + x86_64::examine_argument( rParam.pTypeRef, false, nUsedGPR, nUsedSSE ); + if ( !rParam.bOut && bridges::cpp_uno::shared::isSimpleType( rParam.pTypeRef ) ) // value { // Simple types must fit exactly one register on x86_64 OSL_ASSERT( bFitsRegisters && ( ( nUsedSSE == 1 && nUsedGPR == 0 ) || ( nUsedSSE == 0 && nUsedGPR == 1 ) ) ); @@ -152,35 +153,14 @@ else pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw++; } - - // no longer needed - TYPELIB_DANGER_RELEASE( pParamTypeDescr ); } else // struct <= 16 bytes || ptr to complex value || ref { - void *pCppStack; - char pTmpStruct[16]; + typelib_TypeDescription * pParamTypeDescr = 0; + TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef ); - 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 ) + void *pCppStack; + if ( nr_gpr < x86_64::MAX_GPR_REGS ) { pCppArgs[nPos] = pCppStack = *gpreg++; nr_gpr++; Index: bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx =================================================================== --- bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx (revision 277985) +++ bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx (revision 277986) @@ -53,13 +53,13 @@ //================================================================================================== 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) @@ -113,6 +113,7 @@ sal_uInt64 rax; sal_uInt64 rdx; double xmm0; + double xmm1; asm volatile ( @@ -147,13 +148,14 @@ "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: @@ -179,12 +181,17 @@ 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; } @@ -367,7 +374,7 @@ { callVirtualMethod( pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr, bSimpleReturn, + pCppReturn, pReturnTypeRef, bSimpleReturn, pStackStart, ( pStack - pStackStart ), pGPR, nGPR, pFPR, nFPR ); Index: bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx =================================================================== --- bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx (revision 277985) +++ bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx (revision 277986) @@ -229,6 +229,7 @@ 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 ); @@ -243,9 +244,6 @@ 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 ); @@ -332,7 +330,7 @@ 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; @@ -346,12 +344,12 @@ { 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; Index: bridges/source/cpp_uno/gcc3_linux_x86-64/call.s =================================================================== --- bridges/source/cpp_uno/gcc3_linux_x86-64/call.s (revision 277985) +++ bridges/source/cpp_uno/gcc3_linux_x86-64/call.s (revision 277986) @@ -43,6 +43,9 @@ 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) Index: bridges/source/remote/urp/urp_reader.cxx =================================================================== --- bridges/source/remote/urp/urp_reader.cxx (revision 277985) +++ bridges/source/remote/urp/urp_reader.cxx (revision 277986) @@ -372,8 +372,8 @@ } pFlags->bSynchronous = ( HDRFLAG_SYNCHRONOUS & moreFlags ); pFlags->bMustReply = ( HDRFLAG_MUSTREPLY & moreFlags ); - OSL_ENSURE( pFlags->bSynchronous && pFlags->bMustReply || - ! pFlags->bSynchronous && !pFlags->bMustReply, + OSL_ENSURE( (pFlags->bSynchronous && pFlags->bMustReply) || + (!pFlags->bSynchronous && !pFlags->bMustReply), "urp-bridge : customized calls currently not supported !"); } --- bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx Thu Feb 18 09:51:41 2010 +0100 +++ bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx Thu Feb 18 21:44:35 2010 +0100 @@ -103,8 +103,6 @@ #define MAX_CLASSES 4 -#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) - /* x86-64 register passing implementation. See x86-64 ABI for details. Goal of this code is to classify each 8bytes of incoming argument by the register class and assign registers accordingly. */ @@ -156,11 +154,8 @@ See the x86-64 PS ABI for details. */ static int -classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_class classes[], int &rByteOffset ) +classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_class classes[], int byteOffset ) { - /* First, align to the right place. */ - rByteOffset = ALIGN( rByteOffset, pTypeRef->pType->nAlignment ); - switch ( pTypeRef->eTypeClass ) { case typelib_TypeClass_VOID: @@ -176,13 +171,13 @@ case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: case typelib_TypeClass_ENUM: - if ( ( rByteOffset % 8 + pTypeRef->pType->nSize ) <= 4 ) + if ( ( byteOffset % 8 + pTypeRef->pType->nSize ) <= 4 ) classes[0] = X86_64_INTEGERSI_CLASS; else classes[0] = X86_64_INTEGER_CLASS; return 1; case typelib_TypeClass_FLOAT: - if ( ( rByteOffset % 8 ) == 0 ) + if ( ( byteOffset % 8 ) == 0 ) classes[0] = X86_64_SSESF_CLASS; else classes[0] = X86_64_SSE_CLASS; @@ -229,9 +224,9 @@ for ( sal_Int32 nMember = 0; nMember < pStruct->nMembers; ++nMember ) { typelib_TypeDescriptionReference *pTypeInStruct = pStruct->ppTypeRefs[ nMember ]; - rByteOffset = pStruct->pMemberOffsets[ nMember ]; + int offset = byteOffset + pStruct->pMemberOffsets[ nMember ]; - int num = classify_argument( pTypeInStruct, subclasses, rByteOffset ); + int num = classify_argument( pTypeInStruct, subclasses, offset ); if ( num == 0 ) { @@ -241,7 +236,7 @@ for ( int i = 0; i < num; i++ ) { - int pos = rByteOffset / 8; + int pos = offset / 8; classes[i + pos] = merge_classes( subclasses[i], classes[i + pos] ); } } @@ -284,10 +279,9 @@ bool x86_64::examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE ) { enum x86_64_reg_class classes[MAX_CLASSES]; - int offset = 0; int n; - n = classify_argument( pTypeRef, classes, offset ); + n = classify_argument( pTypeRef, classes, 0 ); if ( n == 0 ) return false; @@ -333,10 +327,9 @@ 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; int n; - n = classify_argument( pTypeRef, classes, offset ); + n = classify_argument( pTypeRef, classes, 0 ); sal_uInt64 *pStructAlign = reinterpret_cast<sal_uInt64 *>( pStruct ); for ( n--; n >= 0; n-- ) @@ -444,10 +437,10 @@ /* All easy cases are eliminated. Now fire the big guns. */ enum x86_64_reg_class classes[MAX_CLASSES]; - int offset = 0, j, num; + int j, num; void *a; - num = classify_argument (*p_arg, classes, &offset); + num = classify_argument (*p_arg, classes, 0); for (j=0, a=*p_argv; j<num; j++, a+=8) { switch (classes[j]) @@ -574,7 +567,7 @@ ; } - num = classify_argument (ecif->cif->rtype, classes, &i); + num = classify_argument (ecif->cif->rtype, classes, 0); if (num == 0) /* Return in memory. */