3387 }
3388 SuspendibleThreadSet::yield();
3389 return true;
3390 } else {
3391 return false;
3392 }
3393 }
3394
3395 #ifndef PRODUCT
3396 // for debugging purposes
3397 void ConcurrentMark::print_finger() {
3398 gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT,
3399 p2i(_heap_start), p2i(_heap_end), p2i(_finger));
3400 for (uint i = 0; i < _max_worker_id; ++i) {
3401 gclog_or_tty->print(" %u: " PTR_FORMAT, i, p2i(_tasks[i]->finger()));
3402 }
3403 gclog_or_tty->cr();
3404 }
3405 #endif
3406
3407 void CMTask::scan_object(oop obj) {
3408 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), "invariant");
3409
3410 if (_cm->verbose_high()) {
3411 gclog_or_tty->print_cr("[%u] we're scanning object "PTR_FORMAT,
3412 _worker_id, p2i((void*) obj));
3413 }
3414
3415 size_t obj_size = obj->size();
3416 _words_scanned += obj_size;
3417
3418 obj->oop_iterate(_cm_oop_closure);
3419 statsOnly( ++_objs_scanned );
3420 check_limits();
3421 }
3422
3423 // Closure for iteration over bitmaps
3424 class CMBitMapClosure : public BitMapClosure {
3425 private:
3426 // the bitmap that is being iterated over
3427 CMBitMap* _nextMarkBitMap;
3428 ConcurrentMark* _cm;
3429 CMTask* _task;
3430
3431 public:
3432 CMBitMapClosure(CMTask *task, ConcurrentMark* cm, CMBitMap* nextMarkBitMap) :
3433 _task(task), _cm(cm), _nextMarkBitMap(nextMarkBitMap) { }
3434
3435 bool do_bit(size_t offset) {
3436 HeapWord* addr = _nextMarkBitMap->offsetToHeapWord(offset);
3437 assert(_nextMarkBitMap->isMarked(addr), "invariant");
3438 assert( addr < _cm->finger(), "invariant");
3439
3440 statsOnly( _task->increase_objs_found_on_bitmap() );
3441 assert(addr >= _task->finger(), "invariant");
|
3387 }
3388 SuspendibleThreadSet::yield();
3389 return true;
3390 } else {
3391 return false;
3392 }
3393 }
3394
3395 #ifndef PRODUCT
3396 // for debugging purposes
3397 void ConcurrentMark::print_finger() {
3398 gclog_or_tty->print_cr("heap ["PTR_FORMAT", "PTR_FORMAT"), global finger = "PTR_FORMAT,
3399 p2i(_heap_start), p2i(_heap_end), p2i(_finger));
3400 for (uint i = 0; i < _max_worker_id; ++i) {
3401 gclog_or_tty->print(" %u: " PTR_FORMAT, i, p2i(_tasks[i]->finger()));
3402 }
3403 gclog_or_tty->cr();
3404 }
3405 #endif
3406
3407 template<bool scan>
3408 inline void CMTask::process_grey_object(oop obj) {
3409 assert(scan || obj->is_typeArray(), "Skipping scan of grey non-typeArray");
3410 assert(_nextMarkBitMap->isMarked((HeapWord*) obj), "invariant");
3411
3412 if (_cm->verbose_high()) {
3413 gclog_or_tty->print_cr("[%u] processing grey object " PTR_FORMAT,
3414 _worker_id, p2i((void*) obj));
3415 }
3416
3417 size_t obj_size = obj->size();
3418 _words_scanned += obj_size;
3419
3420 if (scan) {
3421 obj->oop_iterate(_cm_oop_closure);
3422 }
3423 statsOnly( ++_objs_scanned );
3424 check_limits();
3425 }
3426
3427 template void CMTask::process_grey_object<true>(oop);
3428 template void CMTask::process_grey_object<false>(oop);
3429
3430 // Closure for iteration over bitmaps
3431 class CMBitMapClosure : public BitMapClosure {
3432 private:
3433 // the bitmap that is being iterated over
3434 CMBitMap* _nextMarkBitMap;
3435 ConcurrentMark* _cm;
3436 CMTask* _task;
3437
3438 public:
3439 CMBitMapClosure(CMTask *task, ConcurrentMark* cm, CMBitMap* nextMarkBitMap) :
3440 _task(task), _cm(cm), _nextMarkBitMap(nextMarkBitMap) { }
3441
3442 bool do_bit(size_t offset) {
3443 HeapWord* addr = _nextMarkBitMap->offsetToHeapWord(offset);
3444 assert(_nextMarkBitMap->isMarked(addr), "invariant");
3445 assert( addr < _cm->finger(), "invariant");
3446
3447 statsOnly( _task->increase_objs_found_on_bitmap() );
3448 assert(addr >= _task->finger(), "invariant");
|