src/share/vm/gc/g1/g1ConcurrentMark.cpp
Print this page
@@ -644,11 +644,11 @@
G1ConcurrentMark::~G1ConcurrentMark() {
// The G1ConcurrentMark instance is never freed.
ShouldNotReachHere();
}
-class G1ClearBitMapTask : public AbstractGangTask {
+class G1ClearBitMapTask : public G1ParallelizeByRegionsTask {
public:
static size_t chunk_size() { return M; }
private:
// Heap region closure used for clearing the given mark bitmap.
@@ -688,24 +688,22 @@
return false;
}
};
G1ClearBitmapHRClosure _cl;
- HeapRegionClaimer _hr_claimer;
bool _suspendible; // If the task is suspendible, workers must join the STS.
public:
G1ClearBitMapTask(G1CMBitMap* bitmap, G1ConcurrentMark* cm, uint n_workers, bool suspendible) :
- AbstractGangTask("G1 Clear Bitmap"),
+ G1ParallelizeByRegionsTask("G1 Clear Bitmap", n_workers),
_cl(bitmap, suspendible ? cm : NULL),
- _hr_claimer(n_workers),
_suspendible(suspendible)
{ }
void work(uint worker_id) {
SuspendibleThreadSetJoiner sts_join(_suspendible);
- G1CollectedHeap::heap()->heap_region_par_iterate(&_cl, worker_id, &_hr_claimer, true);
+ all_heap_regions_work(&_cl, worker_id, true);
}
bool is_complete() {
return _cl.complete();
}
@@ -1173,19 +1171,20 @@
G1CMIsAliveClosure is_alive(g1h);
_gc_tracer_cm->report_object_count_after_gc(&is_alive);
}
-class G1NoteEndOfConcMarkClosure : public HeapRegionClosure {
+class G1ParNoteEndTask: public G1ParallelizeByRegionsTask {
+ class G1NoteEndOfConcMarkClosure : public HeapRegionClosure {
G1CollectedHeap* _g1;
size_t _freed_bytes;
FreeRegionList* _local_cleanup_list;
uint _old_regions_removed;
uint _humongous_regions_removed;
HRRSCleanupTask* _hrrs_cleanup_task;
-public:
+ public:
G1NoteEndOfConcMarkClosure(G1CollectedHeap* g1,
FreeRegionList* local_cleanup_list,
HRRSCleanupTask* hrrs_cleanup_task) :
_g1(g1),
_freed_bytes(0),
@@ -1219,31 +1218,27 @@
hr->rem_set()->do_cleanup_work(_hrrs_cleanup_task);
}
return false;
}
-};
-
-class G1ParNoteEndTask: public AbstractGangTask {
- friend class G1NoteEndOfConcMarkClosure;
+ };
protected:
G1CollectedHeap* _g1h;
FreeRegionList* _cleanup_list;
- HeapRegionClaimer _hrclaimer;
public:
G1ParNoteEndTask(G1CollectedHeap* g1h, FreeRegionList* cleanup_list, uint n_workers) :
- AbstractGangTask("G1 note end"), _g1h(g1h), _cleanup_list(cleanup_list), _hrclaimer(n_workers) {
+ G1ParallelizeByRegionsTask("G1 note end", n_workers), _g1h(g1h), _cleanup_list(cleanup_list) {
}
void work(uint worker_id) {
FreeRegionList local_cleanup_list("Local Cleanup List");
HRRSCleanupTask hrrs_cleanup_task;
G1NoteEndOfConcMarkClosure g1_note_end(_g1h, &local_cleanup_list,
&hrrs_cleanup_task);
- _g1h->heap_region_par_iterate(&g1_note_end, worker_id, &_hrclaimer);
+ all_heap_regions_work(&g1_note_end, worker_id );
assert(g1_note_end.complete(), "Shouldn't have yielded!");
// Now update the lists
_g1h->remove_from_old_sets(g1_note_end.old_regions_removed(), g1_note_end.humongous_regions_removed());
{