--- a/src/hotspot/share/gc/g1/collectionSetChooser.cpp Mon Mar 26 16:51:41 2018 +0200
+++ b/src/hotspot/share/gc/g1/collectionSetChooser.cpp Mon Mar 26 16:51:43 2018 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -83,8 +83,7 @@
100), true /* C_Heap */),
_front(0), _end(0), _first_par_unreserved_idx(0),
_region_live_threshold_bytes(0), _remaining_reclaimable_bytes(0) {
- _region_live_threshold_bytes =
- HeapRegion::GrainBytes * (size_t) G1MixedGCLiveThresholdPercent / 100;
+ _region_live_threshold_bytes = mixed_gc_live_threshold_bytes();
}
#ifndef PRODUCT
@@ -203,6 +202,16 @@
}
}
+void CollectionSetChooser::iterate(HeapRegionClosure* cl) {
+ for (uint i = _front; i < _end; i++) {
+ HeapRegion* r = regions_at(i);
+ if (cl->do_heap_region(r)) {
+ cl->set_incomplete();
+ break;
+ }
+ }
+}
+
void CollectionSetChooser::clear() {
_regions.clear();
_front = 0;
@@ -259,6 +268,17 @@
return MAX2(n_regions / (n_workers * overpartition_factor), min_chunk_size);
}
+bool CollectionSetChooser::region_occupancy_low_enough_for_evac(size_t live_bytes) {
+ return live_bytes < mixed_gc_live_threshold_bytes();
+}
+
+bool CollectionSetChooser::should_add(HeapRegion* hr) const {
+ assert(hr->is_marked(), "pre-condition");
+ assert(!hr->is_young(), "should never consider young regions");
+ return !hr->is_pinned() &&
+ region_occupancy_low_enough_for_evac(hr->live_bytes());
+}
+
void CollectionSetChooser::rebuild(WorkGang* workers, uint n_regions) {
clear();