< prev index next >

src/share/vm/services/mallocTracker.hpp

Print this page
rev 13453 : imported patch Atomic_add

@@ -51,32 +51,32 @@
     DEBUG_ONLY(_peak_count = 0;)
     DEBUG_ONLY(_peak_size  = 0;)
   }
 
   inline void allocate(size_t sz) {
-    Atomic::add(1, &_count);
+    Atomic::inc(&_count);
     if (sz > 0) {
       Atomic::add(sz, &_size);
       DEBUG_ONLY(_peak_size = MAX2(_peak_size, _size));
     }
     DEBUG_ONLY(_peak_count = MAX2(_peak_count, _count);)
   }
 
   inline void deallocate(size_t sz) {
     assert(_count > 0, "Nothing allocated yet");
     assert(_size >= sz, "deallocation > allocated");
-    Atomic::add(-1, &_count);
+    Atomic::dec(&_count);
     if (sz > 0) {
       // unary minus operator applied to unsigned type, result still unsigned
       #pragma warning(suppress: 4146)
       Atomic::add(-sz, &_size);
     }
   }
 
   inline void resize(long sz) {
     if (sz != 0) {
-      Atomic::add(sz, &_size);
+      Atomic::add(size_t(sz), &_size);
       DEBUG_ONLY(_peak_size = MAX2(_size, _peak_size);)
     }
   }
 
   inline size_t count() const { return _count; }
< prev index next >