[Libreoffice-commits] core.git: Branch 'libreoffice-5-0-0' - 2 commits - bridges/source testtools/com testtools/source

Caolan McNamara caolanm at redhat.com
Thu Jul 16 06:12:11 PDT 2015


 bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx |    6 +
 bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx |   77 +++++++---------
 testtools/com/sun/star/comp/bridge/TestComponent.java   |    4 
 testtools/source/bridgetest/bridgetest.cxx              |    4 
 testtools/source/bridgetest/cli/cli_cs_testobj.cs       |    5 +
 testtools/source/bridgetest/cppobj.cxx                  |    2 
 testtools/source/bridgetest/idl/bridgetest.idl          |    6 +
 7 files changed, 61 insertions(+), 43 deletions(-)

New commits:
commit c6d575c8074595b489ef0d1ecf3065b9aec7d97a
Author: Caolan McNamara <caolanm at redhat.com>
Date:   Fri Jul 10 16:36:41 2015 +0100

    ppc64: using a fp register also consumes a gp register slot
    
    Change-Id: Idf6f40081f4598c0fa9d1e10bdc208eae49e4cd1
    Reviewed-on: https://gerrit.libreoffice.org/16936
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit e8ac3b5bd973054c6fd74db017bb448721e2c3e2)
    Reviewed-on: https://gerrit.libreoffice.org/16946
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>
    (cherry picked from commit f31326f623b0be2392b3846f710df75ea8760446)

diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx
index 6b58246..6ac003b 100644
--- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/cpp2uno.cxx
@@ -133,6 +133,12 @@ static typelib_TypeClass cpp2uno_call(
                         }
                         pCppArgs[nPos] = pUnoArgs[nPos] = fpreg++;
                         nf++;
