Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Acquire_Store() and Release_Load() functions #28

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/google/protobuf/stubs/atomicops.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,10 @@ Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
#endif
void MemoryBarrier();
void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value);
void Acquire_Store(volatile Atomic32* ptr, Atomic32 value);
void Release_Store(volatile Atomic32* ptr, Atomic32 value);

Atomic32 NoBarrier_Load(volatile const Atomic32* ptr);
Atomic32 Acquire_Load(volatile const Atomic32* ptr);
Atomic32 Release_Load(volatile const Atomic32* ptr);

// 64-bit atomic operations (only available on 64-bit processors).
#ifdef GOOGLE_PROTOBUF_ARCH_64_BIT
Expand All @@ -148,11 +146,9 @@ Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr,
Atomic64 old_value,
Atomic64 new_value);
void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value);
void Acquire_Store(volatile Atomic64* ptr, Atomic64 value);
void Release_Store(volatile Atomic64* ptr, Atomic64 value);
Atomic64 NoBarrier_Load(volatile const Atomic64* ptr);
Atomic64 Acquire_Load(volatile const Atomic64* ptr);
Atomic64 Release_Load(volatile const Atomic64* ptr);
#endif // GOOGLE_PROTOBUF_ARCH_64_BIT

} // namespace internal
Expand Down Expand Up @@ -192,9 +188,14 @@ GOOGLE_PROTOBUF_ATOMICOPS_ERROR
#include <google/protobuf/stubs/atomicops_internals_mips_gcc.h>
#elif defined(__native_client__)
#include <google/protobuf/stubs/atomicops_internals_pnacl.h>
#elif (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)) || \
(defined(__clang__) && __has_extension(c_atomic))
#elif (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4))
#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
#elif defined(__clang__)
#if __has_extension(c_atomic)
#include <google/protobuf/stubs/atomicops_internals_generic_gcc.h>
#else
GOOGLE_PROTOBUF_ATOMICOPS_ERROR
#endif
#else
GOOGLE_PROTOBUF_ATOMICOPS_ERROR
#endif
Expand Down
20 changes: 0 additions & 20 deletions src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
*ptr = value;
}

inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
*ptr = value;
MemoryBarrier();
}

inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
__asm__ __volatile__ ( // NOLINT
"stlr %w[value], %[ptr] \n\t"
Expand All @@ -177,11 +172,6 @@ inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
return value;
}

inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
MemoryBarrier();
return *ptr;
}

// 64-bit versions of the operations.
// See the 32-bit versions for comments.

Expand Down Expand Up @@ -282,11 +272,6 @@ inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
*ptr = value;
}

inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
*ptr = value;
MemoryBarrier();
}

inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
__asm__ __volatile__ ( // NOLINT
"stlr %x[value], %[ptr] \n\t"
Expand All @@ -313,11 +298,6 @@ inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
return value;
}

inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
MemoryBarrier();
return *ptr;
}

} // namespace internal
} // namespace protobuf
} // namespace google
Expand Down
10 changes: 0 additions & 10 deletions src/google/protobuf/stubs/atomicops_internals_arm_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ inline void MemoryBarrier() {
pLinuxKernelMemoryBarrier();
}

inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
*ptr = value;
MemoryBarrier();
}

inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
MemoryBarrier();
*ptr = value;
Expand All @@ -139,11 +134,6 @@ inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
return value;
}

inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
MemoryBarrier();
return *ptr;
}

} // namespace internal
} // namespace protobuf
} // namespace google
Expand Down
10 changes: 0 additions & 10 deletions src/google/protobuf/stubs/atomicops_internals_arm_qnx.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ inline void MemoryBarrier() {
__sync_synchronize();
}

inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
*ptr = value;
MemoryBarrier();
}

inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
MemoryBarrier();
*ptr = value;
Expand All @@ -134,11 +129,6 @@ inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
return value;
}

inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
MemoryBarrier();
return *ptr;
}

} // namespace internal
} // namespace protobuf
} // namespace google
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ inline void NoBarrier_Store(volatile AtomicWord *ptr, AtomicWord value) {
NoBarrier_Store(reinterpret_cast<volatile Atomic32*>(ptr), value);
}

inline void Acquire_Store(volatile AtomicWord* ptr, AtomicWord value) {
return Acquire_Store(reinterpret_cast<volatile Atomic32*>(ptr), value);
}

inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) {
return Release_Store(reinterpret_cast<volatile Atomic32*>(ptr), value);
}
Expand All @@ -109,10 +105,6 @@ inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) {
return Acquire_Load(reinterpret_cast<volatile const Atomic32*>(ptr));
}

inline AtomicWord Release_Load(volatile const AtomicWord* ptr) {
return Release_Load(reinterpret_cast<volatile const Atomic32*>(ptr));
}

} // namespace internal
} // namespace protobuf
} // namespace google
Expand Down
8 changes: 0 additions & 8 deletions src/google/protobuf/stubs/atomicops_internals_generic_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ inline void MemoryBarrier() {
__sync_synchronize();
}

inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
__atomic_store_n(ptr, value, __ATOMIC_ACQUIRE);
}

inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
__atomic_store_n(ptr, value, __ATOMIC_RELEASE);
}
Expand All @@ -98,10 +94,6 @@ inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
return __atomic_load_n(ptr, __ATOMIC_ACQUIRE);
}

inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
return __atomic_load_n(ptr, __ATOMIC_RELEASE);
}

#ifdef __LP64__

inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
Expand Down
20 changes: 0 additions & 20 deletions src/google/protobuf/stubs/atomicops_internals_macosx.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@ inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
*ptr = value;
}

inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
*ptr = value;
MemoryBarrier();
}

inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
MemoryBarrier();
*ptr = value;
Expand All @@ -121,11 +116,6 @@ inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
return value;
}

inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
MemoryBarrier();
return *ptr;
}

#ifdef __LP64__

// 64-bit implementation on 64-bit platform
Expand Down Expand Up @@ -191,11 +181,6 @@ inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
*ptr = value;
}

inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
*ptr = value;
MemoryBarrier();
}

inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
MemoryBarrier();
*ptr = value;
Expand All @@ -211,11 +196,6 @@ inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
return value;
}

inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
MemoryBarrier();
return *ptr;
}

#endif // defined(__LP64__)

} // namespace internal
Expand Down
19 changes: 0 additions & 19 deletions src/google/protobuf/stubs/atomicops_internals_mips_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,6 @@ inline void MemoryBarrier() {
__asm__ __volatile__("sync" : : : "memory");
}

inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
*ptr = value;
MemoryBarrier();
}

inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
MemoryBarrier();
*ptr = value;
Expand All @@ -173,11 +168,6 @@ inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
return value;
}

inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
MemoryBarrier();
return *ptr;
}

#if defined(__LP64__)
// 64-bit versions of the atomic ops.

Expand Down Expand Up @@ -278,11 +268,6 @@ inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
*ptr = value;
}

inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
*ptr = value;
MemoryBarrier();
}

inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
MemoryBarrier();
*ptr = value;
Expand All @@ -298,10 +283,6 @@ inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
return value;
}

inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
MemoryBarrier();
return *ptr;
}
#endif

} // namespace internal
Expand Down
20 changes: 0 additions & 20 deletions src/google/protobuf/stubs/atomicops_internals_tsan.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ inline void NoBarrier_Store(volatile Atomic32 *ptr, Atomic32 value) {
__tsan_atomic32_store(ptr, value, __tsan_memory_order_relaxed);
}

inline void Acquire_Store(volatile Atomic32 *ptr, Atomic32 value) {
__tsan_atomic32_store(ptr, value, __tsan_memory_order_relaxed);
__tsan_atomic_thread_fence(__tsan_memory_order_seq_cst);
}

inline void Release_Store(volatile Atomic32 *ptr, Atomic32 value) {
__tsan_atomic32_store(ptr, value, __tsan_memory_order_release);
}
Expand All @@ -121,11 +116,6 @@ inline Atomic32 Acquire_Load(volatile const Atomic32 *ptr) {
return __tsan_atomic32_load(ptr, __tsan_memory_order_acquire);
}

inline Atomic32 Release_Load(volatile const Atomic32 *ptr) {
__tsan_atomic_thread_fence(__tsan_memory_order_seq_cst);
return __tsan_atomic32_load(ptr, __tsan_memory_order_relaxed);
}

inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64 *ptr,
Atomic64 old_value,
Atomic64 new_value) {
Expand Down Expand Up @@ -166,11 +156,6 @@ inline void NoBarrier_Store(volatile Atomic64 *ptr, Atomic64 value) {
__tsan_atomic64_store(ptr, value, __tsan_memory_order_relaxed);
}

inline void Acquire_Store(volatile Atomic64 *ptr, Atomic64 value) {
__tsan_atomic64_store(ptr, value, __tsan_memory_order_relaxed);
__tsan_atomic_thread_fence(__tsan_memory_order_seq_cst);
}

inline void Release_Store(volatile Atomic64 *ptr, Atomic64 value) {
__tsan_atomic64_store(ptr, value, __tsan_memory_order_release);
}
Expand All @@ -183,11 +168,6 @@ inline Atomic64 Acquire_Load(volatile const Atomic64 *ptr) {
return __tsan_atomic64_load(ptr, __tsan_memory_order_acquire);
}

inline Atomic64 Release_Load(volatile const Atomic64 *ptr) {
__tsan_atomic_thread_fence(__tsan_memory_order_seq_cst);
return __tsan_atomic64_load(ptr, __tsan_memory_order_relaxed);
}

inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64 *ptr,
Atomic64 old_value,
Atomic64 new_value) {
Expand Down
29 changes: 0 additions & 29 deletions src/google/protobuf/stubs/atomicops_internals_x86_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,6 @@ inline void MemoryBarrier() {
__asm__ __volatile__("mfence" : : : "memory");
}

inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
*ptr = value;
MemoryBarrier();
}

#else

inline void MemoryBarrier() {
Expand All @@ -139,15 +134,6 @@ inline void MemoryBarrier() {
}
}

inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) {
if (AtomicOps_Internalx86CPUFeatures.has_sse2) {
*ptr = value;
__asm__ __volatile__("mfence" : : : "memory");
} else {
NoBarrier_AtomicExchange(ptr, value);
// acts as a barrier on PIII
}
}
#endif

inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
Expand All @@ -167,11 +153,6 @@ inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
return value;
}

inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
MemoryBarrier();
return *ptr;
}

#if defined(__x86_64__)

// 64-bit low-level operations on 64-bit platform.
Expand Down Expand Up @@ -223,11 +204,6 @@ inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
*ptr = value;
}

inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) {
*ptr = value;
MemoryBarrier();
}

inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) {
ATOMICOPS_COMPILER_BARRIER();

Expand Down Expand Up @@ -261,11 +237,6 @@ inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
return value;
}

inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
MemoryBarrier();
return *ptr;
}

inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
Atomic64 old_value,
Atomic64 new_value) {
Expand Down
Loading