< prev index next >

src/share/vm/runtime/atomic.hpp

Print this page
rev 13266 : imported patch Atomic_refactoring
rev 13268 : [mq]: Atomic_polishing_v2

@@ -24,17 +24,13 @@
 
 #ifndef SHARE_VM_RUNTIME_ATOMIC_HPP
 #define SHARE_VM_RUNTIME_ATOMIC_HPP
 
 #include "memory/allocation.hpp"
-#include "metaprogramming/conditional.hpp"
-#include "metaprogramming/enableIf.hpp"
 #include "metaprogramming/integerTypes.hpp"
 #include "metaprogramming/isIntegral.hpp"
 #include "metaprogramming/isPointer.hpp"
-#include "metaprogramming/isSame.hpp"
-#include "metaprogramming/removePointer.hpp"
 #include "utilities/align.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/macros.hpp"
 
 enum cmpxchg_memory_order {

@@ -245,11 +241,11 @@
 }
 
 template <typename T, typename U>
 inline U* Atomic::add(T add_value, U* volatile* dst) {
   STATIC_ASSERT(IsIntegral<T>::value);
-  typedef typename IntegerTypes::Signed<intptr_t>::type Raw;
+  typedef typename IntegerTypes::Signed<U*>::type Raw;
   ptrdiff_t value = add_value;
   Raw raw_value = IntegerTypes::cast_to_signed(value * sizeof(U));
   Raw result = specialized_add(raw_value, reinterpret_cast<volatile Raw*>(dst));
   return IntegerTypes::cast<U*>(result);
 }

@@ -264,11 +260,11 @@
 template <typename T>
 inline void Atomic::inc(T* volatile* src) {
   if (sizeof(T) != 1) {
     add(1, src);
   } else {
-    typedef typename IntegerTypes::Signed<intptr_t>::type Raw;
+    typedef typename IntegerTypes::Signed<T*>::type Raw;
     specialized_inc(reinterpret_cast<volatile Raw*>(src));
   }
 }
 
 template <typename T>

@@ -281,11 +277,11 @@
 template <typename T>
 inline void Atomic::dec(T* volatile* src) {
   if (sizeof(T) != 1) {
     add(-1, src);
   } else {
-    typedef typename IntegerTypes::Signed<intptr_t>::type Raw;
+    typedef typename IntegerTypes::Signed<T*>::type Raw;
     specialized_dec(reinterpret_cast<volatile Raw*>(src));
   }
 }
 
 template <typename T, typename U>
< prev index next >