src/hotspot/share/gc/z/zMarkStack.inline.hpp
changeset 59039 c60978f87d45
parent 50525 767cdb97f103
child 59252 623722a6aeb9
equal deleted inserted replaced
59038:b9a42ca342db 59039:c60978f87d45
   112   decode_versioned_pointer(vstack, &stack, &version);
   112   decode_versioned_pointer(vstack, &stack, &version);
   113   return stack == NULL;
   113   return stack == NULL;
   114 }
   114 }
   115 
   115 
   116 template <typename T>
   116 template <typename T>
   117 inline void ZStackList<T>::push_atomic(T* stack) {
   117 inline void ZStackList<T>::push(T* stack) {
   118   T* vstack = _head;
   118   T* vstack = _head;
   119   uint32_t version = 0;
   119   uint32_t version = 0;
   120 
   120 
   121   for (;;) {
   121   for (;;) {
   122     decode_versioned_pointer(vstack, stack->next_addr(), &version);
   122     decode_versioned_pointer(vstack, stack->next_addr(), &version);
   131     vstack = prev_vstack;
   131     vstack = prev_vstack;
   132   }
   132   }
   133 }
   133 }
   134 
   134 
   135 template <typename T>
   135 template <typename T>
   136 inline T* ZStackList<T>::pop_atomic() {
   136 inline T* ZStackList<T>::pop() {
   137   T* vstack = _head;
   137   T* vstack = _head;
   138   T* stack = NULL;
   138   T* stack = NULL;
   139   uint32_t version = 0;
   139   uint32_t version = 0;
   140 
   140 
   141   for (;;) {
   141   for (;;) {
   166   // workers to work on, while the overflowed list is used by GC workers
   166   // workers to work on, while the overflowed list is used by GC workers
   167   // to publish stacks that overflowed. The intention here is to avoid
   167   // to publish stacks that overflowed. The intention here is to avoid
   168   // contention between mutators and GC workers as much as possible, while
   168   // contention between mutators and GC workers as much as possible, while
   169   // still allowing GC workers to help out and steal work from each other.
   169   // still allowing GC workers to help out and steal work from each other.
   170   if (publish) {
   170   if (publish) {
   171     _published.push_atomic(stack);
   171     _published.push(stack);
   172   } else {
   172   } else {
   173     _overflowed.push_atomic(stack);
   173     _overflowed.push(stack);
   174   }
   174   }
   175 }
   175 }
   176 
   176 
   177 inline ZMarkStack* ZMarkStripe::steal_stack() {
   177 inline ZMarkStack* ZMarkStripe::steal_stack() {
   178   // Steal overflowed stacks first, then published stacks
   178   // Steal overflowed stacks first, then published stacks
   179   ZMarkStack* const stack = _overflowed.pop_atomic();
   179   ZMarkStack* const stack = _overflowed.pop();
   180   if (stack != NULL) {
   180   if (stack != NULL) {
   181     return stack;
   181     return stack;
   182   }
   182   }
   183 
   183 
   184   return _published.pop_atomic();
   184   return _published.pop();
   185 }
   185 }
   186 
   186 
   187 inline size_t ZMarkStripeSet::nstripes() const {
   187 inline size_t ZMarkStripeSet::nstripes() const {
   188   return _nstripes;
   188   return _nstripes;
   189 }
   189 }