< prev index next >

src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.hpp

Print this page




 287   T*   claim_next();
 288 
 289   // reserve queues that not for parallel claiming
 290   void reserve(uint n) {
 291     assert(n <= size(), "Sanity");
 292     _claimed_index = (jint)n;
 293     debug_only(_reserved = n;)
 294   }
 295 
 296   debug_only(uint get_reserved() const { return (uint)_reserved; })
 297 };
 298 
 299 template <class T, MEMFLAGS F>
 300 T* ParallelClaimableQueueSet<T, F>::claim_next() {
 301   jint size = (jint)GenericTaskQueueSet<T, F>::size();
 302 
 303   if (_claimed_index >= size) {
 304     return NULL;
 305   }
 306 
 307   jint index = Atomic::add(1, &_claimed_index);
 308 
 309   if (index <= size) {
 310     return GenericTaskQueueSet<T, F>::queue((uint)index - 1);
 311   } else {
 312     return NULL;
 313   }
 314 }
 315 
 316 class ShenandoahObjToScanQueueSet: public ParallelClaimableQueueSet<ShenandoahObjToScanQueue, mtGC> {
 317 public:
 318   ShenandoahObjToScanQueueSet(int n) : ParallelClaimableQueueSet<ShenandoahObjToScanQueue, mtGC>(n) {}
 319 
 320   bool is_empty();
 321   void clear();
 322 
 323 #if TASKQUEUE_STATS
 324   static void print_taskqueue_stats_hdr(outputStream* const st);
 325   void print_taskqueue_stats() const;
 326   void reset_taskqueue_stats();
 327 #endif // TASKQUEUE_STATS




 287   T*   claim_next();
 288 
 289   // reserve queues that not for parallel claiming
 290   void reserve(uint n) {
 291     assert(n <= size(), "Sanity");
 292     _claimed_index = (jint)n;
 293     debug_only(_reserved = n;)
 294   }
 295 
 296   debug_only(uint get_reserved() const { return (uint)_reserved; })
 297 };
 298 
 299 template <class T, MEMFLAGS F>
 300 T* ParallelClaimableQueueSet<T, F>::claim_next() {
 301   jint size = (jint)GenericTaskQueueSet<T, F>::size();
 302 
 303   if (_claimed_index >= size) {
 304     return NULL;
 305   }
 306 
 307   jint index = Atomic::add(&_claimed_index, 1);
 308 
 309   if (index <= size) {
 310     return GenericTaskQueueSet<T, F>::queue((uint)index - 1);
 311   } else {
 312     return NULL;
 313   }
 314 }
 315 
 316 class ShenandoahObjToScanQueueSet: public ParallelClaimableQueueSet<ShenandoahObjToScanQueue, mtGC> {
 317 public:
 318   ShenandoahObjToScanQueueSet(int n) : ParallelClaimableQueueSet<ShenandoahObjToScanQueue, mtGC>(n) {}
 319 
 320   bool is_empty();
 321   void clear();
 322 
 323 #if TASKQUEUE_STATS
 324   static void print_taskqueue_stats_hdr(outputStream* const st);
 325   void print_taskqueue_stats() const;
 326   void reset_taskqueue_stats();
 327 #endif // TASKQUEUE_STATS


< prev index next >