8223693: Memory wastage in size of per-region type buffers in GC
Reviewed-by: kbarrett, sangheki
--- a/src/hotspot/share/gc/g1/g1HeapRegionAttr.hpp Mon Jun 03 10:50:14 2019 +0200
+++ b/src/hotspot/share/gc/g1/g1HeapRegionAttr.hpp Mon Jun 03 10:51:28 2019 +0200
@@ -54,14 +54,14 @@
// The selected encoding allows us to use a single check (> NotInCSet) for the
// former.
//
- // The other values are used for objects requiring various special cases,
- // for example eager reclamation of humongous objects or optional regions.
- static const region_type_t Optional = -2; // The region is optional and NOT in the current collection set.
- static const region_type_t Humongous = -1; // The region is a humongous candidate not in the current collection set.
- static const region_type_t NotInCSet = 0; // The region is not in the collection set.
- static const region_type_t Young = 1; // The region is in the collection set and a young region.
- static const region_type_t Old = 2; // The region is in the collection set and an old region.
- static const region_type_t Num = 3;
+ // The other values are used for objects in regions requiring various special handling,
+ // eager reclamation of humongous objects or optional regions.
+ static const region_type_t Optional = -3; // The region is optional not in the current collection set.
+ static const region_type_t Humongous = -2; // The region is a humongous candidate not in the current collection set.
+ static const region_type_t NotInCSet = -1; // The region is not in the collection set.
+ static const region_type_t Young = 0; // The region is in the collection set and a young region.
+ static const region_type_t Old = 1; // The region is in the collection set and an old region.
+ static const region_type_t Num = 2;
G1HeapRegionAttr(region_type_t type = NotInCSet, bool needs_remset_update = false) :
_needs_remset_update(needs_remset_update), _type(type) {
@@ -92,7 +92,7 @@
void set_has_remset(bool value) { _needs_remset_update = value ? 1 : 0; }
bool is_in_cset_or_humongous() const { return is_in_cset() || is_humongous(); }
- bool is_in_cset() const { return type() > NotInCSet; }
+ bool is_in_cset() const { return type() >= Young; }
bool is_humongous() const { return type() == Humongous; }
bool is_young() const { return type() == Young; }
--- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp Mon Jun 03 10:50:14 2019 +0200
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp Mon Jun 03 10:51:28 2019 +0200
@@ -75,7 +75,6 @@
_plab_allocator = new G1PLABAllocator(_g1h->allocator());
- _dest[G1HeapRegionAttr::NotInCSet] = G1HeapRegionAttr::NotInCSet;
// The dest for Young is used when the objects are aged enough to
// need to be moved to the next space.
_dest[G1HeapRegionAttr::Young] = G1HeapRegionAttr::Old;