< prev index next >

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

Print this page

        

@@ -148,11 +148,11 @@
     node = BufferNode::allocate(_buffer_size);
   } else {
     // Decrement count after getting buffer from free list.  This, along
     // with incrementing count before adding to free list, ensures count
     // never underflows.
-    size_t count = Atomic::sub(1u, &_free_count);
+    size_t count = Atomic::sub(&_free_count, 1u);
     assert((count + 1) != 0, "_free_count underflow");
   }
   return node;
 }
 

@@ -210,11 +210,11 @@
     size_t count = 1;
     for (BufferNode* next = first->next(); next != NULL; next = next->next()) {
       last = next;
       ++count;
     }
-    Atomic::sub(count, &_pending_count);
+    Atomic::sub(&_pending_count, count);
 
     // Wait for any in-progress pops, to avoid ABA for them.
     GlobalCounter::write_synchronize();
 
     // Add synchronized nodes to _free_list.

@@ -234,11 +234,11 @@
   for ( ; removed < remove_goal; ++removed) {
     BufferNode* node = _free_list.pop();
     if (node == NULL) break;
     BufferNode::deallocate(node);
   }
-  size_t new_count = Atomic::sub(removed, &_free_count);
+  size_t new_count = Atomic::sub(&_free_count, removed);
   log_debug(gc, ptrqueue, freelist)
            ("Reduced %s free list by " SIZE_FORMAT " to " SIZE_FORMAT,
             name(), removed, new_count);
   return removed;
 }
< prev index next >