[Libreoffice-commits] core.git: sal/osl

Tor Lillqvist tml at iki.fi
Mon Mar 18 11:10:08 PDT 2013


 sal/osl/w32/dllentry.c |   19 ---------
 sal/osl/w32/interlck.c |  101 -------------------------------------------------
 2 files changed, 120 deletions(-)

New commits:
commit 0a21cce0c90a639918d8e58ac5daa4b8f674666f
Author: Tor Lillqvist <tml at iki.fi>
Date:   Mon Mar 18 20:07:31 2013 +0200

    Use InterlockedIncrement() and InterlockedDecrement() unconditionally
    
    Much simpler.
    
    Change-Id: I6837f95121f881d6265eb65343f6b311c1a6c33f

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 13392c8..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 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: */


More information about the Libreoffice-commits mailing list