BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsls_atomicoperations_sparc_sun_cc_default.h
Go to the documentation of this file.
1/// @file bsls_atomicoperations_sparc_sun_cc_default.h
2///
3/// The content of this file has been pre-processed for Doxygen.
4///
5
6
7// bsls_atomicoperations_sparc_sun_cc_default.h -*-C++-*-
8#ifndef INCLUDED_BSLS_ATOMICOPERATIONS_SPARC_SUN_CC_DEFAULT
9#define INCLUDED_BSLS_ATOMICOPERATIONS_SPARC_SUN_CC_DEFAULT
10
11#include <bsls_ident.h>
12BSLS_IDENT("$Id: $")
13
14/// @defgroup bsls_atomicoperations_sparc_sun_cc_default bsls_atomicoperations_sparc_sun_cc_default
15/// @brief Provide default base implementations of atomics for Sparc/Sun.
16/// @addtogroup bsl
17/// @{
18/// @addtogroup bsls
19/// @{
20/// @addtogroup bsls_atomicoperations_sparc_sun_cc_default
21/// @{
22///
23/// <h1> Outline </h1>
24/// * <a href="#bsls_atomicoperations_sparc_sun_cc_default-purpose"> Purpose</a>
25/// * <a href="#bsls_atomicoperations_sparc_sun_cc_default-classes"> Classes </a>
26/// * <a href="#bsls_atomicoperations_sparc_sun_cc_default-description"> Description </a>
27///
28/// # Purpose {#bsls_atomicoperations_sparc_sun_cc_default-purpose}
29/// Provide default base implementations of atomics for Sparc/Sun.
30///
31/// # Classes {#bsls_atomicoperations_sparc_sun_cc_default-classes}
32///
33/// - bsls::AtomicOperations_SPARC_SUN_CC_Default32: default base for 32bit mode.
34/// - bsls::AtomicOperations_SPARC_SUN_CC_Default64: default base for 64bit mode.
35///
36/// # Description {#bsls_atomicoperations_sparc_sun_cc_default-description}
37/// This component provides default base classes necessary to
38/// implement atomics on the Sun Sparc platform with SunCC compiler. The
39/// classes are for private use only. See @ref bsls_atomicoperations and
40/// @ref bsls_atomic for the public interface to atomics.
41/// @}
42/** @} */
43/** @} */
44
45/** @addtogroup bsl
46 * @{
47 */
48/** @addtogroup bsls
49 * @{
50 */
51/** @addtogroup bsls_atomicoperations_sparc_sun_cc_default
52 * @{
53 */
54
55#include <bsls_atomicoperations_default.h>
56#include <bsls_platform.h>
57#include <bsls_types.h>
58
59#if (defined(BSLS_PLATFORM_CPU_SPARC_V9) \
60 || defined(BSLS_PLATFORM_CPU_SPARC_32)) \
61 && (defined(BSLS_PLATFORM_CMP_GNU) || defined(BSLS_PLATFORM_CMP_SUN))
62
63
64
65extern "C"
66{
67 // 32 bit operation shared between 32 bit and 64 bit platforms
68
69 int bsls_AtomicOperations_Sparc_GetInt(
70 const volatile int *atomicInt);
71
72 void bsls_AtomicOperations_Sparc_SetInt(
73 volatile int *atomicInt,
74 int value);
75
76 int bsls_AtomicOperations_Sparc_SwapInt(
77 volatile int *atomicInt,
78 int swapValue);
79
80 int bsls_AtomicOperations_Sparc_SwapIntAcqRel(
81 volatile int *atomicInt,
82 int swapValue);
83
84 int bsls_AtomicOperations_Sparc_TestAndSwapInt(
85 volatile int *atomicInt,
86 int compareValue,
87 int swapValue);
88
89 int bsls_AtomicOperations_Sparc_TestAndSwapIntAcqRel(
90 volatile int *atomicInt,
91 int compareValue,
92 int swapValue);
93
94 int bsls_AtomicOperations_Sparc_AddInt(
95 volatile int *atomicInt,
96 int value);
97
98 int bsls_AtomicOperations_Sparc_AddIntRelaxed(
99 volatile int *atomicInt,
100 int value);
101}
102
103namespace bsls {
104
105 // ===============================================
106 // struct AtomicOperations_SPARC_SUN_CC_DefaultInt
107 // ===============================================
108
109template <typename IMP>
110struct AtomicOperations_SPARC_SUN_CC_DefaultInt
111 : AtomicOperations_DefaultInt<IMP>
112{
113 typedef Atomic_TypeTraits<IMP> AtomicTypes;
114
115 using AtomicOperations_DefaultInt<IMP>::getIntRelaxed;
116 using AtomicOperations_DefaultInt<IMP>::setIntRelaxed;
117
118 // *** atomic functions for int ***
119
120 static int getInt(typename AtomicTypes::Int const *atomicInt);
121
122 static int getIntAcquire(typename AtomicTypes::Int const *atomicInt);
123
124 static void setInt(typename AtomicTypes::Int *atomicInt, int value);
125
126 static void setIntRelease(typename AtomicTypes::Int *atomicInt, int value);
127
128 static int swapInt(typename AtomicTypes::Int *atomicInt, int swapValue);
129
130 static int swapIntAcqRel(typename AtomicTypes::Int *atomicInt,
131 int swapValue);
132
133 static int testAndSwapInt(typename AtomicTypes::Int *atomicInt,
134 int compareValue,
135 int swapValue);
136
137 static int testAndSwapIntAcqRel(typename AtomicTypes::Int *atomicInt,
138 int compareValue,
139 int swapValue);
140
141 static int addIntNv(typename AtomicTypes::Int *atomicInt, int value);
142
143 static int addIntNvRelaxed(typename AtomicTypes::Int *atomicInt,
144 int value);
145
146 static int addIntNvAcqRel(typename AtomicTypes::Int *atomicInt, int value);
147};
148
149 // ==============================================
150 // struct AtomicOperations_SPARC_SUN_CC_Default32
151 // ==============================================
152
153template <typename IMP>
154struct AtomicOperations_SPARC_SUN_CC_Default32
155 : AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>
156 , AtomicOperations_DefaultInt64<IMP>
157 , AtomicOperations_DefaultUint<IMP>
158 , AtomicOperations_DefaultUint64<IMP>
159 , AtomicOperations_DefaultPointer32<IMP>
160{};
161
162 // ==============================================
163 // struct AtomicOperations_SPARC_SUN_CC_Default64
164 // ==============================================
165
166template <typename IMP>
167struct AtomicOperations_SPARC_SUN_CC_Default64
168 : AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>
169 , AtomicOperations_DefaultInt64<IMP>
170 , AtomicOperations_DefaultUint<IMP>
171 , AtomicOperations_DefaultUint64<IMP>
172 , AtomicOperations_DefaultPointer64<IMP>
173{};
174
175// ===========================================================================
176// INLINE FUNCTION DEFINITIONS
177// ===========================================================================
178
179 // -----------------------------------------------
180 // struct AtomicOperations_SPARC_SUN_CC_DefaultInt
181 // -----------------------------------------------
182
183template <typename IMP>
184inline
185int AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>::
186 getInt(typename AtomicTypes::Int const *atomicInt)
187{
188 return bsls_AtomicOperations_Sparc_GetInt(&atomicInt->d_value);
189}
190
191template <typename IMP>
192inline
193int AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>::
194 getIntAcquire(typename AtomicTypes::Int const *atomicInt)
195{
196 return getIntRelaxed(atomicInt);
197}
198
199template <typename IMP>
200inline
201void AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>::
202 setInt(typename AtomicTypes::Int *atomicInt, int value)
203{
204 bsls_AtomicOperations_Sparc_SetInt(&atomicInt->d_value, value);
205}
206
207template <typename IMP>
208inline
209void AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>::
210 setIntRelease(typename AtomicTypes::Int *atomicInt, int value)
211{
212 setIntRelaxed(atomicInt, value);
213}
214
215template <typename IMP>
216inline
217int AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>::
218 swapInt(typename AtomicTypes::Int *atomicInt, int swapValue)
219{
220 return bsls_AtomicOperations_Sparc_SwapInt(&atomicInt->d_value, swapValue);
221}
222
223template <typename IMP>
224inline
225int AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>::
226 swapIntAcqRel(typename AtomicTypes::Int *atomicInt, int swapValue)
227{
228 return bsls_AtomicOperations_Sparc_SwapIntAcqRel(&atomicInt->d_value,
229 swapValue);
230}
231
232template <typename IMP>
233inline
234int AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>::
235 testAndSwapInt(typename AtomicTypes::Int *atomicInt,
236 int compareValue,
237 int swapValue)
238{
239 return bsls_AtomicOperations_Sparc_TestAndSwapInt(&atomicInt->d_value,
240 compareValue,
241 swapValue);
242}
243
244template <typename IMP>
245inline
246int AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>::
247 testAndSwapIntAcqRel(typename AtomicTypes::Int *atomicInt,
248 int compareValue,
249 int swapValue)
250{
251 return bsls_AtomicOperations_Sparc_TestAndSwapIntAcqRel(
252 &atomicInt->d_value,
253 compareValue,
254 swapValue);
255}
256
257template <typename IMP>
258inline
259int AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>::
260 addIntNv(typename AtomicTypes::Int *atomicInt, int value)
261{
262 return bsls_AtomicOperations_Sparc_AddInt(&atomicInt->d_value, value);
263}
264
265template <typename IMP>
266inline
267int AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>::
268 addIntNvRelaxed(typename AtomicTypes::Int *atomicInt, int value)
269{
270 return bsls_AtomicOperations_Sparc_AddIntRelaxed(&atomicInt->d_value,
271 value);
272}
273
274template <typename IMP>
275inline
276int AtomicOperations_SPARC_SUN_CC_DefaultInt<IMP>::
277 addIntNvAcqRel(typename AtomicTypes::Int *atomicInt, int value)
278{
279 return addIntNvRelaxed(atomicInt, value);
280}
281
282} // close package namespace
283
284
285
286#endif
287
288#endif
289
290// ----------------------------------------------------------------------------
291// Copyright 2013 Bloomberg Finance L.P.
292//
293// Licensed under the Apache License, Version 2.0 (the "License");
294// you may not use this file except in compliance with the License.
295// You may obtain a copy of the License at
296//
297// http://www.apache.org/licenses/LICENSE-2.0
298//
299// Unless required by applicable law or agreed to in writing, software
300// distributed under the License is distributed on an "AS IS" BASIS,
301// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
302// See the License for the specific language governing permissions and
303// limitations under the License.
304// ----------------------------- END-OF-FILE ----------------------------------
305
306/** @} */
307/** @} */
308/** @} */
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlt_iso8601util.h:691