diff options
author | xiaofeng@google.com <xiaofeng@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2014-05-05 22:06:41 +0000 |
---|---|---|
committer | xiaofeng@google.com <xiaofeng@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2014-05-05 22:06:41 +0000 |
commit | e7f2937962283d69fd1153ebca46b615fca4a2a2 (patch) | |
tree | be0bcb98fd5b7aa927b541aeff8349818b0ea271 | |
parent | 3aa5ea95a9f10cc64bcaeac47291913e52c3eac7 (diff) |
Fix a bug in Arm64 atomicops. (https://codereview.appspot.com/88800045/)
-rw-r--r-- | src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h b/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h index b852c43c..fe9727ad 100644 --- a/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h +++ b/src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h @@ -117,10 +117,8 @@ inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment) { - Atomic32 result; - MemoryBarrier(); - result = NoBarrier_AtomicIncrement(ptr, increment); + Atomic32 result = NoBarrier_AtomicIncrement(ptr, increment); MemoryBarrier(); return result; @@ -129,9 +127,7 @@ inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, Atomic32 old_value, Atomic32 new_value) { - Atomic32 prev; - - prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value); + Atomic32 prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value); MemoryBarrier(); return prev; @@ -140,10 +136,8 @@ inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, Atomic32 old_value, Atomic32 new_value) { - Atomic32 prev; - MemoryBarrier(); - prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value); + Atomic32 prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value); return prev; } @@ -259,10 +253,8 @@ inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment) { - Atomic64 result; - MemoryBarrier(); - result = NoBarrier_AtomicIncrement(ptr, increment); + Atomic64 result = NoBarrier_AtomicIncrement(ptr, increment); MemoryBarrier(); return result; @@ -271,9 +263,7 @@ inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, Atomic64 old_value, Atomic64 new_value) { - Atomic64 prev; - - prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value); + Atomic64 prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value); MemoryBarrier(); return prev; @@ -282,10 +272,8 @@ inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, Atomic64 old_value, Atomic64 new_value) { - Atomic64 prev; - MemoryBarrier(); - prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value); + Atomic64 prev = NoBarrier_CompareAndSwap(ptr, old_value, new_value); return prev; } @@ -313,7 +301,7 @@ inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { } inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { - Atomic32 value; + Atomic64 value; __asm__ __volatile__ ( // NOLINT "ldar %x[value], %[ptr] \n\t" |