Merge "Remove android_... store_barriers and 64-bit atomics."
This commit is contained in:
commit
69001e0856
|
@ -37,15 +37,6 @@ extern ANDROID_ATOMIC_INLINE void android_memory_barrier()
|
|||
#endif
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE void android_memory_store_barrier()
|
||||
{
|
||||
#if ANDROID_SMP == 0
|
||||
android_compiler_barrier();
|
||||
#else
|
||||
__asm__ __volatile__ ("dmb st" : : : "memory");
|
||||
#endif
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int32_t android_atomic_acquire_load(volatile const int32_t *ptr)
|
||||
{
|
||||
|
|
|
@ -51,11 +51,6 @@ void android_memory_barrier(void)
|
|||
{
|
||||
__asm__ __volatile__ ("dmb ish" : : : "memory");
|
||||
}
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_memory_store_barrier(void)
|
||||
{
|
||||
__asm__ __volatile__ ("dmb ishst" : : : "memory");
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int32_t android_atomic_acquire_load(volatile const int32_t *ptr)
|
||||
|
@ -65,14 +60,6 @@ int32_t android_atomic_acquire_load(volatile const int32_t *ptr)
|
|||
return value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_acquire_load64(volatile const int64_t *ptr)
|
||||
{
|
||||
int64_t value = *ptr;
|
||||
android_memory_barrier();
|
||||
return value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int32_t android_atomic_release_load(volatile const int32_t *ptr)
|
||||
{
|
||||
|
@ -80,13 +67,6 @@ int32_t android_atomic_release_load(volatile const int32_t *ptr)
|
|||
return *ptr;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_release_load64(volatile const int64_t *ptr)
|
||||
{
|
||||
android_memory_barrier();
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_atomic_acquire_store(int32_t value, volatile int32_t *ptr)
|
||||
{
|
||||
|
@ -94,13 +74,6 @@ void android_atomic_acquire_store(int32_t value, volatile int32_t *ptr)
|
|||
android_memory_barrier();
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_atomic_acquire_store64(int64_t value, volatile int64_t *ptr)
|
||||
{
|
||||
*ptr = value;
|
||||
android_memory_barrier();
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_atomic_release_store(int32_t value, volatile int32_t *ptr)
|
||||
{
|
||||
|
@ -108,13 +81,6 @@ void android_atomic_release_store(int32_t value, volatile int32_t *ptr)
|
|||
*ptr = value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_atomic_release_store64(int64_t value, volatile int64_t *ptr)
|
||||
{
|
||||
android_memory_barrier();
|
||||
*ptr = value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int android_atomic_cas(int32_t old_value, int32_t new_value,
|
||||
volatile int32_t *ptr)
|
||||
|
@ -122,13 +88,6 @@ int android_atomic_cas(int32_t old_value, int32_t new_value,
|
|||
return __sync_val_compare_and_swap(ptr, old_value, new_value) != old_value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_cas64(int64_t old_value, int64_t new_value,
|
||||
volatile int64_t *ptr)
|
||||
{
|
||||
return __sync_val_compare_and_swap(ptr, old_value, new_value) != old_value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int android_atomic_acquire_cas(int32_t old_value, int32_t new_value,
|
||||
volatile int32_t *ptr)
|
||||
|
@ -138,15 +97,6 @@ int android_atomic_acquire_cas(int32_t old_value, int32_t new_value,
|
|||
return status;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_acquire_cas64(int64_t old_value, int64_t new_value,
|
||||
volatile int64_t *ptr)
|
||||
{
|
||||
int status = android_atomic_cas64(old_value, new_value, ptr);
|
||||
android_memory_barrier();
|
||||
return status;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int android_atomic_release_cas(int32_t old_value, int32_t new_value,
|
||||
volatile int32_t *ptr)
|
||||
|
@ -155,14 +105,6 @@ int android_atomic_release_cas(int32_t old_value, int32_t new_value,
|
|||
return android_atomic_cas(old_value, new_value, ptr);
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_release_cas64(int64_t old_value, int64_t new_value,
|
||||
volatile int64_t *ptr)
|
||||
{
|
||||
android_memory_barrier();
|
||||
return android_atomic_cas64(old_value, new_value, ptr);
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int32_t android_atomic_add(int32_t increment, volatile int32_t *ptr)
|
||||
{
|
||||
|
|
|
@ -65,12 +65,6 @@ extern "C" {
|
|||
#define ANDROID_MEMBAR_FULL android_memory_barrier
|
||||
#endif
|
||||
|
||||
#if ANDROID_SMP == 0
|
||||
#define ANDROID_MEMBAR_STORE android_compiler_barrier
|
||||
#else
|
||||
#define ANDROID_MEMBAR_STORE android_memory_store_barrier
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -33,19 +33,11 @@ extern ANDROID_ATOMIC_INLINE void android_memory_barrier(void)
|
|||
{
|
||||
android_compiler_barrier();
|
||||
}
|
||||
extern ANDROID_ATOMIC_INLINE void android_memory_store_barrier(void)
|
||||
{
|
||||
android_compiler_barrier();
|
||||
}
|
||||
#else
|
||||
extern ANDROID_ATOMIC_INLINE void android_memory_barrier(void)
|
||||
{
|
||||
__asm__ __volatile__ ("sync" : : : "memory");
|
||||
}
|
||||
extern ANDROID_ATOMIC_INLINE void android_memory_store_barrier(void)
|
||||
{
|
||||
__asm__ __volatile__ ("sync" : : : "memory");
|
||||
}
|
||||
#endif
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE int32_t
|
||||
|
|
|
@ -32,10 +32,6 @@ extern ANDROID_ATOMIC_INLINE void android_memory_barrier(void)
|
|||
{
|
||||
__asm__ __volatile__ ("sync" : : : "memory");
|
||||
}
|
||||
extern ANDROID_ATOMIC_INLINE void android_memory_store_barrier(void)
|
||||
{
|
||||
__asm__ __volatile__ ("sync" : : : "memory");
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int32_t android_atomic_acquire_load(volatile const int32_t *ptr)
|
||||
|
@ -45,14 +41,6 @@ int32_t android_atomic_acquire_load(volatile const int32_t *ptr)
|
|||
return value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_acquire_load64(volatile const int64_t *ptr)
|
||||
{
|
||||
int64_t value = *ptr;
|
||||
android_memory_barrier();
|
||||
return value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int32_t android_atomic_release_load(volatile const int32_t *ptr)
|
||||
{
|
||||
|
@ -60,13 +48,6 @@ int32_t android_atomic_release_load(volatile const int32_t *ptr)
|
|||
return *ptr;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_release_load64(volatile const int64_t *ptr)
|
||||
{
|
||||
android_memory_barrier();
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_atomic_acquire_store(int32_t value, volatile int32_t *ptr)
|
||||
{
|
||||
|
@ -74,13 +55,6 @@ void android_atomic_acquire_store(int32_t value, volatile int32_t *ptr)
|
|||
android_memory_barrier();
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_atomic_acquire_store64(int64_t value, volatile int64_t *ptr)
|
||||
{
|
||||
*ptr = value;
|
||||
android_memory_barrier();
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_atomic_release_store(int32_t value, volatile int32_t *ptr)
|
||||
{
|
||||
|
@ -88,13 +62,6 @@ void android_atomic_release_store(int32_t value, volatile int32_t *ptr)
|
|||
*ptr = value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_atomic_release_store64(int64_t value, volatile int64_t *ptr)
|
||||
{
|
||||
android_memory_barrier();
|
||||
*ptr = value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int android_atomic_cas(int32_t old_value, int32_t new_value, volatile int32_t *ptr)
|
||||
{
|
||||
|
@ -114,13 +81,6 @@ int android_atomic_cas(int32_t old_value, int32_t new_value, volatile int32_t *p
|
|||
return prev != old_value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_cas64(int64_t old_value, int64_t new_value,
|
||||
volatile int64_t *ptr)
|
||||
{
|
||||
return __sync_val_compare_and_swap(ptr, old_value, new_value) != old_value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int android_atomic_acquire_cas(int32_t old_value,
|
||||
int32_t new_value,
|
||||
|
@ -131,15 +91,6 @@ int android_atomic_acquire_cas(int32_t old_value,
|
|||
return status;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_acquire_cas64(int64_t old_value, int64_t new_value,
|
||||
volatile int64_t *ptr)
|
||||
{
|
||||
int status = android_atomic_cas64(old_value, new_value, ptr);
|
||||
android_memory_barrier();
|
||||
return status;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int android_atomic_release_cas(int32_t old_value,
|
||||
int32_t new_value,
|
||||
|
@ -149,14 +100,6 @@ int android_atomic_release_cas(int32_t old_value,
|
|||
return android_atomic_cas(old_value, new_value, ptr);
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_release_cas64(int64_t old_value, int64_t new_value,
|
||||
volatile int64_t *ptr)
|
||||
{
|
||||
android_memory_barrier();
|
||||
return android_atomic_cas64(old_value, new_value, ptr);
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int32_t android_atomic_add(int32_t increment, volatile int32_t *ptr)
|
||||
{
|
||||
|
|
|
@ -33,19 +33,11 @@ extern ANDROID_ATOMIC_INLINE void android_memory_barrier(void)
|
|||
{
|
||||
android_compiler_barrier();
|
||||
}
|
||||
extern ANDROID_ATOMIC_INLINE void android_memory_store_barrier(void)
|
||||
{
|
||||
android_compiler_barrier();
|
||||
}
|
||||
#else
|
||||
extern ANDROID_ATOMIC_INLINE void android_memory_barrier(void)
|
||||
{
|
||||
__asm__ __volatile__ ("mfence" : : : "memory");
|
||||
}
|
||||
extern ANDROID_ATOMIC_INLINE void android_memory_store_barrier(void)
|
||||
{
|
||||
android_compiler_barrier();
|
||||
}
|
||||
#endif
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE int32_t
|
||||
|
|
|
@ -46,11 +46,6 @@ void android_memory_barrier(void)
|
|||
{
|
||||
__asm__ __volatile__ ("mfence" : : : "memory");
|
||||
}
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_memory_store_barrier(void)
|
||||
{
|
||||
android_compiler_barrier();
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int32_t android_atomic_acquire_load(volatile const int32_t *ptr)
|
||||
|
@ -60,14 +55,6 @@ int32_t android_atomic_acquire_load(volatile const int32_t *ptr)
|
|||
return value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_acquire_load64(volatile const int64_t *ptr)
|
||||
{
|
||||
int64_t value = *ptr;
|
||||
android_compiler_barrier();
|
||||
return value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int32_t android_atomic_release_load(volatile const int32_t *ptr)
|
||||
{
|
||||
|
@ -75,13 +62,6 @@ int32_t android_atomic_release_load(volatile const int32_t *ptr)
|
|||
return *ptr;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_release_load64(volatile const int64_t *ptr)
|
||||
{
|
||||
android_memory_barrier();
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_atomic_acquire_store(int32_t value, volatile int32_t *ptr)
|
||||
{
|
||||
|
@ -89,13 +69,6 @@ void android_atomic_acquire_store(int32_t value, volatile int32_t *ptr)
|
|||
android_memory_barrier();
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_atomic_acquire_store64(int64_t value, volatile int64_t *ptr)
|
||||
{
|
||||
*ptr = value;
|
||||
android_memory_barrier();
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_atomic_release_store(int32_t value, volatile int32_t *ptr)
|
||||
{
|
||||
|
@ -103,13 +76,6 @@ void android_atomic_release_store(int32_t value, volatile int32_t *ptr)
|
|||
*ptr = value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
void android_atomic_release_store64(int64_t value, volatile int64_t *ptr)
|
||||
{
|
||||
android_compiler_barrier();
|
||||
*ptr = value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int android_atomic_cas(int32_t old_value, int32_t new_value,
|
||||
volatile int32_t *ptr)
|
||||
|
@ -122,18 +88,6 @@ int android_atomic_cas(int32_t old_value, int32_t new_value,
|
|||
return prev != old_value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_cas64(int64_t old_value, int64_t new_value,
|
||||
volatile int64_t *ptr)
|
||||
{
|
||||
int64_t prev;
|
||||
__asm__ __volatile__ ("lock; cmpxchgq %1, %2"
|
||||
: "=a" (prev)
|
||||
: "q" (new_value), "m" (*ptr), "0" (old_value)
|
||||
: "memory");
|
||||
return prev != old_value;
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int android_atomic_acquire_cas(int32_t old_value, int32_t new_value,
|
||||
volatile int32_t *ptr)
|
||||
|
@ -142,14 +96,6 @@ int android_atomic_acquire_cas(int32_t old_value, int32_t new_value,
|
|||
return android_atomic_cas(old_value, new_value, ptr);
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_acquire_cas64(int64_t old_value, int64_t new_value,
|
||||
volatile int64_t *ptr)
|
||||
{
|
||||
/* Loads are not reordered with other loads. */
|
||||
return android_atomic_cas64(old_value, new_value, ptr);
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int android_atomic_release_cas(int32_t old_value, int32_t new_value,
|
||||
volatile int32_t *ptr)
|
||||
|
@ -158,14 +104,6 @@ int android_atomic_release_cas(int32_t old_value, int32_t new_value,
|
|||
return android_atomic_cas(old_value, new_value, ptr);
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int64_t android_atomic_release_cas64(int64_t old_value, int64_t new_value,
|
||||
volatile int64_t *ptr)
|
||||
{
|
||||
/* Stores are not reordered with other stores. */
|
||||
return android_atomic_cas64(old_value, new_value, ptr);
|
||||
}
|
||||
|
||||
extern ANDROID_ATOMIC_INLINE
|
||||
int32_t android_atomic_add(int32_t increment, volatile int32_t *ptr)
|
||||
{
|
||||
|
|
|
@ -103,11 +103,6 @@ int32_t android_atomic_or(int32_t value, volatile int32_t* addr);
|
|||
int32_t android_atomic_acquire_load(volatile const int32_t* addr);
|
||||
int32_t android_atomic_release_load(volatile const int32_t* addr);
|
||||
|
||||
#if defined (__LP64__)
|
||||
int64_t android_atomic_acquire_load64(volatile const int64_t* addr);
|
||||
int64_t android_atomic_release_load64(volatile const int64_t* addr);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Perform an atomic store with "acquire" or "release" ordering.
|
||||
*
|
||||
|
@ -125,11 +120,6 @@ int64_t android_atomic_release_load64(volatile const int64_t* addr);
|
|||
void android_atomic_acquire_store(int32_t value, volatile int32_t* addr);
|
||||
void android_atomic_release_store(int32_t value, volatile int32_t* addr);
|
||||
|
||||
#if defined (__LP64__)
|
||||
void android_atomic_acquire_store64(int64_t value, volatile int64_t* addr);
|
||||
void android_atomic_release_store64(int64_t value, volatile int64_t* addr);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compare-and-set operation with "acquire" or "release" ordering.
|
||||
*
|
||||
|
@ -147,13 +137,6 @@ int android_atomic_acquire_cas(int32_t oldvalue, int32_t newvalue,
|
|||
int android_atomic_release_cas(int32_t oldvalue, int32_t newvalue,
|
||||
volatile int32_t* addr);
|
||||
|
||||
#if defined (__LP64__)
|
||||
int64_t android_atomic_acquire_cas64(int64_t old_value, int64_t new_value,
|
||||
volatile int64_t *ptr);
|
||||
int64_t android_atomic_release_cas64(int64_t old_value, int64_t new_value,
|
||||
volatile int64_t *ptr);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Aliases for code using an older version of this header. These are now
|
||||
* deprecated and should not be used. The definitions will be removed
|
||||
|
|
Loading…
Reference in New Issue