src/hotspot/share/gc/shared/ptrQueue.cpp
changeset 59249 29b0d0b61615
parent 59247 56bf71d64d51
child 59250 a6deb69743d4
equal deleted inserted replaced
59248:e92153ed8bdc 59249:29b0d0b61615
   180   // the allocation rate and the release rate are going to be fairly
   180   // the allocation rate and the release rate are going to be fairly
   181   // similar, due to how the buffers are used.
   181   // similar, due to how the buffers are used.
   182   const size_t trigger_transfer = 10;
   182   const size_t trigger_transfer = 10;
   183 
   183 
   184   // Add to pending list. Update count first so no underflow in transfer.
   184   // Add to pending list. Update count first so no underflow in transfer.
   185   size_t pending_count = Atomic::add(1u, &_pending_count);
   185   size_t pending_count = Atomic::add(&_pending_count, 1u);
   186   _pending_list.push(*node);
   186   _pending_list.push(*node);
   187   if (pending_count > trigger_transfer) {
   187   if (pending_count > trigger_transfer) {
   188     try_transfer_pending();
   188     try_transfer_pending();
   189   }
   189   }
   190 }
   190 }
   217     // Wait for any in-progress pops, to avoid ABA for them.
   217     // Wait for any in-progress pops, to avoid ABA for them.
   218     GlobalCounter::write_synchronize();
   218     GlobalCounter::write_synchronize();
   219 
   219 
   220     // Add synchronized nodes to _free_list.
   220     // Add synchronized nodes to _free_list.
   221     // Update count first so no underflow in allocate().
   221     // Update count first so no underflow in allocate().
   222     Atomic::add(count, &_free_count);
   222     Atomic::add(&_free_count, count);
   223     _free_list.prepend(*first, *last);
   223     _free_list.prepend(*first, *last);
   224     log_trace(gc, ptrqueue, freelist)
   224     log_trace(gc, ptrqueue, freelist)
   225              ("Transferred %s pending to free: " SIZE_FORMAT, name(), count);
   225              ("Transferred %s pending to free: " SIZE_FORMAT, name(), count);
   226   }
   226   }
   227   Atomic::release_store(&_transfer_lock, false);
   227   Atomic::release_store(&_transfer_lock, false);
   256 }
   256 }
   257 
   257 
   258 void PtrQueueSet::deallocate_buffer(BufferNode* node) {
   258 void PtrQueueSet::deallocate_buffer(BufferNode* node) {
   259   _allocator->release(node);
   259   _allocator->release(node);
   260 }
   260 }
   261