From 0616d8bcd274c35b786b536aa26c48442712cb2e Mon Sep 17 00:00:00 2001 From: AlexPeshkoff Date: Wed, 7 Aug 2024 13:23:58 +0300 Subject: [PATCH] Cleanup - removed artifacts of c++03 atomics implementation --- configure.ac | 6 ---- src/common/classes/SyncObject.cpp | 7 ---- src/common/classes/fb_atomic.h | 8 ----- src/common/classes/fb_atomic.il | 58 ------------------------------- src/common/classes/fb_cas.il | 43 ----------------------- src/common/classes/fb_cas_sax.il | 38 -------------------- 6 files changed, 160 deletions(-) delete mode 100644 src/common/classes/fb_atomic.il delete mode 100644 src/common/classes/fb_cas.il delete mode 100644 src/common/classes/fb_cas_sax.il diff --git a/configure.ac b/configure.ac index d936241282..ea24eb826a 100644 --- a/configure.ac +++ b/configure.ac @@ -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)) diff --git a/src/common/classes/SyncObject.cpp b/src/common/classes/SyncObject.cpp index 4e8214e596..09582652dc 100644 --- a/src/common/classes/SyncObject.cpp +++ b/src/common/classes/SyncObject.cpp @@ -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) { diff --git a/src/common/classes/fb_atomic.h b/src/common/classes/fb_atomic.h index 88c57845a5..451b36ddb8 100644 --- a/src/common/classes/fb_atomic.h +++ b/src/common/classes/fb_atomic.h @@ -162,14 +162,6 @@ private: std::atomic 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 diff --git a/src/common/classes/fb_atomic.il b/src/common/classes/fb_atomic.il deleted file mode 100644 index 2ed89e4688..0000000000 --- a/src/common/classes/fb_atomic.il +++ /dev/null @@ -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 - * 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 diff --git a/src/common/classes/fb_cas.il b/src/common/classes/fb_cas.il deleted file mode 100644 index 5003edf5a2..0000000000 --- a/src/common/classes/fb_cas.il +++ /dev/null @@ -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 - diff --git a/src/common/classes/fb_cas_sax.il b/src/common/classes/fb_cas_sax.il deleted file mode 100644 index 3277b22344..0000000000 --- a/src/common/classes/fb_cas_sax.il +++ /dev/null @@ -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