426 return true;
427 }
428 return false;
429 }
430
431 template<class T, MEMFLAGS F>
432 uint GenericTaskQueueSet<T, F>::tasks() const {
433 uint n = 0;
434 for (uint j = 0; j < _n; j++) {
435 n += _queues[j]->size();
436 }
437 return n;
438 }
439
440 // When to terminate from the termination protocol.
441 class TerminatorTerminator: public CHeapObj<mtInternal> {
442 public:
443 virtual bool should_exit_termination() = 0;
444 };
445
446 typedef GenericTaskQueue<oop, mtGC> OopTaskQueue;
447 typedef GenericTaskQueueSet<OopTaskQueue, mtGC> OopTaskQueueSet;
448
449 #ifdef _MSC_VER
450 #pragma warning(push)
451 // warning C4522: multiple assignment operators specified
452 #pragma warning(disable:4522)
453 #endif
454
455 // This is a container class for either an oop* or a narrowOop*.
456 // Both are pushed onto a task queue and the consumer will test is_narrow()
457 // to determine which should be processed.
458 class StarTask {
459 void* _holder; // either union oop* or narrowOop*
460
461 enum { COMPRESSED_OOP_MASK = 1 };
462
463 public:
464 StarTask(narrowOop* p) {
465 assert(((uintptr_t)p & COMPRESSED_OOP_MASK) == 0, "Information loss!");
466 _holder = (void *)((uintptr_t)p | COMPRESSED_OOP_MASK);
467 }
468 StarTask(oop* p) {
506 volatile ObjArrayTask&
507 operator =(const volatile ObjArrayTask& t) volatile {
508 (void)const_cast<oop&>(_obj = t._obj);
509 _index = t._index;
510 return *this;
511 }
512
513 inline oop obj() const { return _obj; }
514 inline int index() const { return _index; }
515
516 DEBUG_ONLY(bool is_valid() const); // Tasks to be pushed/popped must be valid.
517
518 private:
519 oop _obj;
520 int _index;
521 };
522
523 #ifdef _MSC_VER
524 #pragma warning(pop)
525 #endif
526
527 typedef OverflowTaskQueue<StarTask, mtGC> OopStarTaskQueue;
528 typedef GenericTaskQueueSet<OopStarTaskQueue, mtGC> OopStarTaskQueueSet;
529
530 typedef OverflowTaskQueue<size_t, mtGC> RegionTaskQueue;
531 typedef GenericTaskQueueSet<RegionTaskQueue, mtGC> RegionTaskQueueSet;
532
533 #endif // SHARE_GC_SHARED_TASKQUEUE_HPP
|
426 return true;
427 }
428 return false;
429 }
430
431 template<class T, MEMFLAGS F>
432 uint GenericTaskQueueSet<T, F>::tasks() const {
433 uint n = 0;
434 for (uint j = 0; j < _n; j++) {
435 n += _queues[j]->size();
436 }
437 return n;
438 }
439
440 // When to terminate from the termination protocol.
441 class TerminatorTerminator: public CHeapObj<mtInternal> {
442 public:
443 virtual bool should_exit_termination() = 0;
444 };
445
446 #ifdef _MSC_VER
447 #pragma warning(push)
448 // warning C4522: multiple assignment operators specified
449 #pragma warning(disable:4522)
450 #endif
451
452 // This is a container class for either an oop* or a narrowOop*.
453 // Both are pushed onto a task queue and the consumer will test is_narrow()
454 // to determine which should be processed.
455 class StarTask {
456 void* _holder; // either union oop* or narrowOop*
457
458 enum { COMPRESSED_OOP_MASK = 1 };
459
460 public:
461 StarTask(narrowOop* p) {
462 assert(((uintptr_t)p & COMPRESSED_OOP_MASK) == 0, "Information loss!");
463 _holder = (void *)((uintptr_t)p | COMPRESSED_OOP_MASK);
464 }
465 StarTask(oop* p) {
503 volatile ObjArrayTask&
504 operator =(const volatile ObjArrayTask& t) volatile {
505 (void)const_cast<oop&>(_obj = t._obj);
506 _index = t._index;
507 return *this;
508 }
509
510 inline oop obj() const { return _obj; }
511 inline int index() const { return _index; }
512
513 DEBUG_ONLY(bool is_valid() const); // Tasks to be pushed/popped must be valid.
514
515 private:
516 oop _obj;
517 int _index;
518 };
519
520 #ifdef _MSC_VER
521 #pragma warning(pop)
522 #endif
523
524 #endif // SHARE_GC_SHARED_TASKQUEUE_HPP
|