mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-02 06:28:23 +00:00
8367743: G1: Use named constants for G1CSetCandidateGroup group ids
Reviewed-by: ayang, iwalulya
This commit is contained in:
parent
5730e908c6
commit
005f3a392f
@ -1200,7 +1200,7 @@ G1CollectedHeap::G1CollectedHeap() :
|
||||
_rem_set(nullptr),
|
||||
_card_set_config(),
|
||||
_card_set_freelist_pool(G1CardSetConfiguration::num_mem_object_types()),
|
||||
_young_regions_cset_group(card_set_config(), &_card_set_freelist_pool, 1u /* group_id */),
|
||||
_young_regions_cset_group(card_set_config(), &_card_set_freelist_pool, G1CSetCandidateGroup::YoungRegionId),
|
||||
_cm(nullptr),
|
||||
_cm_thread(nullptr),
|
||||
_cr(nullptr),
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
#include "gc/g1/g1HeapRegion.inline.hpp"
|
||||
#include "utilities/growableArray.hpp"
|
||||
|
||||
uint G1CSetCandidateGroup::_next_group_id = 2;
|
||||
uint G1CSetCandidateGroup::_next_group_id = G1CSetCandidateGroup::InitialId;
|
||||
|
||||
G1CSetCandidateGroup::G1CSetCandidateGroup(G1CardSetConfiguration* config, G1MonotonicArenaFreePool* card_set_freelist_pool, uint group_id) :
|
||||
_candidates(4, mtGCCardSet),
|
||||
|
||||
@ -73,14 +73,21 @@ class G1CSetCandidateGroup : public CHeapObj<mtGCCardSet>{
|
||||
size_t _reclaimable_bytes;
|
||||
double _gc_efficiency;
|
||||
|
||||
// The _group_id is primarily used when printing out per-region liveness information,
|
||||
// making it easier to associate regions with their assigned G1CSetCandidateGroup, if any.
|
||||
// Note:
|
||||
// * _group_id 0 is reserved for special G1CSetCandidateGroups that hold only a single region,
|
||||
// such as G1CSetCandidateGroups for retained regions.
|
||||
// * _group_id 1 is reserved for the G1CSetCandidateGroup that contains all young regions.
|
||||
public:
|
||||
// The _group_id uniquely identifies a candidate group when printing, making it
|
||||
// easier to associate regions with their assigned G1CSetCandidateGroup, if any.
|
||||
// Special values for the id:
|
||||
// * id 0 is reserved for regions that do not have a remembered set.
|
||||
// * id 1 is reserved for the G1CollectionSetCandidate that contains all young regions.
|
||||
// * other ids are handed out incrementally, starting from InitialId.
|
||||
static const uint NoRemSetId = 0;
|
||||
static const uint YoungRegionId = 1;
|
||||
static const uint InitialId = 2;
|
||||
|
||||
private:
|
||||
const uint _group_id;
|
||||
static uint _next_group_id;
|
||||
|
||||
public:
|
||||
G1CSetCandidateGroup();
|
||||
G1CSetCandidateGroup(G1CardSetConfiguration* config, G1MonotonicArenaFreePool* card_set_freelist_pool, uint group_id);
|
||||
@ -95,8 +102,6 @@ public:
|
||||
G1CardSet* card_set() { return &_card_set; }
|
||||
const G1CardSet* card_set() const { return &_card_set; }
|
||||
|
||||
uint group_id() const { return _group_id; }
|
||||
|
||||
void calculate_efficiency();
|
||||
|
||||
double liveness_percent() const;
|
||||
@ -127,8 +132,10 @@ public:
|
||||
return _candidates.end();
|
||||
}
|
||||
|
||||
uint group_id() const { return _group_id; }
|
||||
|
||||
static void reset_next_group_id() {
|
||||
_next_group_id = 2;
|
||||
_next_group_id = InitialId;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -3052,11 +3052,9 @@ bool G1PrintRegionLivenessInfoClosure::do_heap_region(G1HeapRegion* r) {
|
||||
size_t remset_bytes = r->rem_set()->mem_size();
|
||||
size_t code_roots_bytes = r->rem_set()->code_roots_mem_size();
|
||||
const char* remset_type = r->rem_set()->get_short_state_str();
|
||||
uint cset_group_id = 0;
|
||||
|
||||
if (r->rem_set()->has_cset_group()) {
|
||||
cset_group_id = r->rem_set()->cset_group_id();
|
||||
}
|
||||
uint cset_group_id = r->rem_set()->has_cset_group()
|
||||
? r->rem_set()->cset_group_id()
|
||||
: G1CSetCandidateGroup::NoRemSetId;
|
||||
|
||||
_total_used_bytes += used_bytes;
|
||||
_total_capacity_bytes += capacity_bytes;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user