< prev index next >

src/hotspot/share/gc/shared/parallelCleaning.cpp

Print this page

        

@@ -92,11 +92,11 @@
         claimed_nmethods[i] = last.method();
         (*num_claimed_nmethods)++;
       }
     }
 
-  } while (Atomic::cmpxchg(last.method(), &_claimed_nmethod, first) != first);
+  } while (Atomic::cmpxchg(&_claimed_nmethod, first, last.method()) != first);
 }
 
 void CodeCacheUnloadingTask::work(uint worker_id) {
   // The first nmethods is claimed by the first worker.
   if (worker_id == 0 && _first_nmethod != NULL) {

@@ -128,11 +128,11 @@
 bool KlassCleaningTask::claim_clean_klass_tree_task() {
   if (_clean_klass_tree_claimed) {
     return false;
   }
 
-  return Atomic::cmpxchg(1, &_clean_klass_tree_claimed, 0) == 0;
+  return Atomic::cmpxchg(&_clean_klass_tree_claimed, 0, 1) == 0;
 }
 
 InstanceKlass* KlassCleaningTask::claim_next_klass() {
   Klass* klass;
   do {
< prev index next >