Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
9efebb32
Commit
9efebb32
authored
Aug 06, 2014
by
jieluo@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use #undef instead of change the name of MemoryBarrier
parent
8d6f04ad
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
57 additions
and
56 deletions
+57
-56
atomicops.h
src/google/protobuf/stubs/atomicops.h
+4
-3
atomicops_internals_arm64_gcc.h
src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h
+13
-13
atomicops_internals_arm_gcc.h
src/google/protobuf/stubs/atomicops_internals_arm_gcc.h
+5
-5
atomicops_internals_arm_qnx.h
src/google/protobuf/stubs/atomicops_internals_arm_qnx.h
+5
-5
atomicops_internals_macosx.h
src/google/protobuf/stubs/atomicops_internals_macosx.h
+9
-9
atomicops_internals_mips_gcc.h
src/google/protobuf/stubs/atomicops_internals_mips_gcc.h
+7
-7
atomicops_internals_pnacl.h
src/google/protobuf/stubs/atomicops_internals_pnacl.h
+4
-4
atomicops_internals_tsan.h
src/google/protobuf/stubs/atomicops_internals_tsan.h
+1
-1
atomicops_internals_x86_gcc.h
src/google/protobuf/stubs/atomicops_internals_x86_gcc.h
+6
-6
atomicops_internals_x86_msvc.cc
src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc
+1
-1
atomicops_internals_x86_msvc.h
src/google/protobuf/stubs/atomicops_internals_x86_msvc.h
+2
-2
No files found.
src/google/protobuf/stubs/atomicops.h
View file @
9efebb32
...
...
@@ -111,8 +111,8 @@ Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
// ensure that no later memory access can be reordered ahead of the operation.
// "Release" operations ensure that no previous memory access can be reordered
// after the operation. "Barrier" operations have both "Acquire" and "Release"
// semantics. A MemoryBarrier
Internal() has "Barrier" semantics, but does no
//
memory
access.
// semantics. A MemoryBarrier
() has "Barrier" semantics, but does no memory
// access.
Atomic32
Acquire_CompareAndSwap
(
volatile
Atomic32
*
ptr
,
Atomic32
old_value
,
Atomic32
new_value
);
...
...
@@ -120,7 +120,8 @@ Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr,
Atomic32
old_value
,
Atomic32
new_value
);
void
MemoryBarrierInternal
();
#undef MemoryBarrier
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
);
...
...
src/google/protobuf/stubs/atomicops_internals_arm64_gcc.h
View file @
9efebb32
...
...
@@ -37,7 +37,7 @@ namespace google {
namespace
protobuf
{
namespace
internal
{
inline
void
MemoryBarrier
Internal
()
{
inline
void
MemoryBarrier
()
{
__asm__
__volatile__
(
"dmb ish"
:::
"memory"
);
// NOLINT
}
...
...
@@ -117,9 +117,9 @@ inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
inline
Atomic32
Barrier_AtomicIncrement
(
volatile
Atomic32
*
ptr
,
Atomic32
increment
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
Atomic32
result
=
NoBarrier_AtomicIncrement
(
ptr
,
increment
);
MemoryBarrier
Internal
();
MemoryBarrier
();
return
result
;
}
...
...
@@ -128,7 +128,7 @@ inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
Atomic32
old_value
,
Atomic32
new_value
)
{
Atomic32
prev
=
NoBarrier_CompareAndSwap
(
ptr
,
old_value
,
new_value
);
MemoryBarrier
Internal
();
MemoryBarrier
();
return
prev
;
}
...
...
@@ -136,7 +136,7 @@ inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
inline
Atomic32
Release_CompareAndSwap
(
volatile
Atomic32
*
ptr
,
Atomic32
old_value
,
Atomic32
new_value
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
Atomic32
prev
=
NoBarrier_CompareAndSwap
(
ptr
,
old_value
,
new_value
);
return
prev
;
...
...
@@ -148,7 +148,7 @@ inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
inline
void
Acquire_Store
(
volatile
Atomic32
*
ptr
,
Atomic32
value
)
{
*
ptr
=
value
;
MemoryBarrier
Internal
();
MemoryBarrier
();
}
inline
void
Release_Store
(
volatile
Atomic32
*
ptr
,
Atomic32
value
)
{
...
...
@@ -178,7 +178,7 @@ inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
}
inline
Atomic32
Release_Load
(
volatile
const
Atomic32
*
ptr
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
return
*
ptr
;
}
...
...
@@ -253,9 +253,9 @@ inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
inline
Atomic64
Barrier_AtomicIncrement
(
volatile
Atomic64
*
ptr
,
Atomic64
increment
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
Atomic64
result
=
NoBarrier_AtomicIncrement
(
ptr
,
increment
);
MemoryBarrier
Internal
();
MemoryBarrier
();
return
result
;
}
...
...
@@ -264,7 +264,7 @@ inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
Atomic64
old_value
,
Atomic64
new_value
)
{
Atomic64
prev
=
NoBarrier_CompareAndSwap
(
ptr
,
old_value
,
new_value
);
MemoryBarrier
Internal
();
MemoryBarrier
();
return
prev
;
}
...
...
@@ -272,7 +272,7 @@ inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr,
inline
Atomic64
Release_CompareAndSwap
(
volatile
Atomic64
*
ptr
,
Atomic64
old_value
,
Atomic64
new_value
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
Atomic64
prev
=
NoBarrier_CompareAndSwap
(
ptr
,
old_value
,
new_value
);
return
prev
;
...
...
@@ -284,7 +284,7 @@ inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
inline
void
Acquire_Store
(
volatile
Atomic64
*
ptr
,
Atomic64
value
)
{
*
ptr
=
value
;
MemoryBarrier
Internal
();
MemoryBarrier
();
}
inline
void
Release_Store
(
volatile
Atomic64
*
ptr
,
Atomic64
value
)
{
...
...
@@ -314,7 +314,7 @@ inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
}
inline
Atomic64
Release_Load
(
volatile
const
Atomic64
*
ptr
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
return
*
ptr
;
}
...
...
src/google/protobuf/stubs/atomicops_internals_arm_gcc.h
View file @
9efebb32
...
...
@@ -115,17 +115,17 @@ inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
*
ptr
=
value
;
}
inline
void
MemoryBarrier
Internal
()
{
inline
void
MemoryBarrier
()
{
pLinuxKernelMemoryBarrier
();
}
inline
void
Acquire_Store
(
volatile
Atomic32
*
ptr
,
Atomic32
value
)
{
*
ptr
=
value
;
MemoryBarrier
Internal
();
MemoryBarrier
();
}
inline
void
Release_Store
(
volatile
Atomic32
*
ptr
,
Atomic32
value
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
*
ptr
=
value
;
}
...
...
@@ -135,12 +135,12 @@ inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
inline
Atomic32
Acquire_Load
(
volatile
const
Atomic32
*
ptr
)
{
Atomic32
value
=
*
ptr
;
MemoryBarrier
Internal
();
MemoryBarrier
();
return
value
;
}
inline
Atomic32
Release_Load
(
volatile
const
Atomic32
*
ptr
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
return
*
ptr
;
}
...
...
src/google/protobuf/stubs/atomicops_internals_arm_qnx.h
View file @
9efebb32
...
...
@@ -110,17 +110,17 @@ inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
*
ptr
=
value
;
}
inline
void
MemoryBarrier
Internal
()
{
inline
void
MemoryBarrier
()
{
__sync_synchronize
();
}
inline
void
Acquire_Store
(
volatile
Atomic32
*
ptr
,
Atomic32
value
)
{
*
ptr
=
value
;
MemoryBarrier
Internal
();
MemoryBarrier
();
}
inline
void
Release_Store
(
volatile
Atomic32
*
ptr
,
Atomic32
value
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
*
ptr
=
value
;
}
...
...
@@ -130,12 +130,12 @@ inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
inline
Atomic32
Acquire_Load
(
volatile
const
Atomic32
*
ptr
)
{
Atomic32
value
=
*
ptr
;
MemoryBarrier
Internal
();
MemoryBarrier
();
return
value
;
}
inline
Atomic32
Release_Load
(
volatile
const
Atomic32
*
ptr
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
return
*
ptr
;
}
...
...
src/google/protobuf/stubs/atomicops_internals_macosx.h
View file @
9efebb32
...
...
@@ -73,7 +73,7 @@ inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
return
OSAtomicAdd32Barrier
(
increment
,
const_cast
<
Atomic32
*>
(
ptr
));
}
inline
void
MemoryBarrier
Internal
()
{
inline
void
MemoryBarrier
()
{
OSMemoryBarrier
();
}
...
...
@@ -103,11 +103,11 @@ inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
inline
void
Acquire_Store
(
volatile
Atomic32
*
ptr
,
Atomic32
value
)
{
*
ptr
=
value
;
MemoryBarrier
Internal
();
MemoryBarrier
();
}
inline
void
Release_Store
(
volatile
Atomic32
*
ptr
,
Atomic32
value
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
*
ptr
=
value
;
}
...
...
@@ -117,12 +117,12 @@ inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
inline
Atomic32
Acquire_Load
(
volatile
const
Atomic32
*
ptr
)
{
Atomic32
value
=
*
ptr
;
MemoryBarrier
Internal
();
MemoryBarrier
();
return
value
;
}
inline
Atomic32
Release_Load
(
volatile
const
Atomic32
*
ptr
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
return
*
ptr
;
}
...
...
@@ -193,11 +193,11 @@ inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
inline
void
Acquire_Store
(
volatile
Atomic64
*
ptr
,
Atomic64
value
)
{
*
ptr
=
value
;
MemoryBarrier
Internal
();
MemoryBarrier
();
}
inline
void
Release_Store
(
volatile
Atomic64
*
ptr
,
Atomic64
value
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
*
ptr
=
value
;
}
...
...
@@ -207,12 +207,12 @@ inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) {
inline
Atomic64
Acquire_Load
(
volatile
const
Atomic64
*
ptr
)
{
Atomic64
value
=
*
ptr
;
MemoryBarrier
Internal
();
MemoryBarrier
();
return
value
;
}
inline
Atomic64
Release_Load
(
volatile
const
Atomic64
*
ptr
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
return
*
ptr
;
}
...
...
src/google/protobuf/stubs/atomicops_internals_mips_gcc.h
View file @
9efebb32
...
...
@@ -125,8 +125,8 @@ inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
// ensure that no later memory access can be reordered ahead of the operation.
// "Release" operations ensure that no previous memory access can be reordered
// after the operation. "Barrier" operations have both "Acquire" and "Release"
// semantics. A MemoryBarrier
Internal() has "Barrier" semantics, but does no
//
memory
access.
// semantics. A MemoryBarrier
() has "Barrier" semantics, but does no memory
// access.
inline
Atomic32
Acquire_CompareAndSwap
(
volatile
Atomic32
*
ptr
,
Atomic32
old_value
,
Atomic32
new_value
)
{
...
...
@@ -149,17 +149,17 @@ inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
*
ptr
=
value
;
}
inline
void
MemoryBarrier
Internal
()
{
inline
void
MemoryBarrier
()
{
__asm__
__volatile__
(
"sync"
:
:
:
"memory"
);
}
inline
void
Acquire_Store
(
volatile
Atomic32
*
ptr
,
Atomic32
value
)
{
*
ptr
=
value
;
MemoryBarrier
Internal
();
MemoryBarrier
();
}
inline
void
Release_Store
(
volatile
Atomic32
*
ptr
,
Atomic32
value
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
*
ptr
=
value
;
}
...
...
@@ -169,12 +169,12 @@ inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) {
inline
Atomic32
Acquire_Load
(
volatile
const
Atomic32
*
ptr
)
{
Atomic32
value
=
*
ptr
;
MemoryBarrier
Internal
();
MemoryBarrier
();
return
value
;
}
inline
Atomic32
Release_Load
(
volatile
const
Atomic32
*
ptr
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
return
*
ptr
;
}
...
...
src/google/protobuf/stubs/atomicops_internals_pnacl.h
View file @
9efebb32
...
...
@@ -43,7 +43,7 @@ inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
return
__sync_val_compare_and_swap
(
ptr
,
old_value
,
new_value
);
}
inline
void
MemoryBarrier
Internal
()
{
inline
void
MemoryBarrier
()
{
__sync_synchronize
();
}
...
...
@@ -51,18 +51,18 @@ inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
Atomic32
old_value
,
Atomic32
new_value
)
{
Atomic32
ret
=
NoBarrier_CompareAndSwap
(
ptr
,
old_value
,
new_value
);
MemoryBarrier
Internal
();
MemoryBarrier
();
return
ret
;
}
inline
void
Release_Store
(
volatile
Atomic32
*
ptr
,
Atomic32
value
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
*
ptr
=
value
;
}
inline
Atomic32
Acquire_Load
(
volatile
const
Atomic32
*
ptr
)
{
Atomic32
value
=
*
ptr
;
MemoryBarrier
Internal
();
MemoryBarrier
();
return
value
;
}
...
...
src/google/protobuf/stubs/atomicops_internals_tsan.h
View file @
9efebb32
...
...
@@ -206,7 +206,7 @@ inline Atomic64 Release_CompareAndSwap(volatile Atomic64 *ptr,
return
cmp
;
}
inline
void
MemoryBarrier
Internal
()
{
inline
void
MemoryBarrier
()
{
__tsan_atomic_thread_fence
(
__tsan_memory_order_seq_cst
);
}
...
...
src/google/protobuf/stubs/atomicops_internals_x86_gcc.h
View file @
9efebb32
...
...
@@ -119,18 +119,18 @@ inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) {
// 64-bit implementations of memory barrier can be simpler, because it
// "mfence" is guaranteed to exist.
inline
void
MemoryBarrier
Internal
()
{
inline
void
MemoryBarrier
()
{
__asm__
__volatile__
(
"mfence"
:
:
:
"memory"
);
}
inline
void
Acquire_Store
(
volatile
Atomic32
*
ptr
,
Atomic32
value
)
{
*
ptr
=
value
;
MemoryBarrier
Internal
();
MemoryBarrier
();
}
#else
inline
void
MemoryBarrier
Internal
()
{
inline
void
MemoryBarrier
()
{
if
(
AtomicOps_Internalx86CPUFeatures
.
has_sse2
)
{
__asm__
__volatile__
(
"mfence"
:
:
:
"memory"
);
}
else
{
// mfence is faster but not present on PIII
...
...
@@ -168,7 +168,7 @@ inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
}
inline
Atomic32
Release_Load
(
volatile
const
Atomic32
*
ptr
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
return
*
ptr
;
}
...
...
@@ -225,7 +225,7 @@ inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) {
inline
void
Acquire_Store
(
volatile
Atomic64
*
ptr
,
Atomic64
value
)
{
*
ptr
=
value
;
MemoryBarrier
Internal
();
MemoryBarrier
();
}
inline
void
Release_Store
(
volatile
Atomic64
*
ptr
,
Atomic64
value
)
{
...
...
@@ -262,7 +262,7 @@ inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
}
inline
Atomic64
Release_Load
(
volatile
const
Atomic64
*
ptr
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
return
*
ptr
;
}
...
...
src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc
View file @
9efebb32
...
...
@@ -44,7 +44,7 @@ namespace google {
namespace
protobuf
{
namespace
internal
{
inline
void
MemoryBarrier
Internal
()
{
inline
void
MemoryBarrier
()
{
// We use MemoryBarrier from WinNT.h
::
MemoryBarrier
();
}
...
...
src/google/protobuf/stubs/atomicops_internals_x86_msvc.h
View file @
9efebb32
...
...
@@ -82,7 +82,7 @@ inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
}
inline
Atomic32
Release_Load
(
volatile
const
Atomic32
*
ptr
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
return
*
ptr
;
}
...
...
@@ -125,7 +125,7 @@ inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
}
inline
Atomic64
Release_Load
(
volatile
const
Atomic64
*
ptr
)
{
MemoryBarrier
Internal
();
MemoryBarrier
();
return
*
ptr
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment