diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-04-03 20:59:12 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-04-04 10:05:56 +0200 |
commit | bd08874073eab31501eceeda640340bcc97385a2 (patch) | |
tree | 0805a9371b250a66c14229ff6b76e62b3ec317b6 /sal | |
parent | c5db1e15193bcd498703c4f06a428fab9f4a18a0 (diff) |
Remove dead interlock code:
* Remove interlck_x86.s leftover from 417c85bf582e0d1dbabb7b0f16d60a394d537e61
"fdo#72598 Remove SunStudio cruft from code base."
* osl_isSingleCPU is always 0.
Change-Id: I44f633d503af0a033a977e0f812e6bd6e4282fca
Diffstat (limited to 'sal')
-rw-r--r-- | sal/Library_sal.mk | 4 | ||||
-rw-r--r-- | sal/osl/unx/asm/interlck_x86.s | 82 | ||||
-rw-r--r-- | sal/osl/unx/interlck.c | 70 | ||||
-rw-r--r-- | sal/osl/unx/system.c | 30 |
4 files changed, 20 insertions, 166 deletions
diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk index 2103fe830266..23e7b020d8af 100644 --- a/sal/Library_sal.mk +++ b/sal/Library_sal.mk @@ -209,10 +209,6 @@ ifneq ($(filter $(CPUNAME),SPARC64 SPARC),) $(eval $(call gb_Library_add_asmobjects,sal,\ sal/osl/unx/asm/interlck_sparc \ )) -else ifeq ($(OS)$(CPUNAME),SOLARISINTEL) -$(eval $(call gb_Library_add_asmobjects,sal,\ - sal/osl/unx/asm/interlck_x86 \ -)) else $(eval $(call gb_Library_add_cobjects,sal,\ sal/osl/unx/interlck \ diff --git a/sal/osl/unx/asm/interlck_x86.s b/sal/osl/unx/asm/interlck_x86.s deleted file mode 100644 index 69322d870f0b..000000000000 --- a/sal/osl/unx/asm/interlck_x86.s +++ /dev/null @@ -1,82 +0,0 @@ -/# - # This file is part of the LibreOffice project. - # - # This Source Code Form is subject to the terms of the Mozilla Public - # License, v. 2.0. If a copy of the MPL was not distributed with this - # file, You can obtain one at http://mozilla.org/MPL/2.0/. - # - # This file incorporates work covered by the following license notice: - # - # Licensed to the Apache Software Foundation (ASF) under one or more - # contributor license agreements. See the NOTICE file distributed - # with this work for additional information regarding copyright - # ownership. The ASF licenses this file to you under the Apache - # License, Version 2.0 (the "License"); you may not use this file - # except in compliance with the License. You may obtain a copy of - # the License at http://www.apache.org/licenses/LICENSE-2.0 . - #/ - -.section .text,"ax" - .globl osl_incrementInterlockedCount - -osl_incrementInterlockedCount: - - push %ebp - mov %esp,%ebp - push %ebx - call 1f -1: - pop %ebx - add $_GLOBAL_OFFSET_TABLE_+0x1,%ebx - mov 8(%ebp),%ecx - mov $1,%eax - mov osl_isSingleCPU@GOT(%ebx),%edx - cmp $0,(%edx) - je 2f - xadd %eax,(%ecx) - jmp 3f -2: - lock - xadd %eax,(%ecx) -3: - inc %eax - pop %ebx - mov %ebp,%esp - pop %ebp - ret - - .type osl_incrementInterlockedCount,@function - .size osl_incrementInterlockedCount,.-osl_incrementInterlockedCount - -.section .text,"ax" - .globl osl_decrementInterlockedCount - -osl_decrementInterlockedCount: - - push %ebp - mov %esp,%ebp - push %ebx - call 1f -1: - pop %ebx - add $_GLOBAL_OFFSET_TABLE_+0x1,%ebx - mov 8(%ebp),%ecx - orl $-1,%eax - mov osl_isSingleCPU@GOT(%ebx),%edx - cmp $0,(%edx) - je 2f - xadd %eax,(%ecx) - jmp 3f -2: - lock - xadd %eax,(%ecx) -3: - dec %eax - pop %ebx - mov %ebp,%esp - pop %ebp - ret - - .type osl_decrementInterlockedCount,@function - .size osl_decrementInterlockedCount,.-osl_decrementInterlockedCount - diff --git a/sal/osl/unx/interlck.c b/sal/osl/unx/interlck.c index b2862df42db9..025d8dcbe7a5 100644 --- a/sal/osl/unx/interlck.c +++ b/sal/osl/unx/interlck.c @@ -29,67 +29,37 @@ #elif defined ( __GNUC__ ) && ( defined ( X86 ) || defined ( X86_64 ) ) /* That's possible on x86-64 too since oslInterlockedCount is a sal_Int32 */ -extern int osl_isSingleCPU; - oslInterlockedCount SAL_CALL osl_incrementInterlockedCount(oslInterlockedCount* pCount) { - // Fast case for old, slow, single CPU Intel machines for whom - // interlocking is a performance nightmare. - if ( osl_isSingleCPU ) { - register oslInterlockedCount nCount asm("%eax"); - nCount = 1; - __asm__ __volatile__ ( - "xaddl %0, %1\n\t" - : "+r" (nCount), "+m" (*pCount) - : /* nothing */ - : "memory"); - return ++nCount; - } #if HAVE_GCC_BUILTIN_ATOMIC - else - return __sync_add_and_fetch (pCount, 1); + return __sync_add_and_fetch (pCount, 1); #else - else { - register oslInterlockedCount nCount asm("%eax"); - nCount = 1; - __asm__ __volatile__ ( - "lock\n\t" - "xaddl %0, %1\n\t" - : "+r" (nCount), "+m" (*pCount) - : /* nothing */ - : "memory"); - return ++nCount; - } + register oslInterlockedCount nCount asm("%eax"); + nCount = 1; + __asm__ __volatile__ ( + "lock\n\t" + "xaddl %0, %1\n\t" + : "+r" (nCount), "+m" (*pCount) + : /* nothing */ + : "memory"); + return ++nCount; #endif } oslInterlockedCount SAL_CALL osl_decrementInterlockedCount(oslInterlockedCount* pCount) { - if ( osl_isSingleCPU ) { - register oslInterlockedCount nCount asm("%eax"); - nCount = -1; - __asm__ __volatile__ ( - "xaddl %0, %1\n\t" - : "+r" (nCount), "+m" (*pCount) - : /* nothing */ - : "memory"); - return --nCount; - } #if HAVE_GCC_BUILTIN_ATOMIC - else - return __sync_sub_and_fetch (pCount, 1); + return __sync_sub_and_fetch (pCount, 1); #else - else { - register oslInterlockedCount nCount asm("%eax"); - nCount = -1; - __asm__ __volatile__ ( - "lock\n\t" - "xaddl %0, %1\n\t" - : "+r" (nCount), "+m" (*pCount) - : /* nothing */ - : "memory"); - return --nCount; - } + register oslInterlockedCount nCount asm("%eax"); + nCount = -1; + __asm__ __volatile__ ( + "lock\n\t" + "xaddl %0, %1\n\t" + : "+r" (nCount), "+m" (*pCount) + : /* nothing */ + : "memory"); + return --nCount; #endif } #elif HAVE_GCC_BUILTIN_ATOMIC diff --git a/sal/osl/unx/system.c b/sal/osl/unx/system.c index 0562289394a4..a234fce2a13a 100644 --- a/sal/osl/unx/system.c +++ b/sal/osl/unx/system.c @@ -345,36 +345,6 @@ char *fcvt(double value, int ndigit, int *decpt, int *sign) #endif -#if ( defined(__GNUC__) && (defined(X86) || defined(X86_64)) )\ - || ( defined(SOLARIS) && defined(__i386) ) - -/* Safe default */ -int osl_isSingleCPU = 0; - -/* 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. - * - * This should be run as early as possible, thus it's placed in the init section - */ -#if defined(_SC_NPROCESSORS_CONF) /* i.e. MACOSX for Intel doesn't have this */ -#if defined(__GNUC__) -void osl_interlockedCountCheckForSingleCPU(void) __attribute__((constructor)); -#endif - -void osl_interlockedCountCheckForSingleCPU(void) -{ - /* In case sysconfig fails be on the safe side, - * consider it a multiprocessor/multicore/HT system */ - if ( sysconf(_SC_NPROCESSORS_CONF) == 1 ) { - osl_isSingleCPU = 1; - } -} -#endif /* defined(_SC_NPROCESSORS_CONF) */ -#endif - //might be useful on other platforms, but doesn't compiler under MACOSX anyway #if defined(__GNUC__) && defined(LINUX) //force the __data_start symbol to exist in any executables that link against |