Kaydet (Commit) bd088740 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Remove dead interlock code:

* Remove interlck_x86.s leftover from 417c85bf
  "fdo#72598 Remove SunStudio cruft from code base."

* osl_isSingleCPU is always 0.

Change-Id: I44f633d503af0a033a977e0f812e6bd6e4282fca
üst c5db1e15
......@@ -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 \
......
/#
# 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
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment