3493 }
3494 SuspendibleThreadSet::yield();
3495 return true;
3496 } else {
3497 return false;
3498 }
3499 }
3500
3501 #ifndef PRODUCT
3502 // for debugging purposes
3503 void ConcurrentMark::print_finger() {
3504 gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT,
3505 p2i(_heap_start), p2i(_heap_end), p2i(_finger));
3506 for (uint i = 0; i < _max_worker_id; ++i) {
3507 gclog_or_tty->print(" %u: " PTR_FORMAT, i, p2i(_tasks[i]->finger()));
3508 }
3509 gclog_or_tty->cr();
3510 }
3511 #endif
3512
3513 void CMTask::scan_object(oop obj) {
3514 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), "invariant");
3515
3516 if (_cm->verbose_high()) {
3517 gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT,
3518 _worker_id, p2i((void*) obj));
3519 }
3520
3521 size_t obj_size = obj->size();
3522 _words_scanned += obj_size;
3523
3524 obj->oop_iterate(_cm_oop_closure);
3525 statsOnly( ++_objs_scanned );
3526 check_limits();
3527 }
3528
3529 // Closure for iteration over bitmaps
3530 class CMBitMapClosure : public BitMapClosure {
3531 private:
3532 // the bitmap that is being iterated over
3533 CMBitMap* _nextMarkBitMap;
3534 ConcurrentMark* _cm;
3535 CMTask* _task;
3536
3537 public:
3538 CMBitMapClosure(CMTask *task, ConcurrentMark* cm, CMBitMap* nextMarkBitMap) :
3539 _task(task), _cm(cm), _nextMarkBitMap(nextMarkBitMap) { }
3540
3541 bool do_bit(size_t offset) {
3542 HeapWord* addr = _nextMarkBitMap->offsetToHeapWord(offset);
3543 assert(_nextMarkBitMap->isMarked(addr), "invariant");
3544 assert( addr < _cm->finger(), "invariant");
3545
3546 statsOnly( _task->increase_objs_found_on_bitmap() );
3547 assert(addr >= _task->finger(), "invariant");
|
3493 }
3494 SuspendibleThreadSet::yield();
3495 return true;
3496 } else {
3497 return false;
3498 }
3499 }
3500
3501 #ifndef PRODUCT
3502 // for debugging purposes
3503 void ConcurrentMark::print_finger() {
3504 gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT,
3505 p2i(_heap_start), p2i(_heap_end), p2i(_finger));
3506 for (uint i = 0; i < _max_worker_id; ++i) {
3507 gclog_or_tty->print(" %u: " PTR_FORMAT, i, p2i(_tasks[i]->finger()));
3508 }
3509 gclog_or_tty->cr();
3510 }
3511 #endif
3512
3513 template<bool scan>
3514 inline void CMTask::process_grey_object(oop obj) {
3515 assert(scan || obj->is_typeArray(), "Skipping scan of grey non-typeArray");
3516 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), "invariant");
3517
3518 if (_cm->verbose_high()) {
3519 gclog_or_tty->print_cr("[%u] processing grey object " PTR_FORMAT,
3520 _worker_id, p2i((void*) obj));
3521 }
3522
3523 size_t obj_size = obj->size();
3524 _words_scanned += obj_size;
3525
3526 if (scan) {
3527 obj->oop_iterate(_cm_oop_closure);
3528 }
3529 statsOnly( ++_objs_scanned );
3530 check_limits();
3531 }
3532
3533 template void CMTask::process_grey_object<true>(oop);
3534 template void CMTask::process_grey_object<false>(oop);
3535
3536 // Closure for iteration over bitmaps
3537 class CMBitMapClosure : public BitMapClosure {
3538 private:
3539 // the bitmap that is being iterated over
3540 CMBitMap* _nextMarkBitMap;
3541 ConcurrentMark* _cm;
3542 CMTask* _task;
3543
3544 public:
3545 CMBitMapClosure(CMTask *task, ConcurrentMark* cm, CMBitMap* nextMarkBitMap) :
3546 _task(task), _cm(cm), _nextMarkBitMap(nextMarkBitMap) { }
3547
3548 bool do_bit(size_t offset) {
3549 HeapWord* addr = _nextMarkBitMap->offsetToHeapWord(offset);
3550 assert(_nextMarkBitMap->isMarked(addr), "invariant");
3551 assert( addr < _cm->finger(), "invariant");
3552
3553 statsOnly( _task->increase_objs_found_on_bitmap() );
3554 assert(addr >= _task->finger(), "invariant");
|