hotspot/src/share/vm/utilities/taskqueue.hpp
changeset 6759 67b1a69ef5aa
parent 6251 90e562b9f1cc
child 6762 f8d1b560700e
equal deleted inserted replaced
6451:516540f1f076 6759:67b1a69ef5aa
   303     return true;
   303     return true;
   304   }
   304   }
   305   return false;
   305   return false;
   306 }
   306 }
   307 
   307 
       
   308 // pop_local_slow() is done by the owning thread and is trying to
       
   309 // get the last task in the queue.  It will compete with pop_global()
       
   310 // that will be used by other threads.  The tag age is incremented
       
   311 // whenever the queue goes empty which it will do here if this thread
       
   312 // gets the last task or in pop_global() if the queue wraps (top == 0
       
   313 // and pop_global() succeeds, see pop_global()).
   308 template<class E, unsigned int N>
   314 template<class E, unsigned int N>
   309 bool GenericTaskQueue<E, N>::pop_local_slow(uint localBot, Age oldAge) {
   315 bool GenericTaskQueue<E, N>::pop_local_slow(uint localBot, Age oldAge) {
   310   // This queue was observed to contain exactly one element; either this
   316   // This queue was observed to contain exactly one element; either this
   311   // thread will claim it, or a competing "pop_global".  In either case,
   317   // thread will claim it, or a competing "pop_global".  In either case,
   312   // the queue will be logically empty afterwards.  Create a new Age value
   318   // the queue will be logically empty afterwards.  Create a new Age value
   635   // Reset the terminator, so that it may be reused again.
   641   // Reset the terminator, so that it may be reused again.
   636   // The caller is responsible for ensuring that this is done
   642   // The caller is responsible for ensuring that this is done
   637   // in an MT-safe manner, once the previous round of use of
   643   // in an MT-safe manner, once the previous round of use of
   638   // the terminator is finished.
   644   // the terminator is finished.
   639   void reset_for_reuse();
   645   void reset_for_reuse();
       
   646   // Same as above but the number of parallel threads is set to the
       
   647   // given number.
       
   648   void reset_for_reuse(int n_threads);
   640 
   649 
   641 #ifdef TRACESPINNING
   650 #ifdef TRACESPINNING
   642   static uint total_yields() { return _total_yields; }
   651   static uint total_yields() { return _total_yields; }
   643   static uint total_spins() { return _total_spins; }
   652   static uint total_spins() { return _total_spins; }
   644   static uint total_peeks() { return _total_peeks; }
   653   static uint total_peeks() { return _total_peeks; }
   780 typedef OverflowTaskQueue<StarTask>           OopStarTaskQueue;
   789 typedef OverflowTaskQueue<StarTask>           OopStarTaskQueue;
   781 typedef GenericTaskQueueSet<OopStarTaskQueue> OopStarTaskQueueSet;
   790 typedef GenericTaskQueueSet<OopStarTaskQueue> OopStarTaskQueueSet;
   782 
   791 
   783 typedef OverflowTaskQueue<size_t>             RegionTaskQueue;
   792 typedef OverflowTaskQueue<size_t>             RegionTaskQueue;
   784 typedef GenericTaskQueueSet<RegionTaskQueue>  RegionTaskQueueSet;
   793 typedef GenericTaskQueueSet<RegionTaskQueue>  RegionTaskQueueSet;
       
   794