1211
1212 g1p->record_concurrent_mark_remark_end();
1213 }
1214
1215 class G1ReclaimEmptyRegionsTask : public AbstractGangTask {
1216 // Per-region work during the Cleanup pause.
1217 class G1ReclaimEmptyRegionsClosure : public HeapRegionClosure {
1218 G1CollectedHeap* _g1h;
1219 size_t _freed_bytes;
1220 FreeRegionList* _local_cleanup_list;
1221 uint _old_regions_removed;
1222 uint _humongous_regions_removed;
1223
1224 public:
1225 G1ReclaimEmptyRegionsClosure(G1CollectedHeap* g1h,
1226 FreeRegionList* local_cleanup_list) :
1227 _g1h(g1h),
1228 _freed_bytes(0),
1229 _local_cleanup_list(local_cleanup_list),
1230 _old_regions_removed(0),
1231 _humongous_regions_removed(0){ }
1232
1233 size_t freed_bytes() { return _freed_bytes; }
1234 const uint old_regions_removed() { return _old_regions_removed; }
1235 const uint humongous_regions_removed() { return _humongous_regions_removed; }
1236
1237 bool do_heap_region(HeapRegion *hr) {
1238 if (hr->used() > 0 && hr->max_live_bytes() == 0 && !hr->is_young() && !hr->is_archive()) {
1239 _freed_bytes += hr->used();
1240 hr->set_containing_set(NULL);
1241 if (hr->is_humongous()) {
1242 _humongous_regions_removed++;
1243 _g1h->free_humongous_region(hr, _local_cleanup_list);
1244 } else {
1245 _old_regions_removed++;
1246 _g1h->free_region(hr, _local_cleanup_list, false /* skip_remset */, false /* skip_hcc */, true /* locked */);
1247 }
1248 hr->clear_cardtable();
1249 _g1h->concurrent_mark()->clear_statistics_in_region(hr->hrm_index());
1250 log_trace(gc)("Reclaimed empty region %u (%s) bot " PTR_FORMAT, hr->hrm_index(), hr->get_short_type_str(), p2i(hr->bottom()));
1251 }
|
1211
1212 g1p->record_concurrent_mark_remark_end();
1213 }
1214
1215 class G1ReclaimEmptyRegionsTask : public AbstractGangTask {
1216 // Per-region work during the Cleanup pause.
1217 class G1ReclaimEmptyRegionsClosure : public HeapRegionClosure {
1218 G1CollectedHeap* _g1h;
1219 size_t _freed_bytes;
1220 FreeRegionList* _local_cleanup_list;
1221 uint _old_regions_removed;
1222 uint _humongous_regions_removed;
1223
1224 public:
1225 G1ReclaimEmptyRegionsClosure(G1CollectedHeap* g1h,
1226 FreeRegionList* local_cleanup_list) :
1227 _g1h(g1h),
1228 _freed_bytes(0),
1229 _local_cleanup_list(local_cleanup_list),
1230 _old_regions_removed(0),
1231 _humongous_regions_removed(0) { }
1232
1233 size_t freed_bytes() { return _freed_bytes; }
1234 const uint old_regions_removed() { return _old_regions_removed; }
1235 const uint humongous_regions_removed() { return _humongous_regions_removed; }
1236
1237 bool do_heap_region(HeapRegion *hr) {
1238 if (hr->used() > 0 && hr->max_live_bytes() == 0 && !hr->is_young() && !hr->is_archive()) {
1239 _freed_bytes += hr->used();
1240 hr->set_containing_set(NULL);
1241 if (hr->is_humongous()) {
1242 _humongous_regions_removed++;
1243 _g1h->free_humongous_region(hr, _local_cleanup_list);
1244 } else {
1245 _old_regions_removed++;
1246 _g1h->free_region(hr, _local_cleanup_list, false /* skip_remset */, false /* skip_hcc */, true /* locked */);
1247 }
1248 hr->clear_cardtable();
1249 _g1h->concurrent_mark()->clear_statistics_in_region(hr->hrm_index());
1250 log_trace(gc)("Reclaimed empty region %u (%s) bot " PTR_FORMAT, hr->hrm_index(), hr->get_short_type_str(), p2i(hr->bottom()));
1251 }
|