+
+                        if (ng < ppc64::MAX_GPR_REGS)
+                        {
+                            ng++;
+                            gpreg++;
+                        }
                     }
                     else
                     {
diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx
index 81d3d5c..28dfaf8 100644
--- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx
@@ -229,16 +229,20 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
 
 // The value in %xmm register is already prepared to be retrieved as a float,
 // thus we treat float and double the same
-#define INSERT_FLOAT( pSV, nr, pFPR, pDS, bOverflow ) \
-        if ( nr < ppc64::MAX_SSE_REGS ) \
+#define INSERT_FLOAT( pSV, nr, pFPR, nGPR, pDS, bOverflow ) \
+        if ( nGPR < ppc64::MAX_GPR_REGS ) \
+                ++nGPR;                   \
+        if ( nr < ppc64::MAX_SSE_REGS )   \
                 pFPR[nr++] = *reinterpret_cast<float *>( pSV ); \
         else \
             bOverflow = true; \
         if (bOverflow) \
                 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim!
 
-#define INSERT_DOUBLE( pSV, nr, pFPR, pDS, bOverflow ) \
-        if ( nr < ppc64::MAX_SSE_REGS ) \
+#define INSERT_DOUBLE( pSV, nr, pFPR, nGPR, pDS, bOverflow ) \
+        if ( nGPR < ppc64::MAX_GPR_REGS ) \
+                ++nGPR;                   \
+        if ( nr < ppc64::MAX_SSE_REGS )   \
                 pFPR[nr++] = *reinterpret_cast<double *>( pSV ); \
         else \
             bOverflow = true; \
@@ -390,10 +394,10 @@ static void cpp_call(
                                 INSERT_INT8( pCppArgs[nPos], nGPR, pGPR, pStack, bOverflow );
                                 break;
                         case typelib_TypeClass_FLOAT:
-                                INSERT_FLOAT( pCppArgs[nPos], nFPR, pFPR, pStack, bOverflow );
+                                INSERT_FLOAT( pCppArgs[nPos], nFPR, pFPR, nGPR, pStack, bOverflow );
                                 break;
                         case typelib_TypeClass_DOUBLE:
-                                INSERT_DOUBLE( pCppArgs[nPos], nFPR, pFPR, pStack, bOverflow );
+                                INSERT_DOUBLE( pCppArgs[nPos], nFPR, pFPR, nGPR, pStack, bOverflow );
                                 break;
                         default:
                                 break;
diff --git a/testtools/com/sun/star/comp/bridge/TestComponent.java b/testtools/com/sun/star/comp/bridge/TestComponent.java
index bf1524d..8e07d1a 100644
--- a/testtools/com/sun/star/comp/bridge/TestComponent.java
+++ b/testtools/com/sun/star/comp/bridge/TestComponent.java
@@ -498,6 +498,10 @@ public class TestComponent {
             return i2;
         }
 
+        public int testPPC64Alignment( double d1, double d2, double d3, int i1 ) throws com.sun.star.uno.RuntimeException {
+            return i1;
+        }
+
         public double testTenDoubles( double d1, double d2, double d3, double d4, double d5, double d6, double d7, double d8, double d9, double d10 ) {
             return d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10;
         }
diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx
index ea37b9a..427513f 100644
--- a/testtools/source/bridgetest/bridgetest.cxx
+++ b/testtools/source/bridgetest/bridgetest.cxx
@@ -529,6 +529,10 @@ static bool performTest(
                 bRet &= check(i2 == 0xBEAF, "ppc-style alignment test");
             }
             {
+                sal_Int32 i1 = xLBT->testPPC64Alignment(1.0, 2.0, 3.0, 0xBEAF);
+                bRet &= check(i1 == 0xBEAF, "ppc64-style alignment test");
+            }
+            {
                 double d1 = xLBT->testTenDoubles(0.1, 0.2, 0.3, 0.4, 0.5,
                     0.6, 0.7, 0.8, 0.9, 1.0);
                 bRet &= check(d1 == 5.5, "armhf doubles test");
diff --git a/testtools/source/bridgetest/cli/cli_cs_testobj.cs b/testtools/source/bridgetest/cli/cli_cs_testobj.cs
index 9d0ac7a..8f396c9 100644
--- a/testtools/source/bridgetest/cli/cli_cs_testobj.cs
+++ b/testtools/source/bridgetest/cli/cli_cs_testobj.cs
@@ -255,6 +255,11 @@ public class BridgeTestObject : WeakBase, XRecursiveCall, XBridgeTest2
         return i2;
     }
 
+    public int testPPC64Alignment( double d1, double d2, double d3, int i1 )
+    {
+        return i1;
+    }
+
     public double testTenDoubles( double d1, double d2, double d3, double d4, double d5, double d6, double d7, double d8, double d9, double d10 )
     {
         return d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10;
diff --git a/testtools/source/bridgetest/cppobj.cxx b/testtools/source/bridgetest/cppobj.cxx
index a468d90..30f85f0 100644
--- a/testtools/source/bridgetest/cppobj.cxx
+++ b/testtools/source/bridgetest/cppobj.cxx
@@ -220,6 +220,8 @@ public:
         { return rStruct; }
     virtual sal_Int32 SAL_CALL testPPCAlignment( sal_Int64, sal_Int64, sal_Int32, sal_Int64, sal_Int32 i2 ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
         { return i2; }
+    virtual sal_Int32 SAL_CALL testPPC64Alignment( double , double , double , sal_Int32 i1 ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
+        { return i1; }
     virtual double SAL_CALL testTenDoubles( double d1, double d2, double d3, double d4, double d5, double d6, double d7, double d8, double d9, double d10 ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
         { return d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10; }
     virtual sal_Bool SAL_CALL getBool() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
diff --git a/testtools/source/bridgetest/idl/bridgetest.idl b/testtools/source/bridgetest/idl/bridgetest.idl
index a11ba28..22612b8 100644
--- a/testtools/source/bridgetest/idl/bridgetest.idl
+++ b/testtools/source/bridgetest/idl/bridgetest.idl
@@ -307,6 +307,12 @@ interface XBridgeTestBase : com::sun::star::uno::XInterface
     long testPPCAlignment( [in] hyper l1, [in] hyper l2, [in] long i1, [in] hyper l3, [in] long i2 );
 
     /**
+     * PPC64 Alignment test
+     */
+    long testPPC64Alignment( [in] double d1, [in] double d2, [in] double d3, [in] long i1 );
+
+
+    /**
      * VFP ABI (armhf) doubles test
      */
     double testTenDoubles( [in] double d1, [in] double d2, [in] double d3, [in] double d4, [in] double d5, [in] double d6, [in] double d7, [in] double d8, [in] double d9, [in] double d10 );
commit ff5ca22c0f9eddbc4ef37f29bad90229774961fc
Author: Caolan McNamara <caolanm at redhat.com>
Date:   Fri Jul 10 16:00:22 2015 +0100

    ppc64: simplify this a little
    
    Change-Id: I8166f65625d389a604750852d6d5a4fee25a88fa
    Reviewed-on: https://gerrit.libreoffice.org/16935
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit fe14c55f000b9a31d885b411655232e0691e1cd4)
    Reviewed-on: https://gerrit.libreoffice.org/16945
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>
    (cherry picked from commit 3059edbc419e79f964a340b5b0ac828a5e866666)

diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx
index 4013076..81d3d5c 100644
--- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx
@@ -124,6 +124,8 @@ void MapReturn(long r3, long r4, double dret, typelib_TypeDescriptionReference*
                 if (pReturnType->pType->nSize > 8)
                     pRegisters[1] = r4;
             }
+#else
+    (void)r4;
 #endif
     default:
             break;
@@ -185,45 +187,29 @@ static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex,
 
     //  fill registers
     __asm__ __volatile__ (
-                "ld   3,  0(%0)\n\t"
-                "ld   4,  8(%0)\n\t"
-                "ld   5, 16(%0)\n\t"
-                "ld   6, 24(%0)\n\t"
-                "ld   7, 32(%0)\n\t"
-                "ld   8, 40(%0)\n\t"
-                "ld   9, 48(%0)\n\t"
-                "ld  10, 56(%0)\n\t"
-                "lfd  1,  0(%1)\n\t"
-                "lfd  2,  8(%1)\n\t"
-                "lfd  3, 16(%1)\n\t"
-                "lfd  4, 24(%1)\n\t"
-                "lfd  5, 32(%1)\n\t"
-                "lfd  6, 40(%1)\n\t"
-                "lfd  7, 48(%1)\n\t"
-                "lfd  8, 56(%1)\n\t"
-                "lfd  9, 64(%1)\n\t"
-                "lfd 10, 72(%1)\n\t"
-                "lfd 11, 80(%1)\n\t"
-                "lfd 12, 88(%1)\n\t"
-                "lfd 13, 96(%1)\n\t"
-                : : "r" (pGPR), "r" (pFPR)
-              : "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
-                  "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", "fr8", "fr9",
-                  "fr10", "fr11", "fr12", "fr13"
+                "lfd  1,  0(%0)\n\t"
+                "lfd  2,  8(%0)\n\t"
+                "lfd  3, 16(%0)\n\t"
+                "lfd  4, 24(%0)\n\t"
+                "lfd  5, 32(%0)\n\t"
+                "lfd  6, 40(%0)\n\t"
+                "lfd  7, 48(%0)\n\t"
+                "lfd  8, 56(%0)\n\t"
+                "lfd  9, 64(%0)\n\t"
+                "lfd 10, 72(%0)\n\t"
+                "lfd 11, 80(%0)\n\t"
+                "lfd 12, 88(%0)\n\t"
+                "lfd 13, 96(%0)\n\t"
+                : : "r" (pFPR)
+              : "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", "fr8", "fr9",
+                "fr10", "fr11", "fr12", "fr13"
     );
 
     // tell gcc that r3 to r11 are not available to it for doing the TOC and exception munge on the func call
     register sal_uInt64 r3 asm("r3");
     register sal_uInt64 r4 asm("r4");
-    register sal_uInt64 r5 asm("r5");
-    register sal_uInt64 r6 asm("r6");
-    register sal_uInt64 r7 asm("r7");
-    register sal_uInt64 r8 asm("r8");
-    register sal_uInt64 r9 asm("r9");
-    register sal_uInt64 r10 asm("r10");
-    register sal_uInt64 r11 asm("r11");
 
-    (*pFunc)(r3, r4, r5, r6, r7, r8, r9, r10);
+    (*pFunc)(pGPR[0], pGPR[1], pGPR[2], pGPR[3], pGPR[4], pGPR[5], pGPR[6], pGPR[7]);
 
     // get return value
     __asm__ __volatile__ (
@@ -375,7 +361,6 @@ static void cpp_call(
 
         if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
         {
-//          uno_copyAndConvertData( pCppArgs[nPos] = alloca( 8 ), pUnoArgs[nPos], pParamTypeDescr,
             uno_copyAndConvertData( pCppArgs[nPos] = pStack, pUnoArgs[nPos], pParamTypeDescr,
                                     pThis->getBridge()->getUno2Cpp() );
                 switch (pParamTypeDescr->eTypeClass)
@@ -383,7 +368,7 @@ static void cpp_call(
                         case typelib_TypeClass_HYPER:
                         case typelib_TypeClass_UNSIGNED_HYPER:
 #if OSL_DEBUG_LEVEL > 2
-                fprintf(stderr, "hyper is %lx\n", pCppArgs[nPos]);
+                                fprintf(stderr, "hyper is %lx\n", pCppArgs[nPos]);
 #endif
                                 INSERT_INT64( pCppArgs[nPos], nGPR, pGPR, pStack, bOverflow );
                                 break;
@@ -391,7 +376,7 @@ static void cpp_call(
                         case typelib_TypeClass_UNSIGNED_LONG:
                         case typelib_TypeClass_ENUM:
 #if OSL_DEBUG_LEVEL > 2
-                fprintf(stderr, "long is %x\n", pCppArgs[nPos]);
+                                fprintf(stderr, "long is %x\n", pCppArgs[nPos]);
 #endif
                                 INSERT_INT32( pCppArgs[nPos], nGPR, pGPR, pStack, bOverflow );
                                 break;
@@ -406,10 +391,12 @@ static void cpp_call(
                                 break;
                         case typelib_TypeClass_FLOAT:
                                 INSERT_FLOAT( pCppArgs[nPos], nFPR, pFPR, pStack, bOverflow );
-                break;
+                                break;
                         case typelib_TypeClass_DOUBLE:
                                 INSERT_DOUBLE( pCppArgs[nPos], nFPR, pFPR, pStack, bOverflow );
                                 break;
+                        default:
+                                break;
                         }
 
                         // no longer needed


More information about the Libreoffice-commits mailing list