8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 17:23:03 +01:00

Cleanup - removed artifacts of c++03 atomics implementation

This commit is contained in:
AlexPeshkoff 2024-08-07 13:23:58 +03:00
parent c03852efc9
commit 0616d8bcd2
6 changed files with 0 additions and 160 deletions

View File

@ -685,11 +685,6 @@ AC_ARG_WITH(system-boost,
[SYSTEM_BOOST=Y])
AC_SUBST(SYSTEM_BOOST)
ATOMICLIB=atomic
AC_ARG_WITH(atomiclib,
[ --with-atomiclib build with explicitly specified atomic support library],
[ATOMICLIB=${withval}])
dnl Avoid dumb '-g -O2' autoconf's default
dnl Debugging information and optimization flags should be set in prefix.$platform file
dnl Should be replaced with AC_PROG_GCC_DEFAULT_FLAGS() when available
@ -1044,7 +1039,6 @@ dnl Check for libraries
AC_SEARCH_LIBS(dlopen, dl)
AC_CHECK_LIB(m, main)
AC_SEARCH_LIBS(inet_aton, resolv)
AC_CHECK_LIB($ATOMICLIB, main)
dnl Check for libraries for static C++ runtime linking
AC_CHECK_LIB(supc++, main, XE_APPEND(-lsupc++, STATIC_CXXSUPPORT_LIB))

View File

@ -57,7 +57,6 @@ bool SyncObject::lock(Sync* sync, SyncType type, const char* from, int timeOut)
const AtomicCounter::counter_type newState = oldState + 1;
if (lockState.compareExchange(oldState, newState))
{
WaitForFlushCache();
#ifdef DEV_BUILD
MutexLockGuard g(mutex, FB_FUNCTION);
reason(from);
@ -113,7 +112,6 @@ bool SyncObject::lock(Sync* sync, SyncType type, const char* from, int timeOut)
if (lockState.compareExchange(oldState, -1))
{
exclusiveThread = thread;
WaitForFlushCache();
#ifdef DEV_BUILD
MutexLockGuard g(mutex, FB_FUNCTION);
#endif
@ -168,7 +166,6 @@ bool SyncObject::lockConditional(SyncType type, const char* from)
const AtomicCounter::counter_type newState = oldState + 1;
if (lockState.compareExchange(oldState, newState))
{
WaitForFlushCache();
#ifdef DEV_BUILD
MutexLockGuard g(mutex, FB_FUNCTION);
#endif
@ -197,7 +194,6 @@ bool SyncObject::lockConditional(SyncType type, const char* from)
if (lockState.compareExchange(oldState, -1))
{
WaitForFlushCache();
exclusiveThread = thread;
reason(from);
return true;
@ -227,8 +223,6 @@ void SyncObject::unlock(Sync* /*sync*/, SyncType type)
const AtomicCounter::counter_type oldState = lockState;
const AtomicCounter::counter_type newState = (type == SYNC_SHARED) ? oldState - 1 : 0;
FlushCache();
if (lockState.compareExchange(oldState, newState))
{
if (newState == 0 && waiters)
@ -248,7 +242,6 @@ void SyncObject::downgrade(SyncType type)
fb_assert(exclusiveThread == ThreadSync::findThread());
exclusiveThread = NULL;
FlushCache();
while (true)
{

View File

@ -162,14 +162,6 @@ private:
std::atomic<counter_type> counter;
};
// NS 2014-08-01: FIXME. Atomic counters use barriers on all platforms, so
// these operations are no-ops and will always be no-ops. They were used
// to work around (incorrectly) bugs in Sparc and PPC atomics code.
inline void FlushCache() { }
inline void WaitForFlushCache() { }
} // namespace Firebird
#endif // CLASSES_FB_ATOMIC_H

View File

@ -1,58 +0,0 @@
/*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.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.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl.
*
* Software distributed under the License is distributed AS IS,
* WITHOUT WARRANTY OF ANY KIND, either express or implied.
* See the License for the specific language governing rights
* and limitations under the License.
*
* The Original Code was created by Bill Oliver
* for the Firebird Open Source RDBMS project.
*
* Copyright (c) 2009 Bill Oliver <Bill.Oliver@sas.com>
* and all contributors signed below.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
Solaris 9 sparc assembly language implementation of atomic operators
See http://developers.sun.com/solaris/articles/atomic_sparc/
*/
/* sparc version of fetch_and_add atomic operation, see fb_atomic.h */
/* extern int fetch_and_add_il(volatile unsigned *word_addr, int value); */
.inline fetch_and_add_il,8
membar #LoadStore|#StoreStore
ld [%o0],%g1 ! load *word_addr from %o0 to %g1
add %g1,%o1,%o2 ! compute the desired result, %g1 + %o1 (value) -> %o2 (temporary)
0:
cas [%o0],%g1,%o2 ! try to CAS it into place
cmp %g1,%o2 ! compare old to new
bne,a,pn %icc,0b ! CAS failed, try again
mov %o2,%g1 ! copy result -> %g1 for next iteration
mov %o2,%o0 ! return old value
membar #LoadLoad|#LoadStore
.end
/* sparc version of compare_and_swap, see fb_atomic.h */
/* extern boolean_t compare_and_swap_il(volatile unsigned *word_addr, unsigned *old_val_addr, int new_val); */
.inline compare_and_swap_il,12
membar #LoadStore|#StoreStore
ld [%o1],%g1 ! set the old value
cas [%o0],%g1,%o2 ! try the CAS
cmp %g1,%o2
be,a true
mov 1,%o0 ! return TRUE/1
mov 0,%o0 ! return FALSE/0
true:
st %o2,[%o1] ! store existing value in memory
membar #LoadLoad|#LoadStore
.end

View File

@ -1,43 +0,0 @@
/*
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.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.ibphoenix.com/idpl.html.
*
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The contents of this file or any work derived from this file
* may not be distributed under any other license whatsoever
* without the express prior written permission of the original
* author.
*
*
* The Original Code was created by James A. Starkey for IBPhoenix.
*
* Copyright (c) 2004 James A. Starkey
* All Rights Reserved.
*/
.inline cas,3
cas [%o0],%o1,%o2
mov %o2,%o0
.end
.inline casx,3
casx [%o0],%o1,%o2
mov %o2,%o0
.end
.inline membar_flush,0
membar 0x32 /* cmask = MemIssue | Lookaside, mmask = StoreLoad */
.end
.inline membar_wait,0
membar 0x32 /* cmask = MemIssue | Lookaside, mmask = StoreLoad */
.end

View File

@ -1,38 +0,0 @@
/*
*
* The contents of this file are subject to the Initial
* Developer's Public License Version 1.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.ibphoenix.com/idpl.html.
*
* Software distributed under the License is distributed on
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The contents of this file or any work derived from this file
* may not be distributed under any other license whatsoever
* without the express prior written permission of the original
* author.
*
*
* The Original Code was created by James A. Starkey for IBPhoenix.
*
* Copyright (c) 2004 James A. Starkey
* All Rights Reserved.
*/
.inline cas,3
movl %esi, %eax
movl (%rdi),%r11d
lock; cmpxchgl %edx, (%rdi)
movl %r11d, %eax
.end
.inline casx,3
movq %rsi, %rax
movq (%rdi),%r11
lock; cmpxchgq %rdx, (%rdi)
movq %r11, %rax
.end