[Libreoffice-commits] core.git: bridges/source include/wntgcci

Luboš Luňák l.lunak at suse.cz
Wed Jun 5 07:06:43 PDT 2013


 bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-i386.cxx          |   25 ++++----
 bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx |   25 ++++----
 bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx           |   19 +++---
 bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx          |   29 ++++------
 bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx         |   23 +++----
 bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx         |   18 +++---
 bridges/source/cpp_uno/mingw_intel/callvirtualmethod.cxx      |   23 +++----
 include/wntgcci/sehandler.hxx                                 |    2 
 8 files changed, 82 insertions(+), 82 deletions(-)

New commits:
commit 6b8393474974d2af7a2cb3c47b3d5c081b550bdb
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue Jun 4 13:24:59 2013 +0200

    fix gcc inline assembler operands usage
    
    Apparently whoever did these didn't get the gcc docs and specified
    every operand only as input, and then added volatile, explicit
    initialization and what not until it worked. Specify output operands
    correctly instead.
    I couldn't verify all assembler variants, as I don't know them,
    but the ones I don't know had at least some proper usage of output
    operands, so I'll assume those are all correct.
    
    Change-Id: I2910308b5e00cce8db756496df50ed26cfe35bb6

diff --git a/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-i386.cxx b/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-i386.cxx
index 45e51a9..5846f5d 100644
--- a/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-i386.cxx
+++ b/bridges/source/cpp_uno/gcc3_ios_arm/uno2cpp-i386.cxx
@@ -67,11 +67,11 @@ void callVirtualMethod(
     // never called
     if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
 
-    volatile long edx = 0, eax = 0; // for register returns
-    void * stackptr = 0;
+    long edx, eax; // for register returns
+    void * stackptr;
     asm volatile (
-        "mov   %%esp, %6\n\t"
-        "mov   %0, %%eax\n\t"
+        "mov   %%esp, %2\n\t"
+        "mov   %3, %%eax\n\t"
         "mov   %%eax, %%edx\n\t"
                 // stack padding to keep stack aligned:
         "shl   $2, %%eax\n\t"
@@ -83,28 +83,27 @@ void callVirtualMethod(
         "mov   %%edx, %%eax\n\t"
         "dec   %%edx\n\t"
         "shl   $2, %%edx\n\t"
-        "add   %1, %%edx\n"
+        "add   %4, %%edx\n"
         "Lcopy:\n\t"
         "pushl 0(%%edx)\n\t"
         "sub   $4, %%edx\n\t"
         "dec   %%eax\n\t"
         "jne   Lcopy\n\t"
         // do the actual call
-        "mov   %2, %%edx\n\t"
+        "mov   %5, %%edx\n\t"
         "mov   0(%%edx), %%edx\n\t"
-        "mov   %3, %%eax\n\t"
+        "mov   %6, %%eax\n\t"
         "shl   $2, %%eax\n\t"
         "add   %%eax, %%edx\n\t"
         "mov   0(%%edx), %%edx\n\t"
         "call  *%%edx\n\t"
         // save return registers
-         "mov   %%eax, %4\n\t"
-         "mov   %%edx, %5\n\t"
+         "mov   %%eax, %0\n\t"
+         "mov   %%edx, %1\n\t"
         // cleanup stack
-        "mov   %6, %%esp\n\t"
-        :
-        : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr),
-          "m"(nVtableIndex), "m"(eax), "m"(edx), "m"(stackptr)
+        "mov   %2, %%esp\n\t"
+        : "=m"(eax), "=m"(edx), "=m"(stackptr)
+        : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr), "m"(nVtableIndex)
         : "eax", "edx" );
     switch( pReturnTypeDescr->eTypeClass )
     {
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx
index af060de..15b357b 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/callvirtualmethod.cxx
@@ -62,44 +62,43 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod(
     if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
 #endif
 
-    volatile long edx = 0, eax = 0; // for register returns
+    long edx, eax; // for register returns
     void * stackptr;
     asm volatile (
-        "mov   %%esp, %6\n\t"
+        "mov   %%esp, %2\n\t"
         // preserve potential 128bit stack alignment
         "and   $0xfffffff0, %%esp\n\t"
-        "mov   %0, %%eax\n\t"
+        "mov   %3, %%eax\n\t"
         "lea   -4(,%%eax,4), %%eax\n\t"
         "and   $0xf, %%eax\n\t"
         "sub   $0xc, %%eax\n\t"
         "add   %%eax, %%esp\n\t"
         // copy values
-        "mov   %0, %%eax\n\t"
+        "mov   %3, %%eax\n\t"
         "mov   %%eax, %%edx\n\t"
         "dec   %%edx\n\t"
         "shl   $2, %%edx\n\t"
-        "add   %1, %%edx\n"
+        "add   %4, %%edx\n"
         "Lcopy:\n\t"
         "pushl 0(%%edx)\n\t"
         "sub   $4, %%edx\n\t"
         "dec   %%eax\n\t"
         "jne   Lcopy\n\t"
         // do the actual call
-        "mov   %2, %%edx\n\t"
+        "mov   %5, %%edx\n\t"
         "mov   0(%%edx), %%edx\n\t"
-        "mov   %3, %%eax\n\t"
+        "mov   %6, %%eax\n\t"
         "shl   $2, %%eax\n\t"
         "add   %%eax, %%edx\n\t"
         "mov   0(%%edx), %%edx\n\t"
         "call  *%%edx\n\t"
         // save return registers
-         "mov   %%eax, %4\n\t"
-         "mov   %%edx, %5\n\t"
+         "mov   %%eax, %0\n\t"
+         "mov   %%edx, %1\n\t"
         // cleanup stack
-        "mov   %6, %%esp\n\t"
-        :
-        : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr),
-          "m"(nVtableIndex), "m"(eax), "m"(edx), "m"(stackptr)
+        "mov   %2, %%esp\n\t"
+        : "=m"(eax), "=m"(edx), "=m"(stackptr)
+        : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr), "m"(nVtableIndex)
         : "eax", "ecx", "edx" );
     switch( pReturnTypeDescr->eTypeClass )
     {
diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx
index 37b00d2..1a73ed5 100644
--- a/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx
@@ -70,9 +70,9 @@ void callVirtualMethod( void * pAdjustedThisPtr,
     // never called
     if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
 
-    volatile long o0 = 0, o1 = 0; // for register returns
-    volatile double f0d = 0;
-    volatile float f0f = 0;
+    long o0, o1; // for register returns
+    double f0d;
+    float f0f;
     volatile long long saveReg[7];
 
     __asm__ (
@@ -231,12 +231,15 @@ void callVirtualMethod( void * pAdjustedThisPtr,
         "ldd [%%l7], %%o4\n\t"
         "add %%l7, 8, %%l7\n\t"
         "ldd [%%l7], %%l6\n\t"
-        : :
-        "m"(o0),
-        "m"(o1),
-        "m"(f0d),
-        "m"(f0f),
+        :
+        "=m"(o0),
+        "=m"(o1),
+        "=m"(f0d),
+        "=m"(f0f),
+        :
         "r"(&saveReg[0])
+        :
+        "memory"
         );
     switch( eReturnType )
     {
diff --git a/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx
index 9b14f17..7c09e3c 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx
@@ -70,11 +70,11 @@ void callVirtualMethod(
     // never called
     if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
 
-    volatile long edx = 0, eax = 0; // for register returns
-    void * stackptr = 0;
+    long edx, eax; // for register returns
+    void * stackptr;
     asm volatile (
-        "mov   %%esp, %6\n\t"
-        "mov   %0, %%eax\n\t"
+        "mov   %%esp, %2\n\t"
+        "mov   %3, %%eax\n\t"
         "mov   %%eax, %%edx\n\t"
                 // stack padding to keep stack aligned:
         "shl   $2, %%eax\n\t"
@@ -86,28 +86,27 @@ void callVirtualMethod(
         "mov   %%edx, %%eax\n\t"
         "dec   %%edx\n\t"
         "shl   $2, %%edx\n\t"
-        "add   %1, %%edx\n"
+        "add   %4, %%edx\n"
         "Lcopy:\n\t"
         "pushl 0(%%edx)\n\t"
         "sub   $4, %%edx\n\t"
         "dec   %%eax\n\t"
         "jne   Lcopy\n\t"
         // do the actual call
-        "mov   %2, %%edx\n\t"
+        "mov   %5, %%edx\n\t"
         "mov   0(%%edx), %%edx\n\t"
-        "mov   %3, %%eax\n\t"
+        "mov   %6, %%eax\n\t"
         "shl   $2, %%eax\n\t"
         "add   %%eax, %%edx\n\t"
         "mov   0(%%edx), %%edx\n\t"
         "call  *%%edx\n\t"
         // save return registers
-         "mov   %%eax, %4\n\t"
-         "mov   %%edx, %5\n\t"
+         "mov   %%eax, %0\n\t"
+         "mov   %%edx, %1\n\t"
         // cleanup stack
-        "mov   %6, %%esp\n\t"
-        :
-        : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr),
-          "m"(nVtableIndex), "m"(eax), "m"(edx), "m"(stackptr)
+        "mov   %2, %%esp\n\t"
+        : "=m"(eax), "=m"(edx), "=m"(stackptr)
+        : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr), "m"(nVtableIndex)
         : "eax", "ecx", "edx" );
     switch( pReturnTypeDescr->eTypeClass )
     {
@@ -131,10 +130,10 @@ void callVirtualMethod(
         *(unsigned char*)pRegisterReturn = eax;
         break;
     case typelib_TypeClass_FLOAT:
-        asm ( "fstps %0" : : "m"(*(char *)pRegisterReturn) );
+        asm ( "fstps %0" : "=m"(*(char *)pRegisterReturn) );
         break;
     case typelib_TypeClass_DOUBLE:
-        asm ( "fstpl %0\n\t" : : "m"(*(char *)pRegisterReturn) );
+        asm ( "fstpl %0\n\t" : "=m"(*(char *)pRegisterReturn) );
         break;
     default: {
         sal_Int32 const nRetSize = pReturnTypeDescr->nSize;
diff --git a/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx
index 1be1215..13ac8df 100644
--- a/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx
@@ -57,37 +57,36 @@ static void callVirtualMethod(
     // never called
     if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
 
-    volatile long edx = 0, eax = 0; // for register returns
+    long edx, eax; // for register returns
     void * stackptr;
     asm volatile (
-        "mov   %%esp, %6\n\t"
+        "mov   %%esp, %2\n\t"
         // copy values
-        "mov   %0, %%eax\n\t"
+        "mov   %3, %%eax\n\t"
         "mov   %%eax, %%edx\n\t"
         "dec   %%edx\n\t"
         "shl   $2, %%edx\n\t"
-        "add   %1, %%edx\n"
+        "add   %4, %%edx\n"
         "Lcopy:\n\t"
         "pushl 0(%%edx)\n\t"
         "sub   $4, %%edx\n\t"
         "dec   %%eax\n\t"
         "jne   Lcopy\n\t"
         // do the actual call
-        "mov   %2, %%edx\n\t"
+        "mov   %5, %%edx\n\t"
         "mov   0(%%edx), %%edx\n\t"
-        "mov   %3, %%eax\n\t"
+        "mov   %6, %%eax\n\t"
         "shl   $2, %%eax\n\t"
         "add   %%eax, %%edx\n\t"
         "mov   0(%%edx), %%edx\n\t"
         "call  *%%edx\n\t"
         // save return registers
-         "mov   %%eax, %4\n\t"
-         "mov   %%edx, %5\n\t"
+         "mov   %%eax, %0\n\t"
+         "mov   %%edx, %1\n\t"
         // cleanup stack
-        "mov   %6, %%esp\n\t"
-        :
-        : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr),
-          "m"(nVtableIndex), "m"(eax), "m"(edx), "m"(stackptr)
+        "mov   %2, %%esp\n\t"
+        : "=m"(eax), "=m"(edx), "=m"(stackptr)
+        : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr), "m"(nVtableIndex)
         : "eax", "ecx", "edx" );
     switch( eReturnType )
     {
diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx
index a85d756..ae9f0b8 100644
--- a/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx
@@ -68,9 +68,9 @@ void callVirtualMethod( void * pAdjustedThisPtr,
     // never called
     if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
 
-    volatile long o0 = 0, o1 = 0; // for register returns
-    volatile double f0d = 0;
-    volatile float f0f = 0;
+    long o0, o1; // for register returns
+    double f0d;
+    float f0f;
     volatile long long saveReg[7];
 
     __asm__ (
@@ -229,12 +229,14 @@ void callVirtualMethod( void * pAdjustedThisPtr,
         "ldd [%%l7], %%o4\n\t"
         "add %%l7, 8, %%l7\n\t"
         "ldd [%%l7], %%l6\n\t"
-        : :
-        "m"(o0),
-        "m"(o1),
-        "m"(f0d),
-        "m"(f0f),
+        :
+        "=m"(o0),
+        "=m"(o1),
+        "=m"(f0d),
+        "=m"(f0f),
+        :
         "r"(&saveReg[0])
+        : "memory"
         );
     switch( eReturnType )
     {
diff --git a/bridges/source/cpp_uno/mingw_intel/callvirtualmethod.cxx b/bridges/source/cpp_uno/mingw_intel/callvirtualmethod.cxx
index c1bb9b6..2f6950a 100644
--- a/bridges/source/cpp_uno/mingw_intel/callvirtualmethod.cxx
+++ b/bridges/source/cpp_uno/mingw_intel/callvirtualmethod.cxx
@@ -56,37 +56,36 @@ void CPPU_CURRENT_NAMESPACE::callVirtualMethod(
     // never called
     if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
 
-    volatile long edx = 0, eax = 0; // for register returns
+    long edx, eax; // for register returns
     void * stackptr;
     asm volatile (
-        "mov   %%esp, %6\n\t"
+        "mov   %%esp, %2\n\t"
         // copy values
-        "mov   %0, %%eax\n\t"
+        "mov   %3, %%eax\n\t"
         "mov   %%eax, %%edx\n\t"
         "dec   %%edx\n\t"
         "shl   $2, %%edx\n\t"
-        "add   %1, %%edx\n"
+        "add   %4, %%edx\n"
         "Lcopy:\n\t"
         "pushl 0(%%edx)\n\t"
         "sub   $4, %%edx\n\t"
         "dec   %%eax\n\t"
         "jne   Lcopy\n\t"
         // do the actual call
-        "mov   %2, %%edx\n\t"
+        "mov   %5, %%edx\n\t"
         "mov   0(%%edx), %%edx\n\t"
-        "mov   %3, %%eax\n\t"
+        "mov   %6, %%eax\n\t"
         "shl   $2, %%eax\n\t"
         "add   %%eax, %%edx\n\t"
         "mov   0(%%edx), %%edx\n\t"
         "call  *%%edx\n\t"
         // save return registers
-         "mov   %%eax, %4\n\t"
-         "mov   %%edx, %5\n\t"
+         "mov   %%eax, %0\n\t"
+         "mov   %%edx, %1\n\t"
         // cleanup stack
-        "mov   %6, %%esp\n\t"
-        :
-        : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr),
-          "m"(nVtableIndex), "m"(eax), "m"(edx), "m"(stackptr)
+        "mov   %2, %%esp\n\t"
+        : "=m"(eax), "=m"(edx), "=m"(stackptr)
+        : "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr), "m"(nVtableIndex)
         : "eax", "ecx", "edx" );
     switch( returnType->eTypeClass )
     {
diff --git a/include/wntgcci/sehandler.hxx b/include/wntgcci/sehandler.hxx
index 9218add..6f196d8 100644
--- a/include/wntgcci/sehandler.hxx
+++ b/include/wntgcci/sehandler.hxx
@@ -58,7 +58,7 @@ public:
         m_ER.pHandlerClass = this;
         m_ER.hp = handler;
         asm("movl %%fs:0, %%eax\n\t"
-            "movl %%eax, %0": : "m" (m_ER.prev): "%eax" );
+            "movl %%eax, %0": "=m" (m_ER.prev): : "%eax" );
         asm("movl %0, %%eax\n\t"
             "movl %%eax, %%fs:0": : "r" (&m_ER): "%eax" );
     }


More information about the Libreoffice-commits mailing list