mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 20:43:02 +01:00
Cleanup - removed artifacts of c++03 atomics implementation
This commit is contained in:
parent
c03852efc9
commit
0616d8bcd2
@ -685,11 +685,6 @@ AC_ARG_WITH(system-boost,
|
|||||||
[SYSTEM_BOOST=Y])
|
[SYSTEM_BOOST=Y])
|
||||||
AC_SUBST(SYSTEM_BOOST)
|
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 Avoid dumb '-g -O2' autoconf's default
|
||||||
dnl Debugging information and optimization flags should be set in prefix.$platform file
|
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
|
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_SEARCH_LIBS(dlopen, dl)
|
||||||
AC_CHECK_LIB(m, main)
|
AC_CHECK_LIB(m, main)
|
||||||
AC_SEARCH_LIBS(inet_aton, resolv)
|
AC_SEARCH_LIBS(inet_aton, resolv)
|
||||||
AC_CHECK_LIB($ATOMICLIB, main)
|
|
||||||
|
|
||||||
dnl Check for libraries for static C++ runtime linking
|
dnl Check for libraries for static C++ runtime linking
|
||||||
AC_CHECK_LIB(supc++, main, XE_APPEND(-lsupc++, STATIC_CXXSUPPORT_LIB))
|
AC_CHECK_LIB(supc++, main, XE_APPEND(-lsupc++, STATIC_CXXSUPPORT_LIB))
|
||||||
|
@ -57,7 +57,6 @@ bool SyncObject::lock(Sync* sync, SyncType type, const char* from, int timeOut)
|
|||||||
const AtomicCounter::counter_type newState = oldState + 1;
|
const AtomicCounter::counter_type newState = oldState + 1;
|
||||||
if (lockState.compareExchange(oldState, newState))
|
if (lockState.compareExchange(oldState, newState))
|
||||||
{
|
{
|
||||||
WaitForFlushCache();
|
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
MutexLockGuard g(mutex, FB_FUNCTION);
|
MutexLockGuard g(mutex, FB_FUNCTION);
|
||||||
reason(from);
|
reason(from);
|
||||||
@ -113,7 +112,6 @@ bool SyncObject::lock(Sync* sync, SyncType type, const char* from, int timeOut)
|
|||||||
if (lockState.compareExchange(oldState, -1))
|
if (lockState.compareExchange(oldState, -1))
|
||||||
{
|
{
|
||||||
exclusiveThread = thread;
|
exclusiveThread = thread;
|
||||||
WaitForFlushCache();
|
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
MutexLockGuard g(mutex, FB_FUNCTION);
|
MutexLockGuard g(mutex, FB_FUNCTION);
|
||||||
#endif
|
#endif
|
||||||
@ -168,7 +166,6 @@ bool SyncObject::lockConditional(SyncType type, const char* from)
|
|||||||
const AtomicCounter::counter_type newState = oldState + 1;
|
const AtomicCounter::counter_type newState = oldState + 1;
|
||||||
if (lockState.compareExchange(oldState, newState))
|
if (lockState.compareExchange(oldState, newState))
|
||||||
{
|
{
|
||||||
WaitForFlushCache();
|
|
||||||
#ifdef DEV_BUILD
|
#ifdef DEV_BUILD
|
||||||
MutexLockGuard g(mutex, FB_FUNCTION);
|
MutexLockGuard g(mutex, FB_FUNCTION);
|
||||||
#endif
|
#endif
|
||||||
@ -197,7 +194,6 @@ bool SyncObject::lockConditional(SyncType type, const char* from)
|
|||||||
|
|
||||||
if (lockState.compareExchange(oldState, -1))
|
if (lockState.compareExchange(oldState, -1))
|
||||||
{
|
{
|
||||||
WaitForFlushCache();
|
|
||||||
exclusiveThread = thread;
|
exclusiveThread = thread;
|
||||||
reason(from);
|
reason(from);
|
||||||
return true;
|
return true;
|
||||||
@ -227,8 +223,6 @@ void SyncObject::unlock(Sync* /*sync*/, SyncType type)
|
|||||||
const AtomicCounter::counter_type oldState = lockState;
|
const AtomicCounter::counter_type oldState = lockState;
|
||||||
const AtomicCounter::counter_type newState = (type == SYNC_SHARED) ? oldState - 1 : 0;
|
const AtomicCounter::counter_type newState = (type == SYNC_SHARED) ? oldState - 1 : 0;
|
||||||
|
|
||||||
FlushCache();
|
|
||||||
|
|
||||||
if (lockState.compareExchange(oldState, newState))
|
if (lockState.compareExchange(oldState, newState))
|
||||||
{
|
{
|
||||||
if (newState == 0 && waiters)
|
if (newState == 0 && waiters)
|
||||||
@ -248,7 +242,6 @@ void SyncObject::downgrade(SyncType type)
|
|||||||
fb_assert(exclusiveThread == ThreadSync::findThread());
|
fb_assert(exclusiveThread == ThreadSync::findThread());
|
||||||
|
|
||||||
exclusiveThread = NULL;
|
exclusiveThread = NULL;
|
||||||
FlushCache();
|
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
@ -162,14 +162,6 @@ private:
|
|||||||
std::atomic<counter_type> counter;
|
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
|
} // namespace Firebird
|
||||||
|
|
||||||
#endif // CLASSES_FB_ATOMIC_H
|
#endif // CLASSES_FB_ATOMIC_H
|
||||||
|
@ -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
|
|
@ -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
|
|
||||||
|
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user