author | Stacy Yeh <stacy.yeh@oracle.com> |
Tue, 19 Jul 2016 14:15:23 -0700 | |
changeset 6431 | e4667e7df088 |
permissions | -rw-r--r-- |
6431
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
1 |
Fixes issues in atomic operations. |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
2 |
Will not send upstream. |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
3 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
4 |
--- a/toolkit/components/protobuf/src/google/protobuf/stubs/atomicops_internals_solaris.h 2015-11-03 11:34:16.000000000 +0100 |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
5 |
+++ b/toolkit/components/protobuf/src/google/protobuf/stubs/atomicops_internals_solaris.h 2015-11-10 04:19:53.044083000 +0100 |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
6 |
@@ -1,5 +1,4 @@ |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
7 |
-// Copyright 2014 Google Inc. All rights reserved. |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
8 |
-// https://developers.google.com/protocol-buffers/ |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
9 |
+// Copyright 2013 Red Hat Inc. All rights reserved. |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
10 |
// |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
11 |
// Redistribution and use in source and binary forms, with or without |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
12 |
// modification, are permitted provided that the following conditions are |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
13 |
@@ -11,7 +10,7 @@ |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
14 |
// copyright notice, this list of conditions and the following disclaimer |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
15 |
// in the documentation and/or other materials provided with the |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
16 |
// distribution. |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
17 |
-// * Neither the name of Google Inc. nor the names of its |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
18 |
+// * Neither the name of Red Hat Inc. nor the names of its |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
19 |
// contributors may be used to endorse or promote products derived from |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
20 |
// this software without specific prior written permission. |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
21 |
// |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
22 |
@@ -29,10 +28,8 @@ |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
23 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
24 |
// This file is an internal atomic implementation, use atomicops.h instead. |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
25 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
26 |
-#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_SPARC_GCC_H_ |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
27 |
-#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_SPARC_GCC_H_ |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
28 |
- |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
29 |
-#include <atomic.h> |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
30 |
+#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_GCC_H_ |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
31 |
+#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_GCC_H_ |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
32 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
33 |
namespace google { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
34 |
namespace protobuf { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
35 |
@@ -41,148 +38,100 @@ |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
36 |
inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
37 |
Atomic32 old_value, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
38 |
Atomic32 new_value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
39 |
- return (Atomic32)atomic_cas_32((volatile uint32_t*)ptr, (uint32_t)old_value, (uint32_t)new_value); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
40 |
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, true, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
41 |
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
42 |
+ return old_value; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
43 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
44 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
45 |
inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
46 |
Atomic32 new_value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
47 |
- return (Atomic32)atomic_swap_32((volatile uint32_t*)ptr, (uint32_t)new_value); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
48 |
+ return __atomic_exchange_n(ptr, new_value, __ATOMIC_RELAXED); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
49 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
50 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
51 |
inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
52 |
Atomic32 increment) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
53 |
- return (Atomic32)atomic_add_32_nv((volatile uint32_t*)ptr, (uint32_t)increment); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
54 |
-} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
55 |
- |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
56 |
-inline void MemoryBarrier(void) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
57 |
- membar_producer(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
58 |
- membar_consumer(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
59 |
+ return __atomic_add_fetch(ptr, increment, __ATOMIC_RELAXED); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
60 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
61 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
62 |
inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
63 |
Atomic32 increment) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
64 |
- MemoryBarrier(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
65 |
- Atomic32 ret = NoBarrier_AtomicIncrement(ptr, increment); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
66 |
- MemoryBarrier(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
67 |
- |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
68 |
- return ret; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
69 |
+ return __atomic_add_fetch(ptr, increment, __ATOMIC_SEQ_CST); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
70 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
71 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
72 |
inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
73 |
Atomic32 old_value, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
74 |
Atomic32 new_value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
75 |
- Atomic32 ret = NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
76 |
- MemoryBarrier(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
77 |
- |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
78 |
- return ret; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
79 |
+ __atomic_compare_exchange(ptr, &old_value, &new_value, true, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
80 |
+ __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
81 |
+ return old_value; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
82 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
83 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
84 |
inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
85 |
Atomic32 old_value, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
86 |
Atomic32 new_value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
87 |
- MemoryBarrier(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
88 |
- return NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
89 |
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, true, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
90 |
+ __ATOMIC_RELEASE, __ATOMIC_ACQUIRE); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
91 |
+ return old_value; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
92 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
93 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
94 |
inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
95 |
- *ptr = value; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
96 |
+ __atomic_store_n(ptr, value, __ATOMIC_RELAXED); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
97 |
+} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
98 |
+ |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
99 |
+inline void MemoryBarrier() { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
100 |
+ __sync_synchronize(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
101 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
102 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
103 |
inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
104 |
- *ptr = value; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
105 |
- membar_producer(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
106 |
+ __atomic_store_n(ptr, value, __ATOMIC_SEQ_CST); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
107 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
108 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
109 |
inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
110 |
- membar_consumer(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
111 |
- *ptr = value; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
112 |
+ __atomic_store_n(ptr, value, __ATOMIC_RELEASE); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
113 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
114 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
115 |
inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
116 |
- return *ptr; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
117 |
+ return __atomic_load_n(ptr, __ATOMIC_RELAXED); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
118 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
119 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
120 |
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
121 |
- Atomic32 val = *ptr; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
122 |
- membar_consumer(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
123 |
- return val; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
124 |
+ return __atomic_load_n(ptr, __ATOMIC_ACQUIRE); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
125 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
126 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
127 |
inline Atomic32 Release_Load(volatile const Atomic32* ptr) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
128 |
- membar_producer(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
129 |
- return *ptr; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
130 |
+ return __atomic_load_n(ptr, __ATOMIC_SEQ_CST); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
131 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
132 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
133 |
-#ifdef GOOGLE_PROTOBUF_ARCH_64_BIT |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
134 |
-inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
135 |
- Atomic64 old_value, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
136 |
- Atomic64 new_value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
137 |
- return atomic_cas_64((volatile uint64_t*)ptr, (uint64_t)old_value, (uint64_t)new_value); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
138 |
-} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
139 |
+#ifdef __LP64__ |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
140 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
141 |
-inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
142 |
- return atomic_swap_64((volatile uint64_t*)ptr, (uint64_t)new_value); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
143 |
-} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
144 |
- |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
145 |
-inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
146 |
- return atomic_add_64_nv((volatile uint64_t*)ptr, increment); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
147 |
+inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
148 |
+ __atomic_store_n(ptr, value, __ATOMIC_RELEASE); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
149 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
150 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
151 |
-inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
152 |
- MemoryBarrier(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
153 |
- Atomic64 ret = atomic_add_64_nv((volatile uint64_t*)ptr, increment); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
154 |
- MemoryBarrier(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
155 |
- return ret; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
156 |
+inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
157 |
+ return __atomic_load_n(ptr, __ATOMIC_ACQUIRE); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
158 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
159 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
160 |
inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
161 |
Atomic64 old_value, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
162 |
Atomic64 new_value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
163 |
- Atomic64 ret = NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
164 |
- MemoryBarrier(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
165 |
- return ret; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
166 |
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, true, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
167 |
+ __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
168 |
+ return old_value; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
169 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
170 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
171 |
-inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
172 |
+inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
173 |
Atomic64 old_value, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
174 |
Atomic64 new_value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
175 |
- MemoryBarrier(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
176 |
- return NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
177 |
-} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
178 |
- |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
179 |
-inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
180 |
- *ptr = value; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
181 |
-} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
182 |
- |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
183 |
-inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
184 |
- *ptr = value; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
185 |
- membar_producer(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
186 |
+ __atomic_compare_exchange_n(ptr, &old_value, new_value, true, |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
187 |
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
188 |
+ return old_value; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
189 |
} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
190 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
191 |
-inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
192 |
- membar_consumer(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
193 |
- *ptr = value; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
194 |
-} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
195 |
- |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
196 |
-inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
197 |
- return *ptr; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
198 |
-} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
199 |
- |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
200 |
-inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
201 |
- Atomic64 ret = *ptr; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
202 |
- membar_consumer(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
203 |
- return ret; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
204 |
-} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
205 |
- |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
206 |
-inline Atomic64 Release_Load(volatile const Atomic64* ptr) { |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
207 |
- membar_producer(); |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
208 |
- return *ptr; |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
209 |
-} |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
210 |
-#endif |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
211 |
+#endif // defined(__LP64__) |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
212 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
213 |
} // namespace internal |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
214 |
} // namespace protobuf |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
215 |
} // namespace google |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
216 |
|
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
217 |
-#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_SPARC_GCC_H_ |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
218 |
- |
e4667e7df088
23601539 Update Thunderbird to version 45.1.0
Stacy Yeh <stacy.yeh@oracle.com>
parents:
diff
changeset
|
219 |
+#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_GENERIC_GCC_H_ |