summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Glazunov <vg@openoffice.org>2009-11-24 16:10:44 +0100
committerVladimir Glazunov <vg@openoffice.org>2009-11-24 16:10:44 +0100
commit8fd3f31eb907c32d01f16e5d87ed0ed203db8e6e (patch)
treecbb7d952f717d8d28660440aac5ca0cd2d777a93
parente1704615dc732f1638489a9123408a3cf137ae77 (diff)
parent6fbe08854a2eea99e2d8700927209f7e0e5abdc8 (diff)
CWS-TOOLING: integrate CWS cmcfixes64
Notes
split repo tag: ure_ooo/DEV300_m66
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx18
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx27
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx10
-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.cxx28
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx25
-rw-r--r--bridges/source/cpp_uno/shared/vtablefactory.cxx10
-rw-r--r--pyuno/source/loader/makefile.mk2
-rw-r--r--pyuno/source/module/makefile.mk2
-rw-r--r--pyuno/source/module/pyuno_gc.cxx10
11 files changed, 87 insertions, 50 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
index b365bdb8aee1..f59a16b2ac38 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
@@ -45,7 +45,17 @@
#include <stdio.h>
#include <string.h>
-#if defined(__ARM_EABI__) && !defined(__SOFTFP__)
+/*
+ * Based on http://gcc.gnu.org/PR41443
+ * References to __SOFTFP__ are incorrect for EABI; the __SOFTFP__ code
+ * should be used for *soft-float ABI* whether or not VFP is enabled,
+ * and __SOFTFP__ does specifically mean soft-float not soft-float ABI.
+ *
+ * Changing the conditionals to __SOFTFP__ || __ARM_EABI__ then
+ * -mfloat-abi=softfp should work. -mfloat-abi=hard won't; that would
+ * need both a new macro to identify the hard-VFP ABI.
+ */
+#if !defined(__ARM_EABI__) && !defined(__SOFTFP__)
#error Not Implemented
/*
@@ -103,7 +113,7 @@ namespace arm
void MapReturn(long r0, long r1, typelib_TypeClass eReturnType, void *pRegisterReturn)
{
-#ifndef __SOFTFP__
+#if !defined(__ARM_EABI__) && !defined(__SOFTFP__)
register float fret asm("f0");
register double dret asm("f0");
#endif
@@ -128,14 +138,14 @@ void MapReturn(long r0, long r1, typelib_TypeClass eReturnType, void *pRegisterR
*(unsigned char*)pRegisterReturn = (unsigned char)r0;
break;
case typelib_TypeClass_FLOAT:
-#ifdef __SOFTFP__
+#if defined(__ARM_EABI__) || defined(__SOFTFP__)
((long*)pRegisterReturn)[0] = r0;
#else
*(float*)pRegisterReturn = fret;
#endif
break;
case typelib_TypeClass_DOUBLE:
-#ifdef __SOFTFP__
+#if defined(__ARM_EABI__) || defined(__SOFTFP__)
((long*)pRegisterReturn)[1] = r1;
((long*)pRegisterReturn)[0] = r0;
#else
diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx
index 35b16d882632..d1d98f222738 100644
--- a/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx
@@ -91,6 +91,31 @@ void MapReturn(const ia64::RegReturn &rRet, double dret, typelib_TypeDescription
namespace ia64
{
+ bool is_complex_struct(const typelib_TypeDescription * type)
+ {
+ const typelib_CompoundTypeDescription * p
+ = reinterpret_cast< const typelib_CompoundTypeDescription * >(type);
+ for (sal_Int32 i = 0; i < p->nMembers; ++i)
+ {
+ if (p->ppTypeRefs[i]->eTypeClass == typelib_TypeClass_STRUCT ||
+ p->ppTypeRefs[i]->eTypeClass == typelib_TypeClass_EXCEPTION)
+ {
+ typelib_TypeDescription * t = 0;
+ TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]);
+ bool b = is_complex_struct(t);
+ TYPELIB_DANGER_RELEASE(t);
+ if (b) {
+ return true;
+ }
+ }
+ else if (!bridges::cpp_uno::shared::isSimpleType(p->ppTypeRefs[i]->eTypeClass))
+ return true;
+ }
+ if (p->pBaseTypeDescription != 0)
+ return is_complex_struct(&p->pBaseTypeDescription->aBase);
+ return false;
+ }
+
bool is_complex_struct( typelib_TypeDescriptionReference *pTypeRef )
{
if (pTypeRef->eTypeClass == typelib_TypeClass_STRUCT || pTypeRef->eTypeClass == typelib_TypeClass_EXCEPTION)
@@ -98,7 +123,7 @@ namespace ia64
typelib_TypeDescription * pTypeDescr = 0;
TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
- bool bRet = bridges::cpp_uno::shared::relatesToInterfaceType( pTypeDescr );
+ bool bRet = is_complex_struct( pTypeDescr );
TYPELIB_DANGER_RELEASE( pTypeDescr );
return bRet;
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 2aeaf9423859..ad0faa1a01aa 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
@@ -229,6 +229,7 @@ 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 ];
+ rByteOffset = pStruct->pMemberOffsets[ nMember ];
int num = classify_argument( pTypeInStruct, subclasses, rByteOffset );
@@ -243,9 +244,6 @@ classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_c
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 @@ 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;
@@ -346,12 +344,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;
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 5fffe680c28a..c5b7d94d2e01 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.hxx
@@ -63,7 +63,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 736230705d5a..a0572ef61641 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 5fb2bd7e12a3..c1e938446e77 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
@@ -126,7 +126,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
@@ -159,28 +162,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++;
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 7199794409a8..23c40121afb7 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx
@@ -53,13 +53,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)
@@ -113,6 +113,7 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
sal_uInt64 rax;
sal_uInt64 rdx;
double xmm0;
+ double xmm1;
asm volatile (
@@ -147,13 +148,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:
@@ -179,12 +181,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;
}
@@ -367,7 +374,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/cpp_uno/shared/vtablefactory.cxx b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index 34e5f9635974..3784f3959594 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -272,7 +272,7 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const
char *tmpfname = new char[aTmpName.getLength()+1];
strncpy(tmpfname, aTmpName.getStr(), aTmpName.getLength()+1);
if ((block.fd = mkstemp(tmpfname)) == -1)
- perror("creation of executable memory area failed");
+ perror("creation of executable memory area failed");
if (block.fd == -1)
{
delete[] tmpfname;
@@ -280,7 +280,13 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 slotCount) const
}
unlink(tmpfname);
delete[] tmpfname;
- ftruncate(block.fd, block.size);
+ if (ftruncate(block.fd, block.size) == -1)
+ {
+ perror("truncation of executable memory area failed");
+ close(block.fd);
+ block.fd = -1;
+ break;
+ }
block.start = mmap(NULL, block.size, PROT_READ | PROT_WRITE, MAP_SHARED, block.fd, 0);
if (block.start== MAP_FAILED) {
block.start = 0;
diff --git a/pyuno/source/loader/makefile.mk b/pyuno/source/loader/makefile.mk
index 6e4f96ed7014..f9f00e4f13ae 100644
--- a/pyuno/source/loader/makefile.mk
+++ b/pyuno/source/loader/makefile.mk
@@ -42,7 +42,7 @@ DLLPRE =
#-------------------------------------------------------------------
-.IF "$(OS)$(CPU)$(COMEX)" == "SOLARISS4"
+.IF "$(OS)$(COMEX)" == "SOLARIS4"
# no -Bdirect for SunWS CC
DIRECT = $(LINKFLAGSDEFS)
.ENDIF
diff --git a/pyuno/source/module/makefile.mk b/pyuno/source/module/makefile.mk
index 2357d0062ed0..2928d29668aa 100644
--- a/pyuno/source/module/makefile.mk
+++ b/pyuno/source/module/makefile.mk
@@ -42,7 +42,7 @@ LINKFLAGSDEFS = # do not fail with missing symbols
.IF "$(L10N_framework)"==""
#-------------------------------------------------------------------
-.IF "$(OS)$(CPU)$(COMEX)" == "SOLARISS4"
+.IF "$(OS)$(COMEX)" == "SOLARIS4"
# no -Bdirect for SunWS CC
DIRECT = $(LINKFLAGSDEFS)
.ENDIF
diff --git a/pyuno/source/module/pyuno_gc.cxx b/pyuno/source/module/pyuno_gc.cxx
index 513c14a99378..1e0ca08ff954 100644
--- a/pyuno/source/module/pyuno_gc.cxx
+++ b/pyuno/source/module/pyuno_gc.cxx
@@ -43,6 +43,12 @@ public:
};
StaticDestructorGuard guard;
+static bool isAfterUnloadOrPy_Finalize()
+{
+ return g_destructorsOfStaticObjectsHaveBeenCalled ||
+ !Py_IsInitialized();
+}
+
class GCThread : public ::osl::Thread
{
PyObject *mPyObject;
@@ -64,7 +70,7 @@ GCThread::GCThread( PyInterpreterState *interpreter, PyObject * object ) :
void GCThread::run()
{
// otherwise we crash here, when main has been left already
- if( g_destructorsOfStaticObjectsHaveBeenCalled )
+ if( isAfterUnloadOrPy_Finalize() )
return;
try
{
@@ -100,7 +106,7 @@ void GCThread::onTerminated()
void decreaseRefCount( PyInterpreterState *interpreter, PyObject *object )
{
// otherwise we crash in the last after main ...
- if( g_destructorsOfStaticObjectsHaveBeenCalled )
+ if( isAfterUnloadOrPy_Finalize() )
return;
// delegate to a new thread, because there does not seem