src/hotspot/share/services/mallocSiteTable.hpp
changeset 47634 6a0c42c40cd1
parent 47216 71c04702a3d5
child 48955 e22914003cf0
--- a/src/hotspot/share/services/mallocSiteTable.hpp	Mon Oct 16 20:22:41 2017 +0000
+++ b/src/hotspot/share/services/mallocSiteTable.hpp	Mon Oct 16 22:36:06 2017 -0400
@@ -61,8 +61,8 @@
 // Malloc site hashtable entry
 class MallocSiteHashtableEntry : public CHeapObj<mtNMT> {
  private:
-  MallocSite                _malloc_site;
-  MallocSiteHashtableEntry* _next;
+  MallocSite                         _malloc_site;
+  MallocSiteHashtableEntry* volatile _next;
 
  public:
   MallocSiteHashtableEntry() : _next(NULL) { }
@@ -79,10 +79,7 @@
   // Insert an entry atomically.
   // Return true if the entry is inserted successfully.
   // The operation can be failed due to contention from other thread.
-  bool atomic_insert(const MallocSiteHashtableEntry* entry) {
-    return (Atomic::cmpxchg_ptr((void*)entry, (volatile void*)&_next,
-      NULL) == NULL);
-  }
+  bool atomic_insert(MallocSiteHashtableEntry* entry);
 
   void set_callsite(const MallocSite& site) {
     _malloc_site = site;