< prev index next >

src/hotspot/share/services/mallocSiteTable.cpp

Print this page
rev 48406 : 8194406: Use Atomic::replace_if_null
Reviewed-by: coleenp, dholmes

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

@@ -257,7 +257,7 @@
   }
   _lock_state = ExclusiveLock;
 }
 
 bool MallocSiteHashtableEntry::atomic_insert(MallocSiteHashtableEntry* entry) {
-  return Atomic::cmpxchg(entry, &_next, (MallocSiteHashtableEntry*)NULL) == NULL;
+  return Atomic::replace_if_null(entry, &_next);
 }
< prev index next >