< prev index next >
src/hotspot/share/runtime/atomic.hpp
Print this page
*** 68,85 ****
// to D, an integral/enum type equal to D, or a type equal to D that
// is primitive convertible using PrimitiveConversions.
template<typename T, typename D>
inline static void store(T store_value, volatile D* dest);
- inline static void store_ptr(intptr_t store_value, volatile intptr_t* dest) {
- Atomic::store(store_value, dest);
- }
-
- inline static void store_ptr(void* store_value, volatile void* dest) {
- Atomic::store(store_value, reinterpret_cast<void* volatile*>(dest));
- }
-
// Atomically load from a location
// The type T must be either a pointer type, an integral/enum type,
// or a type that is primitive convertible using PrimitiveConversions.
template<typename T>
inline static T load(const volatile T* dest);
--- 68,77 ----
*** 88,104 ****
// <fence> add-value-to-dest <membar StoreLoad|StoreStore>
template<typename I, typename D>
inline static D add(I add_value, D volatile* dest);
! inline static intptr_t add_ptr(intptr_t add_value, volatile intptr_t* dest) {
! return add(add_value, dest);
! }
!
! inline static void* add_ptr(intptr_t add_value, volatile void* dest) {
! return add(add_value, reinterpret_cast<char* volatile*>(dest));
! }
// Atomically increment location. inc() provide:
// <fence> increment-dest <membar StoreLoad|StoreStore>
// The type D may be either a pointer type, or an integral
// type. If it is a pointer type, then the increment is
--- 80,91 ----
// <fence> add-value-to-dest <membar StoreLoad|StoreStore>
template<typename I, typename D>
inline static D add(I add_value, D volatile* dest);
! template<typename I, typename D>
! inline static D sub(I sub_value, D volatile* dest);
// Atomically increment location. inc() provide:
// <fence> increment-dest <membar StoreLoad|StoreStore>
// The type D may be either a pointer type, or an integral
// type. If it is a pointer type, then the increment is
*** 121,138 ****
// to D, an integral/enum type equal to D, or a type equal to D that
// is primitive convertible using PrimitiveConversions.
template<typename T, typename D>
inline static D xchg(T exchange_value, volatile D* dest);
- inline static intptr_t xchg_ptr(intptr_t exchange_value, volatile intptr_t* dest) {
- return xchg(exchange_value, dest);
- }
-
- inline static void* xchg_ptr(void* exchange_value, volatile void* dest) {
- return xchg(exchange_value, reinterpret_cast<void* volatile*>(dest));
- }
-
// Performs atomic compare of *dest and compare_value, and exchanges
// *dest with exchange_value if the comparison succeeded. Returns prior
// value of *dest. cmpxchg*() provide:
// <fence> compare-and-exchange <membar StoreLoad|StoreStore>
--- 108,117 ----
*** 149,175 ****
// alternative to the Double-Checked Locking Pattern.
template<typename T, typename D>
inline static bool replace_if_null(T* value, D* volatile* dest,
cmpxchg_memory_order order = memory_order_conservative);
- inline static intptr_t cmpxchg_ptr(intptr_t exchange_value,
- volatile intptr_t* dest,
- intptr_t compare_value,
- cmpxchg_memory_order order = memory_order_conservative) {
- return cmpxchg(exchange_value, dest, compare_value, order);
- }
-
- inline static void* cmpxchg_ptr(void* exchange_value,
- volatile void* dest,
- void* compare_value,
- cmpxchg_memory_order order = memory_order_conservative) {
- return cmpxchg(exchange_value,
- reinterpret_cast<void* volatile*>(dest),
- compare_value,
- order);
- }
-
private:
// Test whether From is implicitly convertible to To.
// From and To must be pointer types.
// Note: Provides the limited subset of C++11 std::is_convertible
// that is needed here.
--- 128,137 ----
*** 553,562 ****
--- 515,537 ----
// Assumes two's complement integer representation.
#pragma warning(suppress: 4146)
Atomic::add(I(-1), dest);
}
+ template<typename I, typename D>
+ inline D Atomic::sub(I sub_value, D volatile* dest) {
+ STATIC_ASSERT(IsPointer<D>::value || IsIntegral<D>::value);
+ STATIC_ASSERT(IsIntegral<I>::value);
+ typedef typename Conditional<IsPointer<D>::value, ptrdiff_t, D>::type AddendType;
+ AddendType addend = sub_value;
+ STATIC_ASSERT((IsIntegral<D>::value && IsSigned<I>::value == IsSigned<AddendType>::value) ||
+ IsPointer<D>::value);
+ // Assumes two's complement integer representation.
+ #pragma warning(suppress: 4146)
+ return Atomic::add(-addend, dest);
+ }
+
// Define the class before including platform file, which may specialize
// the operator definition. No generic definition of specializations
// of the operator template are provided, nor are there any generic
// specializations of the class. The platform file is responsible for
// providing those.
< prev index next >