< prev index next >

src/hotspot/share/code/dependencyContext.cpp

Print this page

        

@@ -99,11 +99,11 @@
   }
   nmethodBucket* new_head = new nmethodBucket(nm, NULL);
   for (;;) {
     nmethodBucket* head = Atomic::load(_dependency_context_addr);
     new_head->set_next(head);
-    if (Atomic::cmpxchg(new_head, _dependency_context_addr, head) == head) {
+    if (Atomic::cmpxchg(_dependency_context_addr, head, new_head) == head) {
       break;
     }
   }
   if (UsePerfData) {
     _perf_total_buckets_allocated_count->inc();

@@ -122,11 +122,11 @@
     // Mark the context as having stale entries, since it is not safe to
     // expunge the list right now.
     for (;;) {
       nmethodBucket* purge_list_head = Atomic::load(&_purge_list);
       b->set_purge_list_next(purge_list_head);
-      if (Atomic::cmpxchg(b, &_purge_list, purge_list_head) == purge_list_head) {
+      if (Atomic::cmpxchg(&_purge_list, purge_list_head, b) == purge_list_head) {
         break;
       }
     }
     if (UsePerfData) {
       _perf_total_buckets_stale_count->inc();

@@ -270,11 +270,11 @@
   uint64_t cleaning_epoch = Atomic::load(&_cleaning_epoch);
   uint64_t last_cleanup = Atomic::load(_last_cleanup_addr);
   if (last_cleanup >= cleaning_epoch) {
     return false;
   }
-  return Atomic::cmpxchg(cleaning_epoch, _last_cleanup_addr, last_cleanup) == last_cleanup;
+  return Atomic::cmpxchg(_last_cleanup_addr, last_cleanup, cleaning_epoch) == last_cleanup;
 }
 
 // Retrieve the first nmethodBucket that has a dependent that does not correspond to
 // an is_unloading nmethod. Any nmethodBucket entries observed from the original head
 // that is_unloading() will be unlinked and placed on the purge list.

@@ -289,11 +289,11 @@
     OrderAccess::loadload();
     if (Atomic::load(_dependency_context_addr) != head) {
       // Unstable load of head w.r.t. head->next
       continue;
     }
-    if (Atomic::cmpxchg(head_next, _dependency_context_addr, head) == head) {
+    if (Atomic::cmpxchg(_dependency_context_addr, head, head_next) == head) {
       // Release is_unloading entries if unlinking was claimed
       DependencyContext::release(head);
     }
   }
 }

@@ -343,11 +343,11 @@
     OrderAccess::loadload();
     if (Atomic::load(&_next) != next) {
       // Unstable load of next w.r.t. next->next
       continue;
     }
-    if (Atomic::cmpxchg(next_next, &_next, next) == next) {
+    if (Atomic::cmpxchg(&_next, next, next_next) == next) {
       // Release is_unloading entries if unlinking was claimed
       DependencyContext::release(next);
     }
   }
 }
< prev index next >