hotspot/src/share/vm/services/mallocTracker.hpp
changeset 46993 dd0f91c85ffc
parent 46489 40abcea5a9d5
--- a/hotspot/src/share/vm/services/mallocTracker.hpp	Mon Aug 28 02:55:31 2017 -0700
+++ b/hotspot/src/share/vm/services/mallocTracker.hpp	Mon Aug 28 13:31:20 2017 +0200
@@ -53,7 +53,7 @@
   }
 
   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));
@@ -64,7 +64,7 @@
   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)
@@ -74,7 +74,7 @@
 
   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);)
     }
   }