< prev index next >

src/hotspot/share/services/mallocSiteTable.cpp

Print this page

        

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

@@ -227,11 +227,11 @@
 
   // make counter negative to block out shared locks
   do {
     val = *_lock;
     target = _MAGIC_ + *_lock;
-  } while (Atomic::cmpxchg(target, _lock, val) != val);
+  } while (Atomic::cmpxchg(_lock, val, target) != val);
 
   // wait for all readers to exit
   while (*_lock != _MAGIC_) {
 #ifdef _WINDOWS
     os::naked_short_sleep(1);

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