< prev index next >
src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
Print this page
rev 49511 : imported patch 8200234-g1concurrentmark-refactorings
rev 49512 : imported patch 8200234-stefanj-review
rev 49515 : 8200255: Remove G1CMTask::_concurrent
Reviewed-by: sangheki, sjohanss
rev 49516 : 8200074: Remove G1ConcurrentMark::_concurrent_marking_in_progress
Reviewed-by: sjohanss, sangheki
rev 49517 : imported patch 8200305-gc,liveness-output
rev 49518 : imported patch 8200385-prev-bitmap-marks-left
rev 49519 : imported patch 8200385-stefanj-review
rev 49520 : imported patch 8178105-switch-at-remark
rev 49521 : imported patch 8178105-stefanj-review
rev 49522 : imported patch 8178105-stefanj-review2
rev 49523 : imported patch 8154528-reclaim-at-remark
rev 49524 : [mq]: 8154528-stefanj-review
@@ -1136,10 +1136,22 @@
G1UpdateRemSetTrackingBeforeRebuild cl(_g1h, this);
_g1h->heap_region_iterate(&cl);
log_debug(gc, remset, tracking)("Remembered Set Tracking update regions total %u, selected %u",
_g1h->num_regions(), cl.num_selected_for_rebuild());
}
+ {
+ GCTraceTime(Debug, gc, phases)("Reclaim Empty Regions");
+ reclaim_empty_regions();
+ }
+
+ // Clean out dead classes
+ if (ClassUnloadingWithConcurrentMark) {
+ GCTraceTime(Debug, gc, phases)("Purge Metaspace");
+ ClassLoaderDataGraph::purge();
+ }
+
+ compute_new_sizes();
verify_during_pause(G1HeapVerifier::G1VerifyRemark, VerifyOption_G1UsePrevMarking, "Remark after");
assert(!restart_for_overflow(), "sanity");
// Completely reset the marking state since marking completed
@@ -1167,22 +1179,22 @@
_remark_times.add((now - start) * 1000.0);
g1p->record_concurrent_mark_remark_end();
}
-class G1CleanupTask : public AbstractGangTask {
+class G1ReclaimEmptyRegionsTask : public AbstractGangTask {
// Per-region work during the Cleanup pause.
- class G1CleanupRegionsClosure : public HeapRegionClosure {
+ class G1ReclaimEmptyRegionsClosure : public HeapRegionClosure {
G1CollectedHeap* _g1h;
size_t _freed_bytes;
FreeRegionList* _local_cleanup_list;
uint _old_regions_removed;
uint _humongous_regions_removed;
HRRSCleanupTask* _hrrs_cleanup_task;
public:
- G1CleanupRegionsClosure(G1CollectedHeap* g1,
+ G1ReclaimEmptyRegionsClosure(G1CollectedHeap* g1,
FreeRegionList* local_cleanup_list,
HRRSCleanupTask* hrrs_cleanup_task) :
_g1h(g1),
_freed_bytes(0),
_local_cleanup_list(local_cleanup_list),
@@ -1219,11 +1231,11 @@
G1CollectedHeap* _g1h;
FreeRegionList* _cleanup_list;
HeapRegionClaimer _hrclaimer;
public:
- G1CleanupTask(G1CollectedHeap* g1h, FreeRegionList* cleanup_list, uint n_workers) :
+ G1ReclaimEmptyRegionsTask(G1CollectedHeap* g1h, FreeRegionList* cleanup_list, uint n_workers) :
AbstractGangTask("G1 Cleanup"),
_g1h(g1h),
_cleanup_list(cleanup_list),
_hrclaimer(n_workers) {
@@ -1231,11 +1243,11 @@
}
void work(uint worker_id) {
FreeRegionList local_cleanup_list("Local Cleanup List");
HRRSCleanupTask hrrs_cleanup_task;
- G1CleanupRegionsClosure cl(_g1h,
+ G1ReclaimEmptyRegionsClosure cl(_g1h,
&local_cleanup_list,
&hrrs_cleanup_task);
_g1h->heap_region_par_iterate_from_worker_offset(&cl, &_hrclaimer, worker_id);
assert(cl.is_complete(), "Shouldn't have aborted!");
@@ -1255,11 +1267,11 @@
void G1ConcurrentMark::reclaim_empty_regions() {
WorkGang* workers = _g1h->workers();
FreeRegionList empty_regions_list("Empty Regions After Mark List");
- G1CleanupTask cl(_g1h, &empty_regions_list, workers->active_workers());
+ G1ReclaimEmptyRegionsTask cl(_g1h, &empty_regions_list, workers->active_workers());
workers->run_task(&cl);
if (!empty_regions_list.is_empty()) {
log_debug(gc)("Reclaimed %u empty regions", empty_regions_list.length());
// Now print the empty regions list.
@@ -1274,10 +1286,22 @@
// And actually make them available.
_g1h->prepend_to_freelist(&empty_regions_list);
}
}
+void G1ConcurrentMark::compute_new_sizes() {
+ MetaspaceGC::compute_new_size();
+
+ // Cleanup will have freed any regions completely full of garbage.
+ // Update the soft reference policy with the new heap occupancy.
+ Universe::update_heap_info_at_gc();
+
+ // We reclaimed old regions so we should calculate the sizes to make
+ // sure we update the old gen/space data.
+ _g1h->g1mm()->update_sizes();
+}
+
void G1ConcurrentMark::cleanup() {
assert_at_safepoint_on_vm_thread();
// If a full collection has happened, we shouldn't do this.
if (has_aborted()) {
@@ -1300,30 +1324,10 @@
if (log_is_enabled(Trace, gc, liveness)) {
G1PrintRegionLivenessInfoClosure cl("Post-Cleanup");
_g1h->heap_region_iterate(&cl);
}
- {
- GCTraceTime(Debug, gc, phases)("Reclaim Empty Regions");
- reclaim_empty_regions();
- }
-
- // Cleanup will have freed any regions completely full of garbage.
- // Update the soft reference policy with the new heap occupancy.
- Universe::update_heap_info_at_gc();
-
- // Clean out dead classes and update Metaspace sizes.
- if (ClassUnloadingWithConcurrentMark) {
- GCTraceTime(Debug, gc, phases)("Purge Metaspace");
- ClassLoaderDataGraph::purge();
- }
- MetaspaceGC::compute_new_size();
-
- // We reclaimed old regions so we should calculate the sizes to make
- // sure we update the old gen/space data.
- _g1h->g1mm()->update_sizes();
-
verify_during_pause(G1HeapVerifier::G1VerifyCleanup, VerifyOption_G1UsePrevMarking, "Cleanup after");
// We need to make this be a "collection" so any collection pause that
// races with it goes around and waits for Cleanup to finish.
_g1h->increment_total_collections();
< prev index next >