[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - 4 commits - sal/osl svx/source xmloff/source

Michael Stahl mstahl at redhat.com
Thu Apr 25 06:18:18 PDT 2013


 sal/osl/w32/dllentry.c          |   19 -------
 sal/osl/w32/interlck.c          |  101 ----------------------------------------
 svx/source/svdraw/svdobj.cxx    |    1 
 xmloff/source/core/xmltoken.cxx |   26 ++++++----
 4 files changed, 16 insertions(+), 131 deletions(-)

New commits:
commit 31fb9b273bd9255dc5ff78d856e717751e4d3e92
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Apr 22 15:17:59 2013 +0200

    xmloff::token::GetXMLToken: only execute the check once
    
    Tor says this check eats many CPU cycles, and the checked array is
    static, so checking it just once is sufficient.
    
    Change-Id: Ic8f85ebe940e4cf2c258cc778a8fd14512bdef94

diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 4256732..9ada1b7 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3175,17 +3175,23 @@ namespace xmloff { namespace token {
     const OUString& GetXMLToken( enum XMLTokenEnum eToken )
     {
 #if OSL_DEBUG_LEVEL > 0
-        // check the consistency of the token list. Below, we use the ordinal value of
-        // the token as index into the token list, so we should make sure that every
-        // entry is at the proper position
-        const XMLTokenEntry* pEntry = aTokenList;
-        const XMLTokenEntry* pEntryEnd = pEntry + sizeof ( aTokenList ) / sizeof ( XMLTokenEntry );
-        sal_uInt16 nPos = 0;
-        while ( pEntry < pEntryEnd )
+        static bool s_bChecked = false;
+        if (!s_bChecked)
         {
-            assert(nPos == static_cast<sal_uInt16>(pEntry->eToken));
-                // "xmloff::GetXMLToken: inconsistency in the token list!"
-            ++pEntry, ++nPos;
+            // check the consistency of the token list. Below, we use the
+            // ordinal value of the token as index into the token list, so we
+            // should make sure that every entry is at the proper position
+            const XMLTokenEntry* pEntry = aTokenList;
+            const XMLTokenEntry* pEntryEnd =
+                pEntry + SAL_N_ELEMENTS(aTokenList);
+            sal_uInt16 nPos = 0;
+            while (pEntry < pEntryEnd)
+            {
+                assert(nPos == static_cast<sal_uInt16>(pEntry->eToken));
+                    // "xmloff::GetXMLToken: inconsistency in the token list!"
+                ++pEntry, ++nPos;
+            }
+            s_bChecked = true; // it's all static, checking once is enough
         }
 #endif
         DBG_ASSERT( eToken > XML_TOKEN_INVALID, "token value too low!" );
commit 3acaa6748d569acfd69b8f2ac22d35d168861c11
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Apr 22 15:13:40 2013 +0200

    xmloff::token::GetXMLToken: deploy assert in consistency check
    
    There will be serious problems if that is inconsistent.
    
    Change-Id: I41b8de66132224fb5cd2a6dcb7ff3128eb704016

diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 5c80146..4256732 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3183,8 +3183,8 @@ namespace xmloff { namespace token {
         sal_uInt16 nPos = 0;
         while ( pEntry < pEntryEnd )
         {
-            OSL_ENSURE( nPos == (sal_uInt16)(pEntry->eToken),
-                "xmloff::GetXMLToken: inconsistency in the token list!" );
+            assert(nPos == static_cast<sal_uInt16>(pEntry->eToken));
+                // "xmloff::GetXMLToken: inconsistency in the token list!"
             ++pEntry, ++nPos;
         }
 #endif
commit 39f549573f4de90b0005c2a59b45ff198afe3d62
Author: Tor Lillqvist <tlillqvist at suse.com>
Date:   Tue Apr 23 10:39:27 2013 +0300

    Use InterlockedIncrement() and InterlockedDecrement() unconditionally
    
    Much simpler.
    
    Cherry-picked from commit 0a21cce0c90a639918d8e58ac5daa4b8f674666f and
    modified slightly to apply.

diff --git a/sal/osl/w32/dllentry.c b/sal/osl/w32/dllentry.c
index 90b7eb2..5890ed7 100644
--- a/sal/osl/w32/dllentry.c
+++ b/sal/osl/w32/dllentry.c
@@ -77,11 +77,6 @@ extern BOOL (WINAPI *_pRawDllMain)(HANDLE, DWORD, LPVOID) = _RawDllMain;
 
 #endif
 
-//------------------------------------------------------------------------------
-// DllMain
-//------------------------------------------------------------------------------
-int osl_isSingleCPU = 0;
-
 #ifdef __MINGW32__
 
 void
@@ -158,20 +153,6 @@ static BOOL WINAPI _RawDllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvR
             {
 #endif
 
-                SYSTEM_INFO SystemInfo;
-
-                GetSystemInfo(&SystemInfo);
-
-                /* Determine if we are on a multiprocessor/multicore/HT x86/x64 system
-                 *
-                 * The lock prefix for atomic operations in osl_[inc|de]crementInterlockedCount()
-                 * comes with a cost and is especially expensive on pre HT x86 single processor
-                 * systems, where it isn't needed at all.
-                 */
-                if ( SystemInfo.dwNumberOfProcessors == 1 ) {
-                    osl_isSingleCPU = 1;
-                }
-
 #if OSL_DEBUG_LEVEL < 2
                 /* Suppress file error messages from system like "Floppy A: not inserted" */
                 SetErrorMode( SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS );
diff --git a/sal/osl/w32/interlck.c b/sal/osl/w32/interlck.c
index 70933e6..32ce6f6 100644
--- a/sal/osl/w32/interlck.c
+++ b/sal/osl/w32/interlck.c
@@ -22,119 +22,18 @@
 #include <osl/interlck.h>
 #include <osl/diagnose.h>
 
-extern int osl_isSingleCPU;
-
-/* For all Intel x86 above x486 we use a spezial inline assembler implementation.
-   The main reason is that WIN9? does not return the result of the operation.
-   Instead there is only returned a value greater than zero is the increment
-   result is greater than zero, but not the the result of the addition.
-   For Windows NT the native function could be used, because the correct result
-   is returned. Beacuse of simpler code maintance and performace reasons we use
-   on every x86-Windows-Platform the inline assembler implementation.
-*/
-
 #if defined __MINGW32__
 #pragma GCC diagnostic warning "-Wreturn-type"
 #endif
 
-/*****************************************************************************/
-/* osl_incrementInterlockedCount */
-/*****************************************************************************/
 oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount)
-#ifdef _M_IX86
-#ifdef __MINGW32__
-{
-    asm
-    (
-     "  movl        %0, %%ecx\n"
-     "      movl        $1, %%eax\n"
-     "  movl        %1, %%edx\n"
-     "  cmpl        $0, %%edx\n"
-     "  je          1f\n"
-     "      xadd        %%eax, (%%ecx)\n"
-     "  jmp         2f\n"
-     "1:\n"
-     "      lock xadd   %%eax, (%%ecx)\n"
-     "2:\n"
-     "      incl        %%eax\n"
-     ::"m"(pCount),"m"(osl_isSingleCPU)
-    );
-}
-#else
-#pragma warning(disable: 4035)
-{
-    __asm
-    {
-        mov         ecx, pCount
-        mov         eax, 1
-        mov         edx, osl_isSingleCPU
-        cmp         edx, 0
-        je          is_not_single
-        xadd        dword ptr [ecx],eax
-        jmp         cont
-    is_not_single:
-        lock xadd   dword ptr [ecx],eax
-    cont:
-        inc         eax
-    }
-}
-#pragma warning(default: 4035)
-#endif
-#else
-#pragma message("WARNING: Using system InterlockedIncrement")
 {
     return (InterlockedIncrement(pCount));
 }
-#endif
 
-/*****************************************************************************/
-/* osl_decrementInterlockedCount */
-/*****************************************************************************/
 oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* pCount)
-#ifdef _M_IX86
-#ifdef __MINGW32__
-{
-    asm
-    (
-     "  movl        %0, %%ecx\n"
-     "      orl         $-1, %%eax\n"
-     "  movl        %1, %%edx\n"
-     "  cmpl        $0, %%edx\n"
-     "  je          1f\n"
-     "      xadd        %%eax, (%%ecx)\n"
-     "  jmp         2f\n"
-     "1:\n"
-     "      lock xadd   %%eax, (%%ecx)\n"
-     "2:\n"
-     "      decl        %%eax\n"
-     ::"m"(pCount),"m"(osl_isSingleCPU)
-    );
-}
-#else
-#pragma warning(disable: 4035)
-{
-    __asm
-    {
-        mov         ecx, pCount
-        or          eax, -1
-        mov         edx, osl_isSingleCPU
-        cmp         edx, 0
-        je          is_not_single
-        xadd        dword ptr [ecx],eax
-        jmp         cont
-    is_not_single:
-        lock xadd   dword ptr [ecx],eax
-    cont:
-        dec         eax
-    }
-}
-#pragma warning(default: 4035)
-#endif
-#else
-#pragma message("WARNING: Using system InterlockedDecrement")
 {
     return (InterlockedDecrement(pCount));
 }
-#endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 5e2dbf1afbf50752e2a47a28afc9f4c68cccf12f
Author: David Tardon <dtardon at redhat.com>
Date:   Sat Mar 23 13:49:17 2013 +0100

    drop nonsensical warning
    
    Signed-off-by: Tor Lillqvist <tlillqvist at suse.com>
    
    (cherry picked from commit 85dc7b010ac8e6d6ab0ac214ea6651cbe7598cf1)
    
    Change-Id: I3f63268535bf8ed13a4728ed3eb3528193712e6e

diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 35b89c0..1d8a833 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -2932,7 +2932,6 @@ void SdrObject::impl_setUnoShape( const uno::Reference< uno::XInterface >& _rxUn
     {
         if ( !xOldUnoShape.is() )
         {
-            SAL_WARN_IF( mpSvxShape, "svx.sdr", "SdrObject::impl_setUnoShape: still having impl. pointer to dead object!" );
             // make sure there is no stale impl. pointer if the UNO
             // shape was destroyed meanwhile (remember we only hold weak
             // reference to it!)


More information about the Libreoffice-commits mailing list