551 ObjArrayTask(oop o = NULL, int idx = 0): _obj(o), _index(idx) { }
552 ObjArrayTask(oop o, size_t idx): _obj(o), _index(int(idx)) {
553 assert(idx <= size_t(max_jint), "too big");
554 }
555 // Trivially copyable, for use in GenericTaskQueue.
556
557 inline oop obj() const { return _obj; }
558 inline int index() const { return _index; }
559
560 DEBUG_ONLY(bool is_valid() const); // Tasks to be pushed/popped must be valid.
561
562 private:
563 oop _obj;
564 int _index;
565 };
566
567 // Wrapper over an oop that is a partially scanned array.
568 // Can be converted to a ScannerTask for placement in associated task queues.
569 // Refers to the partially copied source array oop.
570 class PartialArrayScanTask {
571 void* _p;
572
573 public:
574 PartialArrayScanTask() : _p(NULL) {}
575 explicit PartialArrayScanTask(oop src_array) : _p(src_array) {}
576 // Trivially copyable.
577
578 oop to_source_array() const { return oop(_p); }
579 };
580
581 // Discriminated union over oop*, narrowOop*, and PartialArrayScanTask.
582 // Uses a low tag in the associated pointer to identify the category.
583 // Used as a task queue element type.
584 class ScannerTask {
585 void* _p;
586
587 static const uintptr_t OopTag = 0;
588 static const uintptr_t NarrowOopTag = 1;
589 static const uintptr_t PartialArrayTag = 2;
590 static const uintptr_t TagSize = 2;
591 static const uintptr_t TagAlignment = 1 << TagSize;
592 static const uintptr_t TagMask = TagAlignment - 1;
593
594 static void* encode(void* p, uintptr_t tag) {
595 assert(is_aligned(p, TagAlignment), "misaligned: " PTR_FORMAT, p2i(p));
596 return static_cast<char*>(p) + tag;
597 }
598
|
551 ObjArrayTask(oop o = NULL, int idx = 0): _obj(o), _index(idx) { }
552 ObjArrayTask(oop o, size_t idx): _obj(o), _index(int(idx)) {
553 assert(idx <= size_t(max_jint), "too big");
554 }
555 // Trivially copyable, for use in GenericTaskQueue.
556
557 inline oop obj() const { return _obj; }
558 inline int index() const { return _index; }
559
560 DEBUG_ONLY(bool is_valid() const); // Tasks to be pushed/popped must be valid.
561
562 private:
563 oop _obj;
564 int _index;
565 };
566
567 // Wrapper over an oop that is a partially scanned array.
568 // Can be converted to a ScannerTask for placement in associated task queues.
569 // Refers to the partially copied source array oop.
570 class PartialArrayScanTask {
571 oop _src;
572
573 public:
574 PartialArrayScanTask() : _src() {}
575 explicit PartialArrayScanTask(oop src_array) : _src(src_array) {}
576 // Trivially copyable.
577
578 oop to_source_array() const { return _src; }
579 };
580
581 // Discriminated union over oop*, narrowOop*, and PartialArrayScanTask.
582 // Uses a low tag in the associated pointer to identify the category.
583 // Used as a task queue element type.
584 class ScannerTask {
585 void* _p;
586
587 static const uintptr_t OopTag = 0;
588 static const uintptr_t NarrowOopTag = 1;
589 static const uintptr_t PartialArrayTag = 2;
590 static const uintptr_t TagSize = 2;
591 static const uintptr_t TagAlignment = 1 << TagSize;
592 static const uintptr_t TagMask = TagAlignment - 1;
593
594 static void* encode(void* p, uintptr_t tag) {
595 assert(is_aligned(p, TagAlignment), "misaligned: " PTR_FORMAT, p2i(p));
596 return static_cast<char*>(p) + tag;
597 }
598
|