diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/arch/arch.pri | 8 | ||||
-rw-r--r-- | src/corelib/arch/qatomic_alpha.h | 527 | ||||
-rw-r--r-- | src/corelib/arch/qatomic_bfin.h | 350 | ||||
-rw-r--r-- | src/corelib/arch/qatomic_integrity.h | 295 | ||||
-rw-r--r-- | src/corelib/arch/qatomic_power.h | 521 | ||||
-rw-r--r-- | src/corelib/arch/qatomic_s390.h | 433 | ||||
-rw-r--r-- | src/corelib/arch/qatomic_sh4a.h | 540 | ||||
-rw-r--r-- | src/corelib/arch/qatomic_sparc.h | 532 | ||||
-rw-r--r-- | src/corelib/arch/qatomic_vxworks.h | 330 | ||||
-rw-r--r-- | src/corelib/thread/qatomic.cpp | 7 | ||||
-rw-r--r-- | src/corelib/thread/qbasicatomic.h | 21 | ||||
-rw-r--r-- | src/corelib/thread/qoldbasicatomic.h | 143 | ||||
-rw-r--r-- | src/corelib/thread/thread.pri | 3 |
13 files changed, 8 insertions, 3702 deletions
diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri index 51e67abfd4..5c3b0b78c2 100644 --- a/src/corelib/arch/arch.pri +++ b/src/corelib/arch/arch.pri @@ -1,20 +1,12 @@ win32|wince:HEADERS += arch/qatomic_msvc.h -vxworks:HEADERS += arch/qatomic_vxworks.h -integrity:HEADERS += arch/qatomic_integrity.h HEADERS += \ - arch/qatomic_alpha.h \ arch/qatomic_armv5.h \ arch/qatomic_armv6.h \ arch/qatomic_armv7.h \ - arch/qatomic_bfin.h \ arch/qatomic_bootstrap.h \ arch/qatomic_ia64.h \ arch/qatomic_mips.h \ - arch/qatomic_power.h \ - arch/qatomic_s390.h \ - arch/qatomic_sh4a.h \ - arch/qatomic_sparc.h \ arch/qatomic_x86.h \ arch/qatomic_gcc.h \ arch/qatomic_cxx11.h diff --git a/src/corelib/arch/qatomic_alpha.h b/src/corelib/arch/qatomic_alpha.h deleted file mode 100644 index 5008a1acda..0000000000 --- a/src/corelib/arch/qatomic_alpha.h +++ /dev/null @@ -1,527 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QATOMIC_ALPHA_H -#define QATOMIC_ALPHA_H - -#include <QtCore/qoldbasicatomic.h> - -QT_BEGIN_NAMESPACE - -#if 0 -// silence syncqt warnings -QT_END_NAMESPACE -QT_END_HEADER - -#pragma qt_sync_skip_header_check -#pragma qt_sync_stop_processing -#endif - -#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isReferenceCountingNative() -{ return true; } -inline bool QBasicAtomicInt::isReferenceCountingWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isTestAndSetNative() -{ return true; } -inline bool QBasicAtomicInt::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isFetchAndStoreNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isFetchAndAddNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndAddWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() -{ return false; } - -#if defined(Q_CC_GNU) - -inline bool QBasicAtomicInt::ref() -{ - int old, tmp; - asm volatile("1:\n" - "ldl_l %0,%2\n" /* old=*ptr; */ - "addl %0,1,%1\n" /* tmp=old+1; */ - "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp == 0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (old), "=&r" (tmp), "+m"(_q_value) - : - : "memory"); - return old != -1; -} - -inline bool QBasicAtomicInt::deref() -{ - int old, tmp; - asm volatile("1:\n" - "ldl_l %0,%2\n" /* old=*ptr; */ - "subl %0,1,%1\n" /* tmp=old-1; */ - "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (old), "=&r" (tmp), "+m"(_q_value) - : - : "memory"); - return old != 1; -} - -inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) -{ - int ret; - asm volatile("1:\n" - "ldl_l %0,%1\n" /* ret=*ptr; */ - "cmpeq %0,%2,%0\n"/* if (ret==expected) ret=0; else ret=1; */ - "beq %0,3f\n" /* if (ret==0) goto 3; */ - "mov %3,%0\n" /* ret=newval; */ - "stl_c %0,%1\n" /* if ((*ptr=ret)!=ret) ret=0; else ret=1; */ - "beq %0,2f\n" /* if (ret==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (ret), "+m" (_q_value) - : "r" (expectedValue), "r" (newValue) - : "memory"); - return ret != 0; -} - -inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) -{ - int ret; - asm volatile("1:\n" - "ldl_l %0,%1\n" /* ret=*ptr; */ - "cmpeq %0,%2,%0\n"/* if (ret==expected) ret=0; else ret=1; */ - "beq %0,3f\n" /* if (ret==0) goto 3; */ - "mov %3,%0\n" /* ret=newval; */ - "stl_c %0,%1\n" /* if ((*ptr=ret)!=ret) ret=0; else ret=1; */ - "beq %0,2f\n" /* if (ret==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - "mb\n" - : "=&r" (ret), "+m" (_q_value) - : "r" (expectedValue), "r" (newValue) - : "memory"); - return ret != 0; -} - -inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) -{ - int ret; - asm volatile("mb\n" - "1:\n" - "ldl_l %0,%1\n" /* ret=*ptr; */ - "cmpeq %0,%2,%0\n"/* if (ret==expected) ret=0; else ret=1; */ - "beq %0,3f\n" /* if (ret==0) goto 3; */ - "mov %3,%0\n" /* ret=newval; */ - "stl_c %0,%1\n" /* if ((*ptr=ret)!=ret) ret=0; else ret=1; */ - "beq %0,2f\n" /* if (ret==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (ret), "+m" (_q_value) - : "r" (expectedValue), "r" (newValue) - : "memory"); - return ret != 0; -} - -inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) -{ - int old, tmp; - asm volatile("1:\n" - "ldl_l %0,%2\n" /* old=*ptr; */ - "mov %3,%1\n" /* tmp=newval; */ - "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (old), "=&r" (tmp), "+m" (_q_value) - : "r" (newValue) - : "memory"); - return old; -} - -inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) -{ - int old, tmp; - asm volatile("1:\n" - "ldl_l %0,%2\n" /* old=*ptr; */ - "mov %3,%1\n" /* tmp=newval; */ - "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - "mb\n" - : "=&r" (old), "=&r" (tmp), "+m" (_q_value) - : "r" (newValue) - : "memory"); - return old; -} - -inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) -{ - int old, tmp; - asm volatile("mb\n" - "1:\n" - "ldl_l %0,%2\n" /* old=*ptr; */ - "mov %3,%1\n" /* tmp=newval; */ - "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (old), "=&r" (tmp), "+m" (_q_value) - : "r" (newValue) - : "memory"); - return old; -} - -inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) -{ - int old, tmp; - asm volatile("1:\n" - "ldl_l %0,%2\n" /* old=*ptr; */ - "addl %0,%3,%1\n"/* tmp=old+value; */ - "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp == 0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (old), "=&r" (tmp), "+m"(_q_value) - : "r" (valueToAdd) - : "memory"); - return old; -} - -inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) -{ - int old, tmp; - asm volatile("1:\n" - "ldl_l %0,%2\n" /* old=*ptr; */ - "addl %0,%3,%1\n"/* tmp=old+value; */ - "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp == 0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - "mb\n" - : "=&r" (old), "=&r" (tmp), "+m"(_q_value) - : "r" (valueToAdd) - : "memory"); - return old; -} - -inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) -{ - int old, tmp; - asm volatile("mb\n" - "1:\n" - "ldl_l %0,%2\n" /* old=*ptr; */ - "addl %0,%3,%1\n"/* tmp=old+value; */ - "stl_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp == 0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (old), "=&r" (tmp), "+m"(_q_value) - : "r" (valueToAdd) - : "memory"); - return old; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) -{ - void *ret; - asm volatile("1:\n" - "ldq_l %0,%1\n" /* ret=*ptr; */ - "cmpeq %0,%2,%0\n"/* if (ret==expected) tmp=0; else tmp=1; */ - "beq %0,3f\n" /* if (tmp==0) goto 3; */ - "mov %3,%0\n" /* tmp=newval; */ - "stq_c %0,%1\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %0,2f\n" /* if (ret==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (ret), "+m" (_q_value) - : "r" (expectedValue), "r" (newValue) - : "memory"); - return ret != 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) -{ - void *ret; - asm volatile("1:\n" - "ldq_l %0,%1\n" /* ret=*ptr; */ - "cmpeq %0,%2,%0\n"/* if (ret==expected) tmp=0; else tmp=1; */ - "beq %0,3f\n" /* if (tmp==0) goto 3; */ - "mov %3,%0\n" /* tmp=newval; */ - "stq_c %0,%1\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %0,2f\n" /* if (ret==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - "mb\n" - : "=&r" (ret), "+m" (_q_value) - : "r" (expectedValue), "r" (newValue) - : "memory"); - return ret != 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) -{ - void *ret; - asm volatile("mb\n" - "1:\n" - "ldq_l %0,%1\n" /* ret=*ptr; */ - "cmpeq %0,%2,%0\n"/* if (ret==expected) tmp=0; else tmp=1; */ - "beq %0,3f\n" /* if (tmp==0) goto 3; */ - "mov %3,%0\n" /* tmp=newval; */ - "stq_c %0,%1\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %0,2f\n" /* if (ret==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (ret), "+m" (_q_value) - : "r" (expectedValue), "r" (newValue) - : "memory"); - return ret != 0; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) -{ - T *old, *tmp; - asm volatile("1:\n" - "ldq_l %0,%2\n" /* old=*ptr; */ - "mov %3,%1\n" /* tmp=newval; */ - "stq_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (old), "=&r" (tmp), "+m" (_q_value) - : "r" (newValue) - : "memory"); - return old; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) -{ - T *old, *tmp; - asm volatile("1:\n" - "ldq_l %0,%2\n" /* old=*ptr; */ - "mov %3,%1\n" /* tmp=newval; */ - "stq_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - "mb\n" - : "=&r" (old), "=&r" (tmp), "+m" (_q_value) - : "r" (newValue) - : "memory"); - return old; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) -{ - T *old, *tmp; - asm volatile("mb\n" - "1:\n" - "ldq_l %0,%2\n" /* old=*ptr; */ - "mov %3,%1\n" /* tmp=newval; */ - "stq_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp==0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (old), "=&r" (tmp), "+m" (_q_value) - : "r" (newValue) - : "memory"); - return old; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) -{ - T *old, *tmp; - asm volatile("1:\n" - "ldq_l %0,%2\n" /* old=*ptr; */ - "addq %0,%3,%1\n"/* tmp=old+value; */ - "stq_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp == 0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (old), "=&r" (tmp), "+m"(_q_value) - : "r" (valueToAdd) - : "memory"); - return reinterpret_cast<T *>(old); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) -{ - T *old, *tmp; - asm volatile("1:\n" - "ldq_l %0,%2\n" /* old=*ptr; */ - "addq %0,%3,%1\n"/* tmp=old+value; */ - "stq_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp == 0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - "mb\n" - : "=&r" (old), "=&r" (tmp), "+m"(_q_value) - : "r" (valueToAdd) - : "memory"); - return reinterpret_cast<T *>(old); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) -{ - T *old, *tmp; - asm volatile("mb\n" - "1:\n" - "ldq_l %0,%2\n" /* old=*ptr; */ - "addq %0,%3,%1\n"/* tmp=old+value; */ - "stq_c %1,%2\n" /* if ((*ptr=tmp)!=tmp) tmp=0; else tmp=1; */ - "beq %1,2f\n" /* if (tmp == 0) goto 2; */ - "br 3f\n" /* goto 3; */ - "2: br 1b\n" /* goto 1; */ - "3:\n" - : "=&r" (old), "=&r" (tmp), "+m"(_q_value) - : "r" (valueToAdd) - : "memory"); - return reinterpret_cast<T *>(old); -} - -#else -# error "This compiler for Alpha is not supported" -#endif // Q_CC_GNU - -inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) -{ - return testAndSetAcquire(expectedValue, newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) -{ - return fetchAndStoreAcquire(newValue); -} - -inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) -{ - return fetchAndAddAcquire(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) -{ - return testAndSetAcquire(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) -{ - return fetchAndStoreAcquire(newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) -{ - return fetchAndAddAcquire(valueToAdd); -} - -QT_END_NAMESPACE - -#endif // QATOMIC_ALPHA_H diff --git a/src/corelib/arch/qatomic_bfin.h b/src/corelib/arch/qatomic_bfin.h deleted file mode 100644 index 79519308a4..0000000000 --- a/src/corelib/arch/qatomic_bfin.h +++ /dev/null @@ -1,350 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QATOMIC_BFIN_H -#define QATOMIC_BFIN_H - -#include <QtCore/qoldbasicatomic.h> - -QT_BEGIN_NAMESPACE - -#if 0 -// silence syncqt warnings -QT_END_NAMESPACE -QT_END_HEADER - -#pragma qt_sync_skip_header_check -#pragma qt_sync_stop_processing -#endif - -#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isReferenceCountingNative() -{ return false; } -inline bool QBasicAtomicInt::isReferenceCountingWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isTestAndSetNative() -{ return false; } -inline bool QBasicAtomicInt::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isFetchAndStoreNative() -{ return false; } -inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isFetchAndAddNative() -{ return false; } -inline bool QBasicAtomicInt::isFetchAndAddWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() -{ return false; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() -{ return false; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() -{ return false; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() -{ return false; } - -#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) - -QT_BEGIN_INCLUDE_NAMESPACE -#include <asm/fixed_code.h> -QT_END_INCLUDE_NAMESPACE - -inline bool QBasicAtomicInt::ref() -{ - int ret; - asm volatile("R0 = 1;\n\t" - "P0 = %3;\n\t" - "CALL (%2);\n\t" - "%0 = R0;" - : "=da" (ret), "=m" (_q_value) - : "a" (ATOMIC_ADD32), "da" (&_q_value), "m" (_q_value) - : "R0", "R1", "P0", "RETS", "memory"); - return ret != 0; -} - -inline bool QBasicAtomicInt::deref() -{ - int ret; - asm volatile("R0 = 1;\n\t" - "P0 = %3;\n\t" - "CALL (%2);\n\t" - "%0 = R0;" - : "=da" (ret), "=m" (_q_value) - : "a" (ATOMIC_SUB32), "da" (&_q_value), "m" (_q_value) - : "R0", "R1", "P0", "RETS", "memory"); - return ret != 0; -} - -inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) -{ - long int readval; - asm volatile ("P0 = %2;\n\t" - "R1 = %3;\n\t" - "R2 = %4;\n\t" - "CALL (%5);\n\t" - "%0 = R0;\n\t" - : "=da" (readval), "=m" (_q_value) - : "da" (&_q_value), - "da" (expectedValue), - "da" (newValue), - "a" (ATOMIC_CAS32), - "m" (_q_value) - : "P0", "R0", "R1", "R2", "RETS", "memory", "cc"); - return readval == expectedValue; -} - -inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) -{ - asm volatile("R1 = %2;\n\t" - "P0 = %4;\n\t" - "CALL (%3);\n\t" - "%0 = R0;" - : "=da" (newValue), "=m" (_q_value) - : "da" (newValue), "a" (ATOMIC_XCHG32), "da" (&_q_value), "m" (_q_value) - : "R0", "R1", "P0", "RETS", "memory"); - return newValue; -} - -inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) -{ - int ret; - asm volatile("R0 = %[val];\n\t" - "P0 = %[qvalp];\n\t" - "CALL (%[addr]);\n\t" - "%[ret] = R1;" - : [ret] "=da" (ret), "=m" (_q_value) - : [addr] "a" (ATOMIC_ADD32), [qvalp] "da" (&_q_value), "m" (_q_value), [val] "da" (valueToAdd) - : "R0", "R1", "P0", "RETS", "memory"); - return ret; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) -{ - T *readval; - asm volatile ("P0 = %2;\n\t" - "R1 = %3;\n\t" - "R2 = %4;\n\t" - "CALL (%5);\n\t" - "%0 = R0;\n\t" - : "=da" (readval), "=m" (_q_value) - : "da" (&_q_value), - "da" (expectedValue), - "da" (newValue), - "a" (ATOMIC_CAS32), - "m" (_q_value) - : "P0", "R0", "R1", "R2", "RETS", "memory", "cc"); - return readval == expectedValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) -{ - asm volatile("R1 = %2;\n\t" - "P0 = %4;\n\t" - "CALL (%3);\n\t" - "%0 = R0;" - : "=da" (newValue), "=m" (_q_value) - : "da" (newValue), "a" (ATOMIC_XCHG32), "da" (&_q_value), "m" (_q_value) - : "R0", "R1", "P0", "RETS", "memory"); - return newValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) -{ - T* ret; - asm volatile("R0 = %[val];\n\t" - "P0 = %[qvalp];\n\t" - "CALL (%[addr]);\n\t" - "%[ret] = R1;" - : [ret] "=da" (ret), "=m" (_q_value) - : [addr] "a" (ATOMIC_ADD32), [qvalp] "da" (&_q_value), "m" (_q_value), [val] "da" (valueToAdd * sizeof(T)) - : "R0", "R1", "P0", "RETS", "memory"); - return ret; -} - - -#endif // Q_OS_LINUX && Q_CC_GNU - -// Test and set for integers - -inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -// Fetch and store for integers - -inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -// Fetch and add for integers - -inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -// Test and set for pointers - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -// Fetch and store for pointers - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -// Fetch and add for pointers - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -QT_END_NAMESPACE - -#endif // QATOMIC_BFIN_H diff --git a/src/corelib/arch/qatomic_integrity.h b/src/corelib/arch/qatomic_integrity.h deleted file mode 100644 index f8cfc8ce5b..0000000000 --- a/src/corelib/arch/qatomic_integrity.h +++ /dev/null @@ -1,295 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QATOMIC_INTEGRITY_H -#define QATOMIC_INTEGRITY_H - -#include <QtCore/qoldbasicatomic.h> -#include <INTEGRITY.h> - -QT_BEGIN_NAMESPACE - -#if 0 -// silence syncqt warnings -QT_END_NAMESPACE -QT_END_HEADER - -#pragma qt_sync_skip_header_check -#pragma qt_sync_stop_processing -#endif - -#define qt_i2addr(a) reinterpret_cast<Address *>(const_cast<int *>(a)) -#define qt_p2addr(a) reinterpret_cast<Address *>(const_cast<void *>(a)) -#define qt_addr(a) reinterpret_cast<Address>(a) - - -#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isReferenceCountingNative() -{ return false; } -inline bool QBasicAtomicInt::isReferenceCountingWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isTestAndSetNative() -{ return true; } -inline bool QBasicAtomicInt::isTestAndSetWaitFree() -{ return true; } - -#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isFetchAndStoreNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() -{ return true; } - -#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isFetchAndAddNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndAddWaitFree() -{ return true; } - -#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() -{ return true; } - -#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() -{ return true; } - -#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() -{ return true; } - -// Reference counting - -inline bool QBasicAtomicInt::ref() -{ - int oldval; - AtomicModify(qt_i2addr(&_q_value), qt_i2addr(&oldval), 0, 1); - return _q_value != -1; -} - -inline bool QBasicAtomicInt::deref() -{ - int oldval; - AtomicModify(qt_i2addr(&_q_value), qt_i2addr(&oldval), 0, -1U); - return _q_value != 0; -} - -// Test and set for integers - -inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) -{ - return TestAndSet(qt_i2addr(&_q_value), expectedValue, newValue) == Success; -} - -inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -// Fetch and store for integers - -inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) -{ - int old_val; - do { - old_val = _q_value; - } while (TestAndSet(qt_i2addr(&_q_value), old_val, newValue) != Success); - return old_val; -} - -inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -// Fetch and add for integers - -inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) -{ - int old_val; - do { - old_val = _q_value; - } while (TestAndSet(qt_i2addr(&_q_value), old_val, old_val + valueToAdd) != Success); - return old_val; -} - -inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -// Test and set for pointers - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) -{ - return TestAndSet((Address*)&_q_value, qt_addr(expectedValue), qt_addr(newValue)) == Success; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -// Fetch and store for pointers - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) -{ - Address old_val; - do { - old_val = *reinterpret_cast<Address *>(const_cast<T *>(newValue)); - } while (TestAndSet(reinterpret_cast<Address *>(const_cast<T **>(&_q_value)), old_val, qt_addr(newValue)) != Success); - return reinterpret_cast<T *>(old_val); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -// Fetch and add for pointers - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) -{ - AtomicModify(qt_p2addr(&_q_value), qt_addr(_q_value), qt_addr(_q_value) + valueToAdd * sizeof(T)); - return _q_value; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -QT_END_NAMESPACE - -#endif // QATOMIC_INTEGRITY_H - diff --git a/src/corelib/arch/qatomic_power.h b/src/corelib/arch/qatomic_power.h deleted file mode 100644 index 3ddd303795..0000000000 --- a/src/corelib/arch/qatomic_power.h +++ /dev/null @@ -1,521 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QATOMIC_POWER_H -#define QATOMIC_POWER_H - -#include <QtCore/qoldbasicatomic.h> - -QT_BEGIN_NAMESPACE - -#if 0 -// silence syncqt warnings -QT_END_NAMESPACE -QT_END_HEADER - -#pragma qt_sync_skip_header_check -#pragma qt_sync_stop_processing -#endif - -#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isReferenceCountingNative() -{ return true; } -inline bool QBasicAtomicInt::isReferenceCountingWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isTestAndSetNative() -{ return true; } -inline bool QBasicAtomicInt::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isFetchAndStoreNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isFetchAndAddNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndAddWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() -{ return false; } - -#if defined(Q_CC_GNU) - -#ifdef Q_PROCESSOR_POWER_32 -# define _Q_VALUE "0, %[_q_value]" -# define _Q_VALUE_MEMORY_OPERAND "+m" (_q_value) -# define _Q_VALUE_REGISTER_OPERAND [_q_value] "r" (&_q_value), -#else // Q_PROCESSOR_POWER_64 -# define _Q_VALUE "%y[_q_value]" -# define _Q_VALUE_MEMORY_OPERAND [_q_value] "+Z" (_q_value) -# define _Q_VALUE_REGISTER_OPERAND -#endif - -inline bool QBasicAtomicInt::ref() -{ - int originalValue; - int newValue; - asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" - "addi %[newValue], %[originalValue], %[one]\n" - "stwcx. %[newValue]," _Q_VALUE "\n" - "bne- $-12\n" - : [originalValue] "=&b" (originalValue), - [newValue] "=&r" (newValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [one] "i" (1) - : "cc", "memory"); - return newValue != 0; -} - -inline bool QBasicAtomicInt::deref() -{ - int originalValue; - int newValue; - asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" - "addi %[newValue], %[originalValue], %[minusOne]\n" - "stwcx. %[newValue]," _Q_VALUE "\n" - "bne- $-12\n" - : [originalValue] "=&b" (originalValue), - [newValue] "=&r" (newValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [minusOne] "i" (-1) - : "cc", "memory"); - return newValue != 0; -} - -inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) -{ - int result; - asm volatile("lwarx %[result]," _Q_VALUE "\n" - "xor. %[result], %[result], %[expectedValue]\n" - "bne $+12\n" - "stwcx. %[newValue]," _Q_VALUE "\n" - "bne- $-16\n" - : [result] "=&r" (result), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [expectedValue] "r" (expectedValue), - [newValue] "r" (newValue) - : "cc", "memory"); - return result == 0; -} - -inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) -{ - int result; - asm volatile("lwarx %[result]," _Q_VALUE "\n" - "xor. %[result], %[result], %[expectedValue]\n" - "bne $+16\n" - "stwcx. %[newValue]," _Q_VALUE "\n" - "bne- $-16\n" - "isync\n" - : [result] "=&r" (result), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [expectedValue] "r" (expectedValue), - [newValue] "r" (newValue) - : "cc", "memory"); - return result == 0; -} - -inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) -{ - int result; - asm volatile("eieio\n" - "lwarx %[result]," _Q_VALUE "\n" - "xor. %[result], %[result], %[expectedValue]\n" - "bne $+12\n" - "stwcx. %[newValue]," _Q_VALUE "\n" - "bne- $-16\n" - : [result] "=&r" (result), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [expectedValue] "r" (expectedValue), - [newValue] "r" (newValue) - : "cc", "memory"); - return result == 0; -} - -inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) -{ - int originalValue; - asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" - "stwcx. %[newValue]," _Q_VALUE "\n" - "bne- $-8\n" - : [originalValue] "=&r" (originalValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [newValue] "r" (newValue) - : "cc", "memory"); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) -{ - int originalValue; - asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" - "stwcx. %[newValue]," _Q_VALUE "\n" - "bne- $-8\n" - "isync\n" - : [originalValue] "=&r" (originalValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [newValue] "r" (newValue) - : "cc", "memory"); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) -{ - int originalValue; - asm volatile("eieio\n" - "lwarx %[originalValue]," _Q_VALUE "\n" - "stwcx. %[newValue]," _Q_VALUE "\n" - "bne- $-8\n" - : [originalValue] "=&r" (originalValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [newValue] "r" (newValue) - : "cc", "memory"); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) -{ - int originalValue; - int newValue; - asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" - "add %[newValue], %[originalValue], %[valueToAdd]\n" - "stwcx. %[newValue]," _Q_VALUE "\n" - "bne- $-12\n" - : [originalValue] "=&r" (originalValue), - [newValue] "=&r" (newValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [valueToAdd] "r" (valueToAdd) - : "cc", "memory"); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) -{ - int originalValue; - int newValue; - asm volatile("lwarx %[originalValue]," _Q_VALUE "\n" - "add %[newValue], %[originalValue], %[valueToAdd]\n" - "stwcx. %[newValue]," _Q_VALUE "\n" - "bne- $-12\n" - "isync\n" - : [originalValue] "=&r" (originalValue), - [newValue] "=&r" (newValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [valueToAdd] "r" (valueToAdd) - : "cc", "memory"); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) -{ - int originalValue; - int newValue; - asm volatile("eieio\n" - "lwarx %[originalValue]," _Q_VALUE "\n" - "add %[newValue], %[originalValue], %[valueToAdd]\n" - "stwcx. %[newValue]," _Q_VALUE "\n" - "bne- $-12\n" - : [originalValue] "=&r" (originalValue), - [newValue] "=&r" (newValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [valueToAdd] "r" (valueToAdd) - : "cc", "memory"); - return originalValue; -} - -#ifdef Q_PROCESSOR_POWER_64 -# define LPARX "ldarx" -# define STPCX "stdcx." -#else -# define LPARX "lwarx" -# define STPCX "stwcx." -#endif - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) -{ - void *result; - asm volatile(LPARX" %[result]," _Q_VALUE "\n" - "xor. %[result], %[result], %[expectedValue]\n" - "bne $+12\n" - STPCX" %[newValue]," _Q_VALUE "\n" - "bne- $-16\n" - : [result] "=&r" (result), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [expectedValue] "r" (expectedValue), - [newValue] "r" (newValue) - : "cc", "memory"); - return result == 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) -{ - void *result; - asm volatile(LPARX" %[result]," _Q_VALUE "\n" - "xor. %[result], %[result], %[expectedValue]\n" - "bne $+16\n" - STPCX" %[newValue]," _Q_VALUE "\n" - "bne- $-16\n" - "isync\n" - : [result] "=&r" (result), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [expectedValue] "r" (expectedValue), - [newValue] "r" (newValue) - : "cc", "memory"); - return result == 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) -{ - void *result; - asm volatile("eieio\n" - LPARX" %[result]," _Q_VALUE "\n" - "xor. %[result], %[result], %[expectedValue]\n" - "bne $+12\n" - STPCX" %[newValue]," _Q_VALUE "\n" - "bne- $-16\n" - : [result] "=&r" (result), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [expectedValue] "r" (expectedValue), - [newValue] "r" (newValue) - : "cc", "memory"); - return result == 0; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) -{ - T *originalValue; - asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" - STPCX" %[newValue]," _Q_VALUE "\n" - "bne- $-8\n" - : [originalValue] "=&r" (originalValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [newValue] "r" (newValue) - : "cc", "memory"); - return originalValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) -{ - T *originalValue; - asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" - STPCX" %[newValue]," _Q_VALUE "\n" - "bne- $-8\n" - "isync\n" - : [originalValue] "=&r" (originalValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [newValue] "r" (newValue) - : "cc", "memory"); - return originalValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) -{ - T *originalValue; - asm volatile("eieio\n" - LPARX" %[originalValue]," _Q_VALUE "\n" - STPCX" %[newValue]," _Q_VALUE "\n" - "bne- $-8\n" - : [originalValue] "=&r" (originalValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [newValue] "r" (newValue) - : "cc", "memory"); - return originalValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) -{ - T *originalValue; - T *newValue; - asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" - "add %[newValue], %[originalValue], %[valueToAdd]\n" - STPCX" %[newValue]," _Q_VALUE "\n" - "bne- $-12\n" - : [originalValue] "=&r" (originalValue), - [newValue] "=&r" (newValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [valueToAdd] "r" (valueToAdd * sizeof(T)) - : "cc", "memory"); - return originalValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) -{ - T *originalValue; - T *newValue; - asm volatile(LPARX" %[originalValue]," _Q_VALUE "\n" - "add %[newValue], %[originalValue], %[valueToAdd]\n" - STPCX" %[newValue]," _Q_VALUE "\n" - "bne- $-12\n" - "isync\n" - : [originalValue] "=&r" (originalValue), - [newValue] "=&r" (newValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [valueToAdd] "r" (valueToAdd * sizeof(T)) - : "cc", "memory"); - return originalValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) -{ - T *originalValue; - T *newValue; - asm volatile("eieio\n" - LPARX" %[originalValue]," _Q_VALUE "\n" - "add %[newValue], %[originalValue], %[valueToAdd]\n" - STPCX" %[newValue]," _Q_VALUE "\n" - "bne- $-12\n" - : [originalValue] "=&r" (originalValue), - [newValue] "=&r" (newValue), - _Q_VALUE_MEMORY_OPERAND - : _Q_VALUE_REGISTER_OPERAND - [valueToAdd] "r" (valueToAdd * sizeof(T)) - : "cc", "memory"); - return originalValue; -} - -#undef LPARX -#undef STPCX -#undef _Q_VALUE -#undef _Q_VALUE_MEMORY_OPERAND -#undef _Q_VALUE_REGISTER_OPERAND - -#else -# error "This compiler for Power/PowerPC is not supported" -#endif - -inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) -{ - return testAndSetAcquire(expectedValue, newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) -{ - return fetchAndStoreAcquire(newValue); -} - -inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) -{ - return fetchAndAddAcquire(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) -{ - return testAndSetAcquire(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) -{ - return fetchAndStoreAcquire(newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) -{ - return fetchAndAddAcquire(valueToAdd); -} - -QT_END_NAMESPACE - -#endif // QATOMIC_POWER_H diff --git a/src/corelib/arch/qatomic_s390.h b/src/corelib/arch/qatomic_s390.h deleted file mode 100644 index 0469f44e5f..0000000000 --- a/src/corelib/arch/qatomic_s390.h +++ /dev/null @@ -1,433 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QATOMIC_S390_H -#define QATOMIC_S390_H - -#include <QtCore/qoldbasicatomic.h> - -QT_BEGIN_NAMESPACE - -#if 0 -// silence syncqt warnings -QT_END_NAMESPACE -QT_END_HEADER - -#pragma qt_sync_skip_header_check -#pragma qt_sync_stop_processing -#endif - -#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isReferenceCountingNative() -{ return true; } -inline bool QBasicAtomicInt::isReferenceCountingWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isTestAndSetNative() -{ return true; } -inline bool QBasicAtomicInt::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isFetchAndStoreNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isFetchAndAddNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndAddWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() -{ return false; } - -#ifdef __GNUC__ -#define __GNU_EXTENSION __extension__ -#else -#define __GNU_EXTENSION -#endif - -#define __CS_LOOP(ptr, op_val, op_string, pre, post) __GNU_EXTENSION ({ \ - volatile int old_val, new_val; \ - __asm__ __volatile__(pre \ - " l %0,0(%3)\n" \ - "0: lr %1,%0\n" \ - op_string " %1,%4\n" \ - " cs %0,%1,0(%3)\n" \ - " jl 0b\n" \ - post \ - : "=&d" (old_val), "=&d" (new_val), \ - "=m" (*ptr) \ - : "a" (ptr), "d" (op_val), \ - "m" (*ptr) \ - : "cc", "memory" ); \ - new_val; \ -}) - -#define __CS_OLD_LOOP(ptr, op_val, op_string, pre, post ) __GNU_EXTENSION ({ \ - volatile int old_val, new_val; \ - __asm__ __volatile__(pre \ - " l %0,0(%3)\n" \ - "0: lr %1,%0\n" \ - op_string " %1,%4\n" \ - " cs %0,%1,0(%3)\n" \ - " jl 0b\n" \ - post \ - : "=&d" (old_val), "=&d" (new_val), \ - "=m" (*ptr) \ - : "a" (ptr), "d" (op_val), \ - "m" (*ptr) \ - : "cc", "memory" ); \ - old_val; \ -}) - -#ifdef __s390x__ -#define __CSG_OLD_LOOP(ptr, op_val, op_string, pre, post) __GNU_EXTENSION ({ \ - long old_val, new_val; \ - __asm__ __volatile__(pre \ - " lg %0,0(%3)\n" \ - "0: lgr %1,%0\n" \ - op_string " %1,%4\n" \ - " csg %0,%1,0(%3)\n" \ - " jl 0b\n" \ - post \ - : "=&d" (old_val), "=&d" (new_val), \ - "=m" (*ptr) \ - : "a" (ptr), "d" (op_val), \ - "m" (*ptr) \ - : "cc", "memory" ); \ - old_val; \ -}) -#endif - -inline bool QBasicAtomicInt::ref() -{ - return __CS_LOOP(&_q_value, 1, "ar", "", "") != 0; -} - -inline bool QBasicAtomicInt::deref() -{ - return __CS_LOOP(&_q_value, 1, "sr", "", "") != 0; -} - -inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) -{ - int retval; - __asm__ __volatile__( - " lr %0,%3\n" - " cs %0,%4,0(%2)\n" - " ipm %0\n" - " srl %0,28\n" - "0:" - : "=&d" (retval), "=m" (_q_value) - : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), - "m" (_q_value) : "cc", "memory" ); - return retval == 0; -} - -inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) -{ - int retval; - __asm__ __volatile__( - " lr %0,%3\n" - " cs %0,%4,0(%2)\n" - " ipm %0\n" - " srl %0,28\n" - "0:\n" - " bcr 15,0\n" - : "=&d" (retval), "=m" (_q_value) - : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), - "m" (_q_value) : "cc", "memory" ); - return retval == 0; -} - -inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) -{ - int retval; - __asm__ __volatile__( - " bcr 15,0\n" - " lr %0,%3\n" - " cs %0,%4,0(%2)\n" - " ipm %0\n" - " srl %0,28\n" - "0:" - : "=&d" (retval), "=m" (_q_value) - : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), - "m" (_q_value) : "cc", "memory" ); - return retval == 0; -} - -inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) -{ - return testAndSetAcquire(expectedValue, newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) -{ - return __CS_OLD_LOOP(&_q_value, newValue, "lr", "", ""); -} - -inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) -{ - return __CS_OLD_LOOP(&_q_value, newValue, "lr", "", "bcr 15,0\n"); -} - -inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) -{ - return __CS_OLD_LOOP(&_q_value, newValue, "lr", "bcr 15,0\n", ""); -} - -inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) -{ - return fetchAndStoreAcquire(newValue); -} - -inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) -{ - return __CS_OLD_LOOP(&_q_value, valueToAdd, "ar", "", "bcr 15,0\n"); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) -{ - int retval; - -#ifndef __s390x__ - __asm__ __volatile__( - " lr %0,%3\n" - " cs %0,%4,0(%2)\n" - " ipm %0\n" - " srl %0,28\n" - "0:" - : "=&d" (retval), "=m" (_q_value) - : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), - "m" (_q_value) : "cc", "memory" ); -#else - __asm__ __volatile__( - " lgr %0,%3\n" - " csg %0,%4,0(%2)\n" - " ipm %0\n" - " srl %0,28\n" - "0:" - : "=&d" (retval), "=m" (_q_value) - : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), - "m" (_q_value) : "cc", "memory" ); -#endif - - return retval == 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) -{ - int retval; - -#ifndef __s390x__ - __asm__ __volatile__( - " lr %0,%3\n" - " cs %0,%4,0(%2)\n" - " ipm %0\n" - " srl %0,28\n" - "0:\n" - " bcr 15,0\n" - : "=&d" (retval), "=m" (_q_value) - : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), - "m" (_q_value) : "cc", "memory" ); -#else - __asm__ __volatile__( - " lgr %0,%3\n" - " csg %0,%4,0(%2)\n" - " ipm %0\n" - " srl %0,28\n" - "0:\n" - " bcr 15,0\n" - : "=&d" (retval), "=m" (_q_value) - : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), - "m" (_q_value) : "cc", "memory" ); -#endif - - return retval == 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) -{ - int retval; - -#ifndef __s390x__ - __asm__ __volatile__( - " bcr 15,0\n" - " lr %0,%3\n" - " cs %0,%4,0(%2)\n" - " ipm %0\n" - " srl %0,28\n" - "0:" - : "=&d" (retval), "=m" (_q_value) - : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), - "m" (_q_value) : "cc", "memory" ); -#else - __asm__ __volatile__( - " bcr 15,0\n" - " lgr %0,%3\n" - " csg %0,%4,0(%2)\n" - " ipm %0\n" - " srl %0,28\n" - "0:" - : "=&d" (retval), "=m" (_q_value) - : "a" (&_q_value), "d" (expectedValue) , "d" (newValue), - "m" (_q_value) : "cc", "memory" ); -#endif - - return retval == 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) -{ - return testAndSetAcquire(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) -{ -#ifndef __s390x__ - return (T*)__CS_OLD_LOOP(&_q_value, (int)newValue, "lr", "", ""); -#else - return (T*)__CSG_OLD_LOOP(&_q_value, (long)newValue, "lgr", "", ""); -#endif -} - -template <typename T> -Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) -{ -#ifndef __s390x__ - return (T*)__CS_OLD_LOOP(&_q_value, (int)newValue, "lr", "", "bcr 15,0 \n"); -#else - return (T*)__CSG_OLD_LOOP(&_q_value, (long)newValue, "lgr", "", "bcr 15,0 \n"); -#endif -} - -template <typename T> -Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) -{ -#ifndef __s390x__ - return (T*)__CS_OLD_LOOP(&_q_value, (int)newValue, "lr", "bcr 15,0 \n", ""); -#else - return (T*)__CSG_OLD_LOOP(&_q_value, (long)newValue, "lgr", "bcr 15,0\n", ""); -#endif -} - -template <typename T> -Q_INLINE_TEMPLATE T* QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) -{ - return fetchAndStoreAcquire(newValue); -} - - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -#undef __GNU_EXTENSION - -QT_END_NAMESPACE - -#endif // QATOMIC_S390_H diff --git a/src/corelib/arch/qatomic_sh4a.h b/src/corelib/arch/qatomic_sh4a.h deleted file mode 100644 index 6e59279f3e..0000000000 --- a/src/corelib/arch/qatomic_sh4a.h +++ /dev/null @@ -1,540 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QATOMIC_SH4A_H -#define QATOMIC_SH4A_H - -#include <QtCore/qoldbasicatomic.h> - -QT_BEGIN_NAMESPACE - - -QT_END_NAMESPACE - -#if 0 -#pragma qt_sync_skip_header_check -#pragma qt_sync_stop_processing -#endif - -#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isReferenceCountingNative() -{ return true; } -inline bool QBasicAtomicInt::isReferenceCountingWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isTestAndSetNative() -{ return true; } -inline bool QBasicAtomicInt::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isFetchAndStoreNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isFetchAndAddNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndAddWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() -{ return false; } - -QT_BEGIN_NAMESPACE - -#if !defined(Q_CC_GNU) -# error "SH-4A support has not been added for this compiler" -#else - -inline bool QBasicAtomicInt::ref() -{ - register int newValue asm("r0"); - asm volatile("0:\n" - "movli.l @%[_q_value], %[newValue]\n" - "add #1,%[newValue]\n" - "movco.l %[newValue], @%[_q_value]\n" - "bf 0b\n" - : [newValue] "=&r" (newValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value) - : "cc", "memory"); - return newValue != 0; -} - -inline bool QBasicAtomicInt::deref() -{ - register int newValue asm("r0"); - asm volatile("0:\n" - "movli.l @%[_q_value], %[newValue]\n" - "add #-1,%[newValue]\n" - "movco.l %[newValue], @%[_q_value]\n" - "bf 0b\n" - : [newValue] "=&r" (newValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value) - : "cc", "memory"); - return newValue != 0; -} - -inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) -{ - int result; - asm volatile("0:\n" - "movli.l @%[_q_value], r0\n" - "xor %[expectedValue], r0\n" - "cmp/eq #0, r0\n" - "bf/s 0f\n" - "mov r0, %[result]\n" - "mov %[newValue], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - "0:\n" - : [result] "=&r" (result), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [expectedValue] "r" (expectedValue), - [newValue] "r" (newValue) - : "r0", "cc", "memory"); - return result == 0; -} - -inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) -{ - int result; - asm volatile("0:\n" - "movli.l @%[_q_value], r0\n" - "xor %[expectedValue], r0\n" - "cmp/eq #0, r0\n" - "bf/s 0f\n" - "mov r0, %[result]\n" - "mov %[newValue], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - "synco\n" - "0:\n" - : [result] "=&r" (result), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [expectedValue] "r" (expectedValue), - [newValue] "r" (newValue) - : "r0", "cc", "memory"); - return result == 0; -} - -inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) -{ - int result; - asm volatile("synco\n" - "0:\n" - "movli.l @%[_q_value], r0\n" - "xor %[expectedValue], r0\n" - "cmp/eq #0, r0\n" - "bf/s 0f\n" - "mov r0, %[result]\n" - "mov %[newValue], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - "0:\n" - : [result] "=&r" (result), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [expectedValue] "r" (expectedValue), - [newValue] "r" (newValue) - : "r0", "cc", "memory"); - return result == 0; -} - -inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) -{ - return testAndSetAcquire(expectedValue, newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) -{ - int originalValue; - asm volatile("0:\n" - "movli.l @%[_q_value], r0\n" - "mov r0, %[originalValue]\n" - "mov %[newValue], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - : [originalValue] "=&r" (originalValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [newValue] "r" (newValue) - : "r0", "cc", "memory"); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) -{ - int originalValue; - asm volatile("0:\n" - "movli.l @%[_q_value], r0\n" - "mov r0, %[originalValue]\n" - "mov %[newValue], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - "synco\n" - : [originalValue] "=&r" (originalValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [newValue] "r" (newValue) - : "r0", "cc", "memory"); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) -{ - int originalValue; - asm volatile("synco\n" - "0:\n" - "movli.l @%[_q_value], r0\n" - "mov r0, %[originalValue]\n" - "mov %[newValue], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - : [originalValue] "=&r" (originalValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [newValue] "r" (newValue) - : "r0", "cc", "memory"); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) -{ - return fetchAndStoreAcquire(newValue); -} - -inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) -{ - int originalValue; - asm volatile("0:\n" - "movli.l @%[_q_value], r0\n" - "mov r0, %[originalValue]\n" - "add %[valueToAdd], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - : [originalValue] "=&r" (originalValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [valueToAdd] "r" (valueToAdd) - : "r0", "cc", "memory"); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) -{ - int originalValue; - asm volatile("0:\n" - "movli.l @%[_q_value], r0\n" - "mov r0, %[originalValue]\n" - "add %[valueToAdd], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - "synco\n" - : [originalValue] "=&r" (originalValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [valueToAdd] "r" (valueToAdd) - : "r0", "cc", "memory"); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) -{ - int originalValue; - asm volatile("synco\n" - "0:\n" - "movli.l @%[_q_value], r0\n" - "mov r0, %[originalValue]\n" - "add %[valueToAdd], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - : [originalValue] "=&r" (originalValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [valueToAdd] "r" (valueToAdd) - : "r0", "cc", "memory"); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) -{ - return fetchAndAddAcquire(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) -{ - T *result; - asm volatile("0:\n" - "movli.l @%[_q_value], r0\n" - "xor %[expectedValue], r0\n" - "cmp/eq #0, r0\n" - "bf/s 0f\n" - "mov r0, %[result]\n" - "mov %[newValue], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - "0:\n" - : [result] "=&r" (result), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [expectedValue] "r" (expectedValue), - [newValue] "r" (newValue) - : "r0", "cc", "memory"); - return result == 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) -{ - T *result; - asm volatile("0:\n" - "movli.l @%[_q_value], r0\n" - "xor %[expectedValue], r0\n" - "cmp/eq #0, r0\n" - "bf/s 0f\n" - "mov r0, %[result]\n" - "mov %[newValue], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - "synco\n" - "0:\n" - : [result] "=&r" (result), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [expectedValue] "r" (expectedValue), - [newValue] "r" (newValue) - : "r0", "cc", "memory"); - return result == 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) -{ - T *result; - asm volatile("synco\n" - "0:\n" - "movli.l @%[_q_value], r0\n" - "xor %[expectedValue], r0\n" - "cmp/eq #0, r0\n" - "bf/s 0f\n" - "mov r0, %[result]\n" - "mov %[newValue], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - "0:\n" - : [result] "=&r" (result), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [expectedValue] "r" (expectedValue), - [newValue] "r" (newValue) - : "r0", "cc", "memory"); - return result == 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) -{ - return testAndSetAcquire(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) -{ - T *originalValue; - asm volatile("0:\n" - "movli.l @%[_q_value], r0\n" - "mov r0, %[originalValue]\n" - "mov %[newValue], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - : [originalValue] "=&r" (originalValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [newValue] "r" (newValue) - : "r0", "cc", "memory"); - return originalValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) -{ - T *originalValue; - asm volatile("0:\n" - "movli.l @%[_q_value], r0\n" - "mov r0, %[originalValue]\n" - "mov %[newValue], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - "synco\n" - : [originalValue] "=&r" (originalValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [newValue] "r" (newValue) - : "r0", "cc", "memory"); - return originalValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) -{ - T *originalValue; - asm volatile("synco\n" - "0:\n" - "movli.l @%[_q_value], r0\n" - "mov r0, %[originalValue]\n" - "mov %[newValue], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - : [originalValue] "=&r" (originalValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [newValue] "r" (newValue) - : "r0", "cc", "memory"); - return originalValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) -{ - return fetchAndStoreAcquire(newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) -{ - T *originalValue; - asm volatile("0:\n" - "movli.l @%[_q_value], r0\n" - "mov r0, %[originalValue]\n" - "add %[valueToAdd], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - : [originalValue] "=&r" (originalValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [valueToAdd] "r" (valueToAdd * sizeof(T)) - : "r0", "cc", "memory"); - return originalValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) -{ - T *originalValue; - asm volatile("0:\n" - "movli.l @%[_q_value], r0\n" - "mov r0, %[originalValue]\n" - "add %[valueToAdd], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - "synco\n" - : [originalValue] "=&r" (originalValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [valueToAdd] "r" (valueToAdd * sizeof(T)) - : "r0", "cc", "memory"); - return originalValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) -{ - T *originalValue; - asm volatile("synco\n" - "0:\n" - "movli.l @%[_q_value], r0\n" - "mov r0, %[originalValue]\n" - "add %[valueToAdd], r0\n" - "movco.l r0, @%[_q_value]\n" - "bf 0b\n" - : [originalValue] "=&r" (originalValue), - "+m" (_q_value) - : [_q_value] "r" (&_q_value), - [valueToAdd] "r" (valueToAdd * sizeof(T)) - : "r0", "cc", "memory"); - return originalValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) -{ - return fetchAndAddAcquire(valueToAdd); -} - -#endif // Q_CC_GNU - -#endif // QATOMIC_SH4A_H diff --git a/src/corelib/arch/qatomic_sparc.h b/src/corelib/arch/qatomic_sparc.h deleted file mode 100644 index 8aea33ce85..0000000000 --- a/src/corelib/arch/qatomic_sparc.h +++ /dev/null @@ -1,532 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QATOMIC_SPARC_H -#define QATOMIC_SPARC_H - -#include <QtCore/qoldbasicatomic.h> - -QT_BEGIN_NAMESPACE - -#if 0 -// silence syncqt warnings -QT_END_NAMESPACE -QT_END_HEADER - -#pragma qt_sync_skip_header_check -#pragma qt_sync_stop_processing -#endif - -#if defined(_LP64) - -#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isReferenceCountingNative() -{ return true; } -inline bool QBasicAtomicInt::isReferenceCountingWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE -#define Q_ATOMIC_INT_TEST_AND_SET_IS_WAIT_FREE - -inline bool QBasicAtomicInt::isTestAndSetNative() -{ return true; } -inline bool QBasicAtomicInt::isTestAndSetWaitFree() -{ return true; } - -#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE -#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE - -inline bool QBasicAtomicInt::isFetchAndStoreNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() -{ return true; } - -#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE - -inline bool QBasicAtomicInt::isFetchAndAddNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndAddWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE -#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_WAIT_FREE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() -{ return true; } - -#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE -#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() -{ return true; } - -#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() -{ return false; } - -extern "C" { - Q_CORE_EXPORT int q_atomic_increment(volatile int *ptr); - Q_CORE_EXPORT int q_atomic_decrement(volatile int *ptr); - - Q_CORE_EXPORT int q_atomic_test_and_set_int(volatile int *ptr, int expected, int newval); - Q_CORE_EXPORT int q_atomic_test_and_set_acquire_int(volatile int *ptr, - int expected, - int newval); - Q_CORE_EXPORT int q_atomic_test_and_set_release_int(volatile int *ptr, - int expected, - int newval); - - Q_CORE_EXPORT int q_atomic_set_int(volatile int *ptr, int newval); - Q_CORE_EXPORT int q_atomic_fetch_and_store_acquire_int(volatile int *ptr, int newval); - Q_CORE_EXPORT int q_atomic_fetch_and_store_release_int(volatile int *ptr, int newval); - - Q_CORE_EXPORT int q_atomic_fetch_and_add_int(volatile int *ptr, int value); - Q_CORE_EXPORT int q_atomic_fetch_and_add_acquire_int(volatile int *ptr, int value); - Q_CORE_EXPORT int q_atomic_fetch_and_add_release_int(volatile int *ptr, int value); - - Q_CORE_EXPORT int q_atomic_test_and_set_ptr(volatile void *ptr, const void *expected, const void *newval); - Q_CORE_EXPORT int q_atomic_test_and_set_acquire_ptr(volatile void *ptr, - const void *expected, - const void *newval); - Q_CORE_EXPORT int q_atomic_test_and_set_release_ptr(volatile void *ptr, - const void *expected, - const void *newval); - - Q_CORE_EXPORT void *q_atomic_set_ptr(volatile void *ptr, const void *newval); - Q_CORE_EXPORT void *q_atomic_fetch_and_store_acquire_ptr(volatile void *ptr, const void *newval); - Q_CORE_EXPORT void *q_atomic_fetch_and_store_release_ptr(volatile void *ptr, const void *newval); - - Q_CORE_EXPORT void *q_atomic_fetch_and_add_ptr(volatile void *ptr, int value); - Q_CORE_EXPORT void *q_atomic_fetch_and_add_acquire_ptr(volatile void *ptr, int value); - Q_CORE_EXPORT void *q_atomic_fetch_and_add_release_ptr(volatile void *ptr, int value); -} - -inline bool QBasicAtomicInt::ref() -{ - return fetchAndAddRelaxed(1) != -1; -} - -inline bool QBasicAtomicInt::deref() -{ - return fetchAndAddRelaxed(-1) != 1; -} - -inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) -{ - return q_atomic_test_and_set_int(&_q_value, expectedValue, newValue) != 0; -} - -inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) -{ - return q_atomic_test_and_set_acquire_int(&_q_value, expectedValue, newValue) != 0; -} - -inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) -{ - return q_atomic_test_and_set_release_int(&_q_value, expectedValue, newValue) != 0; -} - -inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) -{ - return q_atomic_test_and_set_acquire_int(&_q_value, expectedValue, newValue) != 0; -} - -inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) -{ - return q_atomic_set_int(&_q_value, newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) -{ - return q_atomic_fetch_and_store_acquire_int(&_q_value, newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) -{ - return q_atomic_fetch_and_store_release_int(&_q_value, newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) -{ - return q_atomic_fetch_and_store_acquire_int(&_q_value, newValue); -} - -inline int QBasicAtomicInt::fetchAndAddRelaxed(int newValue) -{ - return q_atomic_fetch_and_add_int(&_q_value, newValue); -} - -inline int QBasicAtomicInt::fetchAndAddAcquire(int newValue) -{ - return q_atomic_fetch_and_add_acquire_int(&_q_value, newValue); -} - -inline int QBasicAtomicInt::fetchAndAddRelease(int newValue) -{ - return q_atomic_fetch_and_add_release_int(&_q_value, newValue); -} - -inline int QBasicAtomicInt::fetchAndAddOrdered(int newValue) -{ - return q_atomic_fetch_and_add_acquire_int(&_q_value, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) -{ - return q_atomic_test_and_set_ptr(&_q_value, expectedValue, newValue) != 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) -{ - return q_atomic_test_and_set_acquire_ptr(&_q_value, expectedValue, newValue) != 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) -{ - return q_atomic_test_and_set_release_ptr(&_q_value, expectedValue, newValue) != 0; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) -{ - return q_atomic_test_and_set_acquire_ptr(&_q_value, expectedValue, newValue) != 0; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) -{ - return reinterpret_cast<T *>(q_atomic_set_ptr(&_q_value, newValue)); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) -{ - return reinterpret_cast<T *>(q_atomic_fetch_and_store_acquire_ptr(&_q_value, newValue)); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) -{ - return reinterpret_cast<T *>(q_atomic_fetch_and_store_release_ptr(&_q_value, newValue)); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) -{ - return reinterpret_cast<T *>(q_atomic_fetch_and_store_acquire_ptr(&_q_value, newValue)); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) -{ - return reinterpret_cast<T *>(q_atomic_fetch_and_add_ptr(&_q_value, valueToAdd * sizeof(T))); -} - -template <typename T> -Q_INLINE_TEMPLATE -T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) -{ - return reinterpret_cast<T *>(q_atomic_fetch_and_add_acquire_ptr(&_q_value, valueToAdd * sizeof(T))); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) -{ - return reinterpret_cast<T *>(q_atomic_fetch_and_add_release_ptr(&_q_value, valueToAdd * sizeof(T))); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) -{ - return reinterpret_cast<T *>(q_atomic_fetch_and_add_acquire_ptr(&_q_value, valueToAdd * sizeof(T))); -} - -#else - -#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isReferenceCountingNative() -{ return false; } -inline bool QBasicAtomicInt::isReferenceCountingWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isTestAndSetNative() -{ return false; } -inline bool QBasicAtomicInt::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE -#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE - -inline bool QBasicAtomicInt::isFetchAndStoreNative() -{ return true; } -inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() -{ return true; } - -#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isFetchAndAddNative() -{ return false; } -inline bool QBasicAtomicInt::isFetchAndAddWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() -{ return false; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE -#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() -{ return true; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() -{ return true; } - -#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() -{ return false; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() -{ return false; } - -extern "C" { - Q_CORE_EXPORT int q_atomic_lock_int(volatile int *addr); - Q_CORE_EXPORT int q_atomic_lock_ptr(volatile void *addr); - Q_CORE_EXPORT void q_atomic_unlock(volatile void *addr, int value); - Q_CORE_EXPORT int q_atomic_set_int(volatile int *ptr, int newval); - Q_CORE_EXPORT void *q_atomic_set_ptr(volatile void *ptr, void *newval); -} // extern "C" - -inline bool QBasicAtomicInt::ref() -{ - const int val = q_atomic_lock_int(&_q_value); - q_atomic_unlock(&_q_value, val + 1); - return val != -1; -} - -inline bool QBasicAtomicInt::deref() -{ - const int val = q_atomic_lock_int(&_q_value); - q_atomic_unlock(&_q_value, val - 1); - return val != 1; -} - -inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) -{ - int val = q_atomic_lock_int(&_q_value); - if (val == expectedValue) { - q_atomic_unlock(&_q_value, newValue); - return true; - } - q_atomic_unlock(&_q_value, val); - return false; -} - -inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) -{ - return q_atomic_set_int(&_q_value, newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) -{ - const int originalValue = q_atomic_lock_int(&_q_value); - q_atomic_unlock(&_q_value, originalValue + valueToAdd); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) -{ - T *val = reinterpret_cast<T *>(q_atomic_lock_ptr(&_q_value)); - if (val == expectedValue) { - q_atomic_unlock(&_q_value, reinterpret_cast<int>(newValue)); - return true; - } - q_atomic_unlock(&_q_value, reinterpret_cast<int>(val)); - return false; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) -{ - return reinterpret_cast<T *>(q_atomic_set_ptr(&_q_value, newValue)); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) -{ - T *originalValue = reinterpret_cast<T *>(q_atomic_lock_ptr(&_q_value)); - q_atomic_unlock(&_q_value, int(originalValue + valueToAdd)); - return originalValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -#endif // _LP64 - -QT_END_NAMESPACE - -#endif // QATOMIC_SPARC_H diff --git a/src/corelib/arch/qatomic_vxworks.h b/src/corelib/arch/qatomic_vxworks.h deleted file mode 100644 index 57e3b6a32b..0000000000 --- a/src/corelib/arch/qatomic_vxworks.h +++ /dev/null @@ -1,330 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QATOMIC_VXWORKS_H -#define QATOMIC_VXWORKS_H - -#if defined(__ppc) -# include <QtCore/qatomic_power.h> -#else // generic implementation with taskLock() - -#include <QtCore/qoldbasicatomic.h> - -#if 0 -// we don't want to include the system header here for two function prototypes, -// because it pulls in a _lot_ of stuff that pollutes the global namespace -# include <vxWorksCommon.h> -# include <taskLib.h> -#else -#if defined(_WRS_KERNEL) -extern "C" int taskLock(); -extern "C" int taskUnlock(); -#else -inline int taskLock() { return 0; } -inline int taskUnlock() { return 0; } -#endif -#endif - - - -QT_BEGIN_NAMESPACE - -#if 0 -// silence syncqt warnings -QT_END_NAMESPACE -QT_END_HEADER - -#pragma qt_sync_skip_header_check -#pragma qt_sync_stop_processing -#endif - -#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isReferenceCountingNative() -{ return false; } -inline bool QBasicAtomicInt::isReferenceCountingWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isTestAndSetNative() -{ return false; } -inline bool QBasicAtomicInt::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isFetchAndStoreNative() -{ return false; } -inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() -{ return false; } - -#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE - -inline bool QBasicAtomicInt::isFetchAndAddNative() -{ return false; } -inline bool QBasicAtomicInt::isFetchAndAddWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetNative() -{ return false; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isTestAndSetWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreNative() -{ return false; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndStoreWaitFree() -{ return false; } - -#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddNative() -{ return false; } -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::isFetchAndAddWaitFree() -{ return false; } - -// Reference counting - -inline bool QBasicAtomicInt::ref() -{ - taskLock(); - bool ret = (++_q_value != 0); - taskUnlock(); - return ret; -} - -inline bool QBasicAtomicInt::deref() -{ - taskLock(); - bool ret = (--_q_value != 0); - taskUnlock(); - return ret; -} - -// Test-and-set for integers - -inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) -{ - taskLock(); - if (_q_value == expectedValue) { - _q_value = newValue; - taskUnlock(); - return true; - } - taskUnlock(); - return false; -} - -inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -// Fetch-and-store for integers - -inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) -{ - taskLock(); - int returnValue = _q_value; - _q_value = newValue; - taskUnlock(); - return returnValue; -} - -inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -// Fetch-and-add for integers - -inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) -{ - taskLock(); - int originalValue = _q_value; - _q_value += valueToAdd; - taskUnlock(); - return originalValue; -} - -inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -// Test and set for pointers - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue) -{ - taskLock(); - if (_q_value == expectedValue) { - _q_value = newValue; - taskUnlock(); - return true; - } - taskUnlock(); - return false; -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE bool QBasicAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue) -{ - return testAndSetOrdered(expectedValue, newValue); -} - -// Fetch and store for pointers - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreOrdered(T *newValue) -{ - taskLock(); - T *returnValue = (_q_value); - _q_value = newValue; - taskUnlock(); - return returnValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreAcquire(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndStoreRelease(T *newValue) -{ - return fetchAndStoreOrdered(newValue); -} - -// Fetch and add for pointers - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd) -{ - taskLock(); - T *returnValue = (_q_value); - _q_value += valueToAdd; - taskUnlock(); - return returnValue; -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -template <typename T> -Q_INLINE_TEMPLATE T *QBasicAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd) -{ - return fetchAndAddOrdered(valueToAdd); -} - -QT_END_NAMESPACE - -#endif // generic implementation with taskLock() - -#endif // QATOMIC_VXWORKS_H diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp index 39d136c006..b2e19dc6dc 100644 --- a/src/corelib/thread/qatomic.cpp +++ b/src/corelib/thread/qatomic.cpp @@ -39,6 +39,8 @@ ** ****************************************************************************/ +#include "qatomic.h" + /*! \class QAtomicInt \inmodule QtCore @@ -1126,3 +1128,8 @@ Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE to indicate that the atomic fetch-and-add on pointers is wait-free. */ + +// static checks +#ifndef Q_ATOMIC_INT32_IS_SUPPORTED +# error "Q_ATOMIC_INT32_IS_SUPPORTED must be defined" +#endif diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h index 3bf6b0c106..9fa12ba811 100644 --- a/src/corelib/thread/qbasicatomic.h +++ b/src/corelib/thread/qbasicatomic.h @@ -51,33 +51,17 @@ #elif defined(Q_CC_MSVC) # include <QtCore/qatomic_msvc.h> -// Operating system dependent implementation -#elif defined(Q_OS_INTEGRITY) -# include "QtCore/qatomic_integrity.h" -#elif defined(Q_OS_VXWORKS) -# include "QtCore/qatomic_vxworks.h" - // Processor dependent implementation -#elif defined(Q_PROCESSOR_ALPHA) -# include "QtCore/qatomic_alpha.h" #elif defined(Q_PROCESSOR_ARM_V7) && defined(Q_PROCESSOR_ARM_32) # include "QtCore/qatomic_armv7.h" #elif defined(Q_PROCESSOR_ARM_V6) && defined(Q_PROCESSOR_ARM_32) # include "QtCore/qatomic_armv6.h" #elif defined(Q_PROCESSOR_ARM_V5) && defined(Q_PROCESSOR_ARM_32) # include "QtCore/qatomic_armv5.h" -#elif defined(Q_PROCESSOR_BFIN) -# include "QtCore/qatomic_bfin.h" #elif defined(Q_PROCESSOR_IA64) # include "QtCore/qatomic_ia64.h" #elif defined(Q_PROCESSOR_MIPS) # include "QtCore/qatomic_mips.h" -#elif defined(Q_PROCESSOR_POWER) -# include "QtCore/qatomic_power.h" -#elif defined(Q_PROCESSOR_S390) -# include "QtCore/qatomic_s390.h" -#elif defined(Q_PROCESSOR_SH4A) -# include "QtCore/qatomic_sh4a.h" #elif defined(Q_PROCESSOR_SPARC) # include "QtCore/qatomic_sparc.h" #elif defined(Q_PROCESSOR_X86) @@ -98,9 +82,6 @@ # error "Qt has not been ported to this platform" #endif -// Only include if the implementation has been ported to QAtomicOps -#ifndef QOLDBASICATOMIC_H - QT_BEGIN_NAMESPACE #if 0 @@ -266,6 +247,4 @@ public: QT_END_NAMESPACE -#endif // QOLDBASICATOMIC_H - #endif // QBASICATOMIC_H diff --git a/src/corelib/thread/qoldbasicatomic.h b/src/corelib/thread/qoldbasicatomic.h deleted file mode 100644 index 473f1a5b0f..0000000000 --- a/src/corelib/thread/qoldbasicatomic.h +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QOLDBASICATOMIC_H -#define QOLDBASICATOMIC_H - -#include <QtCore/qglobal.h> - -QT_BEGIN_NAMESPACE - - -#if 0 -// silence syncqt warnings -QT_END_NAMESPACE -#pragma qt_sync_skip_header_check -#pragma qt_no_master_include -#pragma qt_sync_stop_processing -#endif - -class Q_CORE_EXPORT QBasicAtomicInt -{ -public: - volatile int _q_value; - - // Atomic API, implemented in qatomic_XXX.h - - int load() const { return _q_value; } - int loadAcquire() const { return _q_value; } - void store(int newValue) { _q_value = newValue; } - void storeRelease(int newValue) { _q_value = newValue; } - - static bool isReferenceCountingNative(); - static bool isReferenceCountingWaitFree(); - - bool ref(); - bool deref(); - - static bool isTestAndSetNative(); - static bool isTestAndSetWaitFree(); - - bool testAndSetRelaxed(int expectedValue, int newValue); - bool testAndSetAcquire(int expectedValue, int newValue); - bool testAndSetRelease(int expectedValue, int newValue); - bool testAndSetOrdered(int expectedValue, int newValue); - - static bool isFetchAndStoreNative(); - static bool isFetchAndStoreWaitFree(); - - int fetchAndStoreRelaxed(int newValue); - int fetchAndStoreAcquire(int newValue); - int fetchAndStoreRelease(int newValue); - int fetchAndStoreOrdered(int newValue); - - static bool isFetchAndAddNative(); - static bool isFetchAndAddWaitFree(); - - int fetchAndAddRelaxed(int valueToAdd); - int fetchAndAddAcquire(int valueToAdd); - int fetchAndAddRelease(int valueToAdd); - int fetchAndAddOrdered(int valueToAdd); -}; - -template <typename T> -class QBasicAtomicPointer -{ -public: - T * volatile _q_value; - - // Atomic API, implemented in qatomic_XXX.h - - T *load() const { return _q_value; } - T *loadAcquire() const { return _q_value; } - void store(T *newValue) { _q_value = newValue; } - void storeRelease(T *newValue) { _q_value = newValue; } - - static bool isTestAndSetNative(); - static bool isTestAndSetWaitFree(); - - bool testAndSetRelaxed(T *expectedValue, T *newValue); - bool testAndSetAcquire(T *expectedValue, T *newValue); - bool testAndSetRelease(T *expectedValue, T *newValue); - bool testAndSetOrdered(T *expectedValue, T *newValue); - - static bool isFetchAndStoreNative(); - static bool isFetchAndStoreWaitFree(); - - T *fetchAndStoreRelaxed(T *newValue); - T *fetchAndStoreAcquire(T *newValue); - T *fetchAndStoreRelease(T *newValue); - T *fetchAndStoreOrdered(T *newValue); - - static bool isFetchAndAddNative(); - static bool isFetchAndAddWaitFree(); - - T *fetchAndAddRelaxed(qptrdiff valueToAdd); - T *fetchAndAddAcquire(qptrdiff valueToAdd); - T *fetchAndAddRelease(qptrdiff valueToAdd); - T *fetchAndAddOrdered(qptrdiff valueToAdd); -}; - -#define Q_BASIC_ATOMIC_INITIALIZER(a) { (a) } - -QT_END_NAMESPACE - -#endif // QOLDBASICATOMIC_H diff --git a/src/corelib/thread/thread.pri b/src/corelib/thread/thread.pri index 13f0502b62..3c1ddd984a 100644 --- a/src/corelib/thread/thread.pri +++ b/src/corelib/thread/thread.pri @@ -17,8 +17,7 @@ HEADERS += thread/qmutex.h \ thread/qfuturesynchronizer.h \ thread/qfuturewatcher.h \ thread/qbasicatomic.h \ - thread/qgenericatomic.h \ - thread/qoldbasicatomic.h + thread/qgenericatomic.h # private headers HEADERS += thread/qmutex_p.h \ |