< prev index next >

src/hotspot/share/services/mallocSiteTable.cpp

Print this page

        

@@ -145,11 +145,11 @@
     MallocSiteHashtableEntry* entry = new_entry(key, flags);
     // OOM check
     if (entry == NULL) return NULL;
 
     // swap in the head
-    if (Atomic::cmpxchg_ptr((void*)entry, (volatile void *)&_table[index], NULL) == NULL) {
+    if (Atomic::cmpxchg(entry, &_table[index], (MallocSiteHashtableEntry*)NULL) == NULL) {
       return entry->data();
     }
 
     delete entry;
   }

@@ -255,5 +255,9 @@
     os::naked_yield();
 #endif
   }
   _lock_state = ExclusiveLock;
 }
+
+bool MallocSiteHashtableEntry::atomic_insert(const MallocSiteHashtableEntry* entry) {
+  return Atomic::cmpxchg(entry, (const MallocSiteHashtableEntry**)&_next, (const MallocSiteHashtableEntry*)NULL) == NULL;
+}
< prev index next >