686 assert(cur == end, "Must have completed iteration over the bitmap for region %u.", r->hrm_index());
687
688 return false;
689 }
690 };
691
692 G1ClearBitmapHRClosure _cl;
693 HeapRegionClaimer _hr_claimer;
694 bool _suspendible; // If the task is suspendible, workers must join the STS.
695
696 public:
697 G1ClearBitMapTask(G1CMBitMap* bitmap, G1ConcurrentMark* cm, uint n_workers, bool suspendible) :
698 AbstractGangTask("G1 Clear Bitmap"),
699 _cl(bitmap, suspendible ? cm : NULL),
700 _hr_claimer(n_workers),
701 _suspendible(suspendible)
702 { }
703
704 void work(uint worker_id) {
705 SuspendibleThreadSetJoiner sts_join(_suspendible);
706 G1CollectedHeap::heap()->heap_region_par_iterate(&_cl, worker_id, &_hr_claimer, true);
707 }
708
709 bool is_complete() {
710 return _cl.complete();
711 }
712 };
713
714 void G1ConcurrentMark::clear_bitmap(G1CMBitMap* bitmap, WorkGang* workers, bool may_yield) {
715 assert(may_yield || SafepointSynchronize::is_at_safepoint(), "Non-yielding bitmap clear only allowed at safepoint.");
716
717 size_t const num_bytes_to_clear = (HeapRegion::GrainBytes * _g1h->num_regions()) / G1CMBitMap::heap_map_factor();
718 size_t const num_chunks = align_size_up(num_bytes_to_clear, G1ClearBitMapTask::chunk_size()) / G1ClearBitMapTask::chunk_size();
719
720 uint const num_workers = (uint)MIN2(num_chunks, (size_t)workers->active_workers());
721
722 G1ClearBitMapTask cl(bitmap, this, num_workers, may_yield);
723
724 log_debug(gc, ergo)("Running %s with %u workers for " SIZE_FORMAT " work units.", cl.name(), num_workers, num_chunks);
725 workers->run_task(&cl, num_workers);
726 guarantee(!may_yield || cl.is_complete(), "Must have completed iteration when not yielding.");
|
686 assert(cur == end, "Must have completed iteration over the bitmap for region %u.", r->hrm_index());
687
688 return false;
689 }
690 };
691
692 G1ClearBitmapHRClosure _cl;
693 HeapRegionClaimer _hr_claimer;
694 bool _suspendible; // If the task is suspendible, workers must join the STS.
695
696 public:
697 G1ClearBitMapTask(G1CMBitMap* bitmap, G1ConcurrentMark* cm, uint n_workers, bool suspendible) :
698 AbstractGangTask("G1 Clear Bitmap"),
699 _cl(bitmap, suspendible ? cm : NULL),
700 _hr_claimer(n_workers),
701 _suspendible(suspendible)
702 { }
703
704 void work(uint worker_id) {
705 SuspendibleThreadSetJoiner sts_join(_suspendible);
706 G1CollectedHeap::heap()->heap_region_par_iterate(&_cl, worker_id, &_hr_claimer);
707 }
708
709 bool is_complete() {
710 return _cl.complete();
711 }
712 };
713
714 void G1ConcurrentMark::clear_bitmap(G1CMBitMap* bitmap, WorkGang* workers, bool may_yield) {
715 assert(may_yield || SafepointSynchronize::is_at_safepoint(), "Non-yielding bitmap clear only allowed at safepoint.");
716
717 size_t const num_bytes_to_clear = (HeapRegion::GrainBytes * _g1h->num_regions()) / G1CMBitMap::heap_map_factor();
718 size_t const num_chunks = align_size_up(num_bytes_to_clear, G1ClearBitMapTask::chunk_size()) / G1ClearBitMapTask::chunk_size();
719
720 uint const num_workers = (uint)MIN2(num_chunks, (size_t)workers->active_workers());
721
722 G1ClearBitMapTask cl(bitmap, this, num_workers, may_yield);
723
724 log_debug(gc, ergo)("Running %s with %u workers for " SIZE_FORMAT " work units.", cl.name(), num_workers, num_chunks);
725 workers->run_task(&cl, num_workers);
726 guarantee(!may_yield || cl.is_complete(), "Must have completed iteration when not yielding.");
|