Remove the SH atomic implementation...
... but keep SH-4a, which provides a more efficient implementation. The implementation removed here was very similar to the code removed by commit dc5388e79b71d796c1207681235cf007c39810bd. Support for SH can be provided by qatomic_gcc.h, or re-added in the future if absolutely necessary. Change-Id: Ic38b57c9513fc9c3c99ba7e102780a3939b735b9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
48e48f2597
commit
c4759d19f8
@ -26,7 +26,6 @@ integrity:HEADERS += arch/qatomic_integrity.h
|
||||
arch/qatomic_mips.h \
|
||||
arch/qatomic_s390.h \
|
||||
arch/qatomic_x86_64.h \
|
||||
arch/qatomic_sh.h \
|
||||
arch/qatomic_sh4a.h \
|
||||
arch/qatomic_gcc.h \
|
||||
arch/qatomic_cxx11.h
|
||||
|
@ -64,8 +64,6 @@ QT_BEGIN_HEADER
|
||||
# include "QtCore/qatomic_s390.h"
|
||||
#elif defined(QT_ARCH_SPARC)
|
||||
# include "QtCore/qatomic_sparc.h"
|
||||
#elif defined(QT_ARCH_SH)
|
||||
# include "QtCore/qatomic_sh.h"
|
||||
#elif defined(QT_ARCH_SH4A)
|
||||
# include "QtCore/qatomic_sh4a.h"
|
||||
#else
|
||||
|
@ -1,330 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia 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.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QATOMIC_SH_H
|
||||
#define QATOMIC_SH_H
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#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; }
|
||||
|
||||
extern Q_CORE_EXPORT volatile char qt_atomic_lock;
|
||||
Q_CORE_EXPORT void qt_atomic_yield(int *count);
|
||||
|
||||
inline int qt_atomic_tasb(volatile char *ptr)
|
||||
{
|
||||
register int ret;
|
||||
asm volatile("tas.b @%2\n"
|
||||
"movt %0"
|
||||
: "=&r"(ret), "=m"(*ptr)
|
||||
: "r"(ptr)
|
||||
: "cc", "memory");
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Reference counting
|
||||
|
||||
inline bool QBasicAtomicInt::ref()
|
||||
{
|
||||
int count = 0;
|
||||
while (qt_atomic_tasb(&qt_atomic_lock) == 0)
|
||||
qt_atomic_yield(&count);
|
||||
int originalValue = _q_value++;
|
||||
qt_atomic_lock = 0;
|
||||
return originalValue != -1;
|
||||
}
|
||||
|
||||
inline bool QBasicAtomicInt::deref()
|
||||
{
|
||||
int count = 0;
|
||||
while (qt_atomic_tasb(&qt_atomic_lock) == 0)
|
||||
qt_atomic_yield(&count);
|
||||
int originalValue = _q_value--;
|
||||
qt_atomic_lock = 0;
|
||||
return originalValue != 1;
|
||||
}
|
||||
|
||||
// Test and set for integers
|
||||
|
||||
inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue)
|
||||
{
|
||||
bool returnValue = false;
|
||||
int count = 0;
|
||||
while (qt_atomic_tasb(&qt_atomic_lock) == 0)
|
||||
qt_atomic_yield(&count);
|
||||
if (_q_value == expectedValue) {
|
||||
_q_value = newValue;
|
||||
returnValue = true;
|
||||
}
|
||||
qt_atomic_lock = 0;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
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 count = 0;
|
||||
while (qt_atomic_tasb(&qt_atomic_lock) == 0)
|
||||
qt_atomic_yield(&count);
|
||||
int originalValue = _q_value;
|
||||
_q_value = newValue;
|
||||
qt_atomic_lock = 0;
|
||||
return originalValue;
|
||||
}
|
||||
|
||||
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 count = 0;
|
||||
while (qt_atomic_tasb(&qt_atomic_lock) == 0)
|
||||
qt_atomic_yield(&count);
|
||||
int originalValue = _q_value;
|
||||
_q_value += valueToAdd;
|
||||
qt_atomic_lock = 0;
|
||||
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)
|
||||
{
|
||||
bool returnValue = false;
|
||||
int count = 0;
|
||||
while (qt_atomic_tasb(&qt_atomic_lock) == 0)
|
||||
qt_atomic_yield(&count);
|
||||
if (_q_value == expectedValue) {
|
||||
_q_value = newValue;
|
||||
returnValue = true;
|
||||
}
|
||||
qt_atomic_lock = 0;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int count = 0;
|
||||
while (qt_atomic_tasb(&qt_atomic_lock) == 0)
|
||||
qt_atomic_yield(&count);
|
||||
T *originalValue = _q_value;
|
||||
_q_value = newValue;
|
||||
qt_atomic_lock = 0;
|
||||
return originalValue;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int count = 0;
|
||||
while (qt_atomic_tasb(&qt_atomic_lock) == 0)
|
||||
qt_atomic_yield(&count);
|
||||
T *originalValue = (_q_value);
|
||||
_q_value += valueToAdd;
|
||||
qt_atomic_lock = 0;
|
||||
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);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QATOMIC_SH_H
|
@ -1,4 +0,0 @@
|
||||
#
|
||||
# SH (Renesas SuperH) architecture
|
||||
#
|
||||
SOURCES += $$QT_ARCH_CPP/qatomic_sh.cpp
|
@ -1,72 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** 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, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia 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.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
# include <sched.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QT_USE_NAMESPACE
|
||||
|
||||
Q_CORE_EXPORT volatile char qt_atomic_lock = 0;
|
||||
|
||||
Q_CORE_EXPORT void qt_atomic_yield(int *count)
|
||||
{
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
if((*count)++ < 50) {
|
||||
sched_yield();
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
struct timespec tm;
|
||||
tm.tv_sec = 0;
|
||||
tm.tv_nsec = 2000001;
|
||||
nanosleep(&tm, NULL);
|
||||
*count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
Loading…
x
Reference in New Issue
Block a user