summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2010-04-12 17:43:34 +0200
committerKurt Zenker <kz@openoffice.org>2010-04-12 17:43:34 +0200
commit34f781ebfb841ad3d8fe95554663c37c3bdfd1a0 (patch)
tree0336b7eb6ec80ae424e92fcd1a80491ba61c967c
parent777028d8575d33ff72a7f25791db6574ef896b3e (diff)
parenta799a1985e73970bdcba5e4fb19dcbf07ff1c834 (diff)
CWS-TOOLING: integrate CWS x86_64_bridgefixooo/OOO320_m16ooo/OOO320_m15
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx37
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx2
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/call.s3
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx38
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx25
-rw-r--r--bridges/source/remote/urp/urp_reader.cxx4
6 files changed, 45 insertions, 64 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
index 9132232ad..20d1e7221 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
@@ -100,8 +100,6 @@ enum x86_64_reg_class
#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. */
@@ -153,11 +151,8 @@ merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2)
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:
@@ -173,13 +168,13 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c
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;
@@ -226,8 +221,9 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c
for ( sal_Int32 nMember = 0; nMember < pStruct->nMembers; ++nMember )
{
typelib_TypeDescriptionReference *pTypeInStruct = pStruct->ppTypeRefs[ nMember ];
+ int offset = byteOffset + pStruct->pMemberOffsets[ nMember ];
- int num = classify_argument( pTypeInStruct, subclasses, rByteOffset );
+ int num = classify_argument( pTypeInStruct, subclasses, offset );
if ( num == 0 )
{
@@ -237,12 +233,9 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c
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] );
}
-
- if ( pTypeInStruct->eTypeClass != typelib_TypeClass_STRUCT )
- rByteOffset = pStruct->pMemberOffsets[ nMember ];
}
TYPELIB_DANGER_RELEASE( pTypeDescr );
@@ -283,10 +276,9 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c
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;
@@ -329,13 +321,12 @@ bool x86_64::return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef
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;
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-- )
@@ -343,12 +334,12 @@ void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef, void * con
{
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;
@@ -443,10 +434,10 @@ ffi_prep_args (stackLayout *stack, extended_cif *ecif)
/* 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])
@@ -573,7 +564,7 @@ ffi_fill_return_value (return_value *rv, extended_cif *ecif)
;
}
- num = classify_argument (ecif->cif->rtype, classes, &i);
+ num = classify_argument (ecif->cif->rtype, classes, 0);
if (num == 0)
/* Return in memory. */
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx
index cf94c5017..421d16001 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx
@@ -60,7 +60,7 @@ bool examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInRetur
*/
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
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/call.s b/bridges/source/cpp_uno/gcc3_linux_x86-64/call.s
index 736230705..a0572ef61 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/call.s
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/call.s
@@ -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)
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 0e82312f3..a314ba885 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
@@ -118,13 +118,14 @@ static typelib_TypeClass cpp2uno_call(
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 ) ) );
@@ -149,35 +150,14 @@ static typelib_TypeClass cpp2uno_call(
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];
-
- 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
+ typelib_TypeDescription * pParamTypeDescr = 0;
+ TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
- 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++;
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
index d2272f208..06a152aa7 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
@@ -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)
@@ -110,6 +110,7 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
sal_uInt64 rax;
sal_uInt64 rdx;
double xmm0;
+ double xmm1;
asm volatile (
@@ -144,13 +145,14 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
"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 * pThis, sal_uInt32 nVtableIndex,
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;
}
@@ -364,7 +371,7 @@ static void cpp_call(
{
callVirtualMethod(
pAdjustedThisPtr, aVtableSlot.index,
- pCppReturn, pReturnTypeDescr, bSimpleReturn,
+ pCppReturn, pReturnTypeRef, bSimpleReturn,
pStackStart, ( pStack - pStackStart ),
pGPR, nGPR,
pFPR, nFPR );
diff --git a/bridges/source/remote/urp/urp_reader.cxx b/bridges/source/remote/urp/urp_reader.cxx
index c7d430cf7..ad945bfb0 100644
--- a/bridges/source/remote/urp/urp_reader.cxx
+++ b/bridges/source/remote/urp/urp_reader.cxx
@@ -369,8 +369,8 @@ inline sal_Bool OReaderThread::readFlags( struct MessageFlags *pFlags )
}
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 !");
}