am df2f5a07: am d55f0adf: Qualify the source argument of atomic loads as a const pointer.

Merge commit 'df2f5a07aecac7be4ac2d1100668a0396fd256e7'

* commit 'df2f5a07aecac7be4ac2d1100668a0396fd256e7':
  Qualify the source argument of atomic loads as a const pointer.
This commit is contained in:
Carl Shapiro 2010-09-28 17:38:03 -07:00 committed by Android Git Automerger
commit a417657880
4 changed files with 22 additions and 14 deletions

View File

@ -65,14 +65,14 @@ extern inline void android_memory_store_barrier(void)
}
#endif
extern inline int32_t android_atomic_acquire_load(volatile int32_t *ptr)
extern inline int32_t android_atomic_acquire_load(volatile const int32_t *ptr)
{
int32_t value = *ptr;
android_memory_barrier();
return value;
}
extern inline int32_t android_atomic_release_load(volatile int32_t *ptr)
extern inline int32_t android_atomic_release_load(volatile const int32_t *ptr)
{
android_memory_barrier();
return *ptr;
@ -212,11 +212,13 @@ extern inline int32_t android_atomic_add(int32_t increment,
}
#endif
extern inline int32_t android_atomic_inc(volatile int32_t *addr) {
extern inline int32_t android_atomic_inc(volatile int32_t *addr)
{
return android_atomic_add(1, addr);
}
extern inline int32_t android_atomic_dec(volatile int32_t *addr) {
extern inline int32_t android_atomic_dec(volatile int32_t *addr)
{
return android_atomic_add(-1, addr);
}

View File

@ -44,25 +44,29 @@ extern inline void android_memory_store_barrier(void)
}
#endif
extern inline int32_t android_atomic_acquire_load(volatile int32_t *ptr) {
extern inline int32_t android_atomic_acquire_load(volatile const int32_t *ptr)
{
int32_t value = *ptr;
android_compiler_barrier();
return value;
}
extern inline int32_t android_atomic_release_load(volatile int32_t *ptr) {
extern inline int32_t android_atomic_release_load(volatile const int32_t *ptr)
{
android_memory_barrier();
return *ptr;
}
extern inline void android_atomic_acquire_store(int32_t value,
volatile int32_t *ptr) {
volatile int32_t *ptr)
{
*ptr = value;
android_memory_barrier();
}
extern inline void android_atomic_release_store(int32_t value,
volatile int32_t *ptr) {
volatile int32_t *ptr)
{
android_compiler_barrier();
*ptr = value;
}
@ -115,11 +119,13 @@ extern inline int32_t android_atomic_add(int32_t increment,
return increment;
}
extern inline int32_t android_atomic_inc(volatile int32_t *addr) {
extern inline int32_t android_atomic_inc(volatile int32_t *addr)
{
return android_atomic_add(1, addr);
}
extern inline int32_t android_atomic_dec(volatile int32_t *addr) {
extern inline int32_t android_atomic_dec(volatile int32_t *addr)
{
return android_atomic_add(-1, addr);
}

View File

@ -77,8 +77,8 @@ int32_t android_atomic_or(int32_t value, volatile int32_t* addr);
* This is only necessary if you need the memory barrier. A 32-bit read
* from a 32-bit aligned address is atomic on all supported platforms.
*/
int32_t android_atomic_acquire_load(volatile int32_t* addr);
int32_t android_atomic_release_load(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);
/*
* Perform an atomic store with "acquire" or "release" ordering.

View File

@ -49,12 +49,12 @@ static pthread_mutex_t _swap_locks[SWAP_LOCK_COUNT];
&_swap_locks[((unsigned)(void*)(addr) >> 3U) % SWAP_LOCK_COUNT]
int32_t android_atomic_acquire_load(volatile int32_t* addr)
int32_t android_atomic_acquire_load(volatile const int32_t* addr)
{
return *addr;
}
int32_t android_atomic_release_load(volatile int32_t* addr)
int32_t android_atomic_release_load(volatile const int32_t* addr)
{
return *addr;
}