mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-02 23:30:29 +00:00
8386247: G1: Cleanup naming and type use of G1CollectionSet class members and methods
Reviewed-by: stefank, ayang, iwalulya
This commit is contained in:
parent
32f77f7437
commit
01482ad607
@ -37,13 +37,13 @@
|
||||
#include "utilities/debug.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
uint G1CollectionSet::groups_cur_length() const {
|
||||
uint G1CollectionSet::num_groups() const {
|
||||
assert(_inc_build_state == CSetBuildType::Inactive, "must be");
|
||||
return _groups.length();
|
||||
}
|
||||
|
||||
uint G1CollectionSet::groups_increment_length() const {
|
||||
return groups_cur_length() - _groups_inc_part_start;
|
||||
uint G1CollectionSet::num_groups_in_increment() const {
|
||||
return num_groups() - _groups_inc_part_start;
|
||||
}
|
||||
|
||||
G1CollectorState* G1CollectionSet::collector_state() const {
|
||||
@ -59,12 +59,12 @@ G1CollectionSet::G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy) :
|
||||
_policy(policy),
|
||||
_candidates(),
|
||||
_regions(nullptr),
|
||||
_regions_max_length(0),
|
||||
_regions_cur_length(0),
|
||||
_max_num_regions(0),
|
||||
_num_regions(0),
|
||||
_groups(),
|
||||
_eden_region_length(0),
|
||||
_survivor_region_length(0),
|
||||
_initial_old_region_length(0),
|
||||
_num_eden_regions(0),
|
||||
_num_survivor_regions(0),
|
||||
_num_initial_old_regions(0),
|
||||
_optional_groups(),
|
||||
DEBUG_ONLY(_inc_build_state(CSetBuildType::Inactive) COMMA)
|
||||
_regions_inc_part_start(0),
|
||||
@ -76,27 +76,27 @@ G1CollectionSet::~G1CollectionSet() {
|
||||
abandon_all_candidates();
|
||||
}
|
||||
|
||||
void G1CollectionSet::init_region_lengths(uint eden_cset_region_length,
|
||||
uint survivor_cset_region_length) {
|
||||
void G1CollectionSet::prepare_for_collection(uint num_eden_cset_regions,
|
||||
uint num_survivor_cset_regions) {
|
||||
assert_at_safepoint_on_vm_thread();
|
||||
|
||||
_eden_region_length = eden_cset_region_length;
|
||||
_survivor_region_length = survivor_cset_region_length;
|
||||
_num_eden_regions = num_eden_cset_regions;
|
||||
_num_survivor_regions = num_survivor_cset_regions;
|
||||
|
||||
assert((size_t)young_region_length() == _regions_cur_length,
|
||||
"Young region length %u should match collection set length %u", young_region_length(), _regions_cur_length);
|
||||
assert(num_young_regions() == num_regions(),
|
||||
"Young region amount %u should match collection set region amount %u", num_young_regions(), num_regions());
|
||||
|
||||
_initial_old_region_length = 0;
|
||||
_num_initial_old_regions = 0;
|
||||
assert(_optional_groups.length() == 0, "Should not have any optional groups yet");
|
||||
_optional_groups.clear();
|
||||
}
|
||||
|
||||
void G1CollectionSet::initialize(uint max_region_length) {
|
||||
void G1CollectionSet::initialize(uint max_num_regions) {
|
||||
guarantee(_regions == nullptr, "Must only initialize once.");
|
||||
_regions_max_length = max_region_length;
|
||||
_regions = NEW_C_HEAP_ARRAY(uint, max_region_length, mtGC);
|
||||
_max_num_regions = max_num_regions;
|
||||
_regions = NEW_C_HEAP_ARRAY(uint, max_num_regions, mtGC);
|
||||
|
||||
_candidates.initialize(max_region_length);
|
||||
_candidates.initialize(max_num_regions);
|
||||
}
|
||||
|
||||
void G1CollectionSet::abandon() {
|
||||
@ -109,7 +109,7 @@ void G1CollectionSet::abandon() {
|
||||
|
||||
void G1CollectionSet::abandon_all_candidates() {
|
||||
_candidates.clear();
|
||||
_initial_old_region_length = 0;
|
||||
_num_initial_old_regions = 0;
|
||||
}
|
||||
|
||||
void G1CollectionSet::prepare_for_scan () {
|
||||
@ -128,17 +128,18 @@ void G1CollectionSet::add_old_region(G1HeapRegion* hr) {
|
||||
|
||||
_g1h->register_old_collection_set_region_with_region_attr(hr);
|
||||
|
||||
assert(_regions_cur_length < _regions_max_length, "Collection set now larger than maximum size.");
|
||||
_regions[_regions_cur_length++] = hr->hrm_index();
|
||||
_initial_old_region_length++;
|
||||
assert(num_regions() < _max_num_regions, "Collection set now larger than maximum size.");
|
||||
_regions[_num_regions++] = hr->hrm_index();
|
||||
_num_initial_old_regions++;
|
||||
|
||||
_g1h->old_set_remove(hr);
|
||||
}
|
||||
|
||||
void G1CollectionSet::start() {
|
||||
assert(_regions_cur_length == 0, "Collection set must be empty before starting a new collection set.");
|
||||
assert(groups_cur_length() == 0, "Collection set groups must be empty before starting a new collection set.");
|
||||
assert(_optional_groups.length() == 0, "Collection set optional gorups must be empty before starting a new collection set.");
|
||||
assert(num_regions() == 0, "Collection set must be empty before starting a new collection set.");
|
||||
assert(num_groups() == 0, "Collection set groups must be empty before starting a new collection set.");
|
||||
assert(_optional_groups.length() == 0,
|
||||
"Collection set optional groups must be empty before starting a new collection set.");
|
||||
|
||||
continue_incremental_building();
|
||||
|
||||
@ -149,8 +150,8 @@ void G1CollectionSet::start() {
|
||||
void G1CollectionSet::continue_incremental_building() {
|
||||
assert(_inc_build_state == CSetBuildType::Inactive, "Precondition");
|
||||
|
||||
_regions_inc_part_start = _regions_cur_length;
|
||||
_groups_inc_part_start = groups_cur_length();
|
||||
_regions_inc_part_start = num_regions();
|
||||
_groups_inc_part_start = num_groups();
|
||||
|
||||
DEBUG_ONLY(_inc_build_state = CSetBuildType::Active;)
|
||||
}
|
||||
@ -161,13 +162,13 @@ void G1CollectionSet::stop_incremental_building() {
|
||||
|
||||
void G1CollectionSet::clear() {
|
||||
assert_at_safepoint_on_vm_thread();
|
||||
_regions_cur_length = 0;
|
||||
_num_regions = 0;
|
||||
_groups.clear();
|
||||
assert(_optional_groups.length() == 0, "must be");
|
||||
}
|
||||
|
||||
void G1CollectionSet::iterate(G1HeapRegionClosure* cl) const {
|
||||
size_t len = _regions_cur_length;
|
||||
uint len = _num_regions;
|
||||
OrderAccess::loadload();
|
||||
|
||||
for (uint i = 0; i < len; i++) {
|
||||
@ -182,7 +183,7 @@ void G1CollectionSet::iterate(G1HeapRegionClosure* cl) const {
|
||||
void G1CollectionSet::par_iterate(G1HeapRegionClosure* cl,
|
||||
G1HeapRegionClaimer* hr_claimer,
|
||||
uint worker_id) const {
|
||||
iterate_part_from(cl, hr_claimer, 0, cur_length(), worker_id);
|
||||
iterate_part_from(cl, hr_claimer, 0, num_regions(), worker_id);
|
||||
}
|
||||
|
||||
void G1CollectionSet::iterate_optional(G1HeapRegionClosure* cl) const {
|
||||
@ -197,13 +198,13 @@ void G1CollectionSet::iterate_optional(G1HeapRegionClosure* cl) const {
|
||||
void G1CollectionSet::iterate_incremental_part_from(G1HeapRegionClosure* cl,
|
||||
G1HeapRegionClaimer* hr_claimer,
|
||||
uint worker_id) const {
|
||||
iterate_part_from(cl, hr_claimer, _regions_inc_part_start, regions_cur_length(), worker_id);
|
||||
iterate_part_from(cl, hr_claimer, _regions_inc_part_start, num_regions_in_increment(), worker_id);
|
||||
}
|
||||
|
||||
void G1CollectionSet::iterate_part_from(G1HeapRegionClosure* cl,
|
||||
G1HeapRegionClaimer* hr_claimer,
|
||||
size_t offset,
|
||||
size_t length,
|
||||
uint offset,
|
||||
uint length,
|
||||
uint worker_id) const {
|
||||
_g1h->par_iterate_regions_array(cl,
|
||||
hr_claimer,
|
||||
@ -223,17 +224,17 @@ void G1CollectionSet::add_young_region_common(G1HeapRegion* hr) {
|
||||
// Synchronize with the region attribute table.
|
||||
_g1h->register_young_region_with_region_attr(hr);
|
||||
|
||||
uint index = num_regions();
|
||||
// We use UINT_MAX as "invalid" marker in verification.
|
||||
assert(_regions_cur_length < (UINT_MAX - 1),
|
||||
"Collection set is too large with %u entries", _regions_cur_length);
|
||||
hr->set_young_index_in_cset(_regions_cur_length + 1);
|
||||
assert(index < (UINT_MAX - 1), "Collection set is too large with %u entries", index);
|
||||
hr->set_young_index_in_cset(index + 1);
|
||||
|
||||
assert(_regions_cur_length < _regions_max_length, "Collection set larger than maximum allowed.");
|
||||
_regions[_regions_cur_length] = hr->hrm_index();
|
||||
assert(index < _max_num_regions, "Collection set larger than maximum allowed.");
|
||||
_regions[index] = hr->hrm_index();
|
||||
// Concurrent readers must observe the store of the value in the array before an
|
||||
// update to the length field.
|
||||
// update to the _num_regions field.
|
||||
OrderAccess::storestore();
|
||||
_regions_cur_length++;
|
||||
_num_regions++;
|
||||
}
|
||||
|
||||
void G1CollectionSet::add_survivor_regions(G1HeapRegion* hr) {
|
||||
@ -335,9 +336,9 @@ double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1Survi
|
||||
// pause are appended to the RHS of the young list, i.e.
|
||||
// [Newly Young Regions ++ Survivors from last pause].
|
||||
|
||||
uint eden_region_length = _g1h->eden_regions_count();
|
||||
uint survivor_region_length = survivors->length();
|
||||
init_region_lengths(eden_region_length, survivor_region_length);
|
||||
uint num_eden_regions = _g1h->eden_regions_count();
|
||||
uint num_survivor_regions = survivors->length();
|
||||
prepare_for_collection(num_eden_regions, num_survivor_regions);
|
||||
|
||||
verify_young_cset_indices();
|
||||
|
||||
@ -345,13 +346,13 @@ double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1Survi
|
||||
double predicted_base_time_ms = _policy->predict_base_time_ms(pending_cards, card_rs_length);
|
||||
// Base time already includes the whole remembered set related time, so do not add that here
|
||||
// again.
|
||||
double predicted_eden_time = _policy->predict_young_region_other_time_ms(eden_region_length) +
|
||||
_policy->predict_eden_copy_time_ms(eden_region_length);
|
||||
double predicted_eden_time = _policy->predict_young_region_other_time_ms(num_eden_regions) +
|
||||
_policy->predict_eden_copy_time_ms(num_eden_regions);
|
||||
double remaining_time_ms = MAX2(target_pause_time_ms - (predicted_base_time_ms + predicted_eden_time), 0.0);
|
||||
|
||||
log_trace(gc, ergo, cset)("Added young regions to CSet. Eden: %u regions, Survivors: %u regions, "
|
||||
"predicted eden time: %1.2fms, predicted base time: %1.2fms, target pause time: %1.2fms, remaining time: %1.2fms",
|
||||
eden_region_length, survivor_region_length,
|
||||
num_eden_regions, num_survivor_regions,
|
||||
predicted_eden_time, predicted_base_time_ms, target_pause_time_ms, remaining_time_ms);
|
||||
|
||||
// Clear the fields that point to the survivor list - they are all young now.
|
||||
@ -669,8 +670,8 @@ double G1CollectionSet::select_candidates_from_optional_groups(double time_remai
|
||||
}
|
||||
|
||||
uint G1CollectionSet::select_optional_groups(double time_remaining_ms) {
|
||||
uint optional_regions_count = num_optional_regions();
|
||||
assert(optional_regions_count > 0,
|
||||
uint total_optional_regions = num_optional_regions();
|
||||
assert(total_optional_regions > 0,
|
||||
"Should only be called when there are optional regions");
|
||||
|
||||
uint num_regions_selected = 0;
|
||||
@ -678,7 +679,7 @@ uint G1CollectionSet::select_optional_groups(double time_remaining_ms) {
|
||||
double total_prediction_ms = select_candidates_from_optional_groups(time_remaining_ms, num_regions_selected);
|
||||
|
||||
log_debug(gc, ergo, cset)("Prepared %u regions out of %u for optional evacuation. Total predicted time: %.3fms",
|
||||
num_regions_selected, optional_regions_count, total_prediction_ms);
|
||||
num_regions_selected, total_optional_regions, total_prediction_ms);
|
||||
|
||||
return num_regions_selected;
|
||||
}
|
||||
@ -754,13 +755,12 @@ void G1CollectionSet::abandon_optional_collection_set(G1ParScanThreadStateSet* p
|
||||
|
||||
#ifdef ASSERT
|
||||
class G1VerifyYoungCSetIndicesClosure : public G1HeapRegionClosure {
|
||||
private:
|
||||
size_t _young_length;
|
||||
uint _num_young_regions;
|
||||
uint* _heap_region_indices;
|
||||
public:
|
||||
G1VerifyYoungCSetIndicesClosure(size_t young_length) : G1HeapRegionClosure(), _young_length(young_length) {
|
||||
_heap_region_indices = NEW_C_HEAP_ARRAY(uint, young_length + 1, mtGC);
|
||||
for (size_t i = 0; i < young_length + 1; i++) {
|
||||
G1VerifyYoungCSetIndicesClosure(uint num_young_regions) : G1HeapRegionClosure(), _num_young_regions(num_young_regions) {
|
||||
_heap_region_indices = NEW_C_HEAP_ARRAY(uint, num_young_regions + 1, mtGC);
|
||||
for (uint i = 0; i < num_young_regions + 1; i++) {
|
||||
_heap_region_indices[i] = UINT_MAX;
|
||||
}
|
||||
}
|
||||
@ -771,8 +771,9 @@ public:
|
||||
virtual bool do_heap_region(G1HeapRegion* r) {
|
||||
const uint idx = r->young_index_in_cset();
|
||||
|
||||
assert(idx > 0, "Young index must be set for all regions in the incremental collection set but is not for region %u.", r->hrm_index());
|
||||
assert(idx <= _young_length, "Young cset index %u too large for region %u", idx, r->hrm_index());
|
||||
assert(r->is_young(), "must be, but region %u is not", r->hrm_index());
|
||||
assert(idx > 0, "Young index must be set for all regions in the collection set but is not for region %u.", r->hrm_index());
|
||||
assert(idx <= _num_young_regions, "Young cset index %u too large for region %u", idx, r->hrm_index());
|
||||
|
||||
assert(_heap_region_indices[idx] == UINT_MAX,
|
||||
"Index %d used by multiple regions, first use by region %u, second by region %u",
|
||||
@ -787,7 +788,7 @@ public:
|
||||
void G1CollectionSet::verify_young_cset_indices() const {
|
||||
assert_at_safepoint_on_vm_thread();
|
||||
|
||||
G1VerifyYoungCSetIndicesClosure cl(_regions_cur_length);
|
||||
G1VerifyYoungCSetIndicesClosure cl(num_regions());
|
||||
iterate(&cl);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2026, 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
|
||||
@ -139,7 +139,7 @@ class G1CollectionSet {
|
||||
|
||||
// The actual collection set as a set of region indices.
|
||||
//
|
||||
// All regions in _regions below _regions_cur_length are assumed to be part of the
|
||||
// All regions in _regions below _num_regions are assumed to be part of the
|
||||
// collection set.
|
||||
// We assume that at any time there is at most only one writer and (one or more)
|
||||
// concurrent readers. This means synchronization using storestore and loadload
|
||||
@ -147,18 +147,18 @@ class G1CollectionSet {
|
||||
//
|
||||
// This corresponds to the regions referenced by the candidate groups further below.
|
||||
uint* _regions;
|
||||
uint _regions_max_length;
|
||||
uint _max_num_regions;
|
||||
|
||||
volatile uint _regions_cur_length;
|
||||
volatile uint _num_regions;
|
||||
|
||||
// Old gen groups selected for evacuation.
|
||||
G1CSetCandidateGroupList _groups;
|
||||
|
||||
uint groups_cur_length() const;
|
||||
uint num_groups() const;
|
||||
|
||||
uint _eden_region_length;
|
||||
uint _survivor_region_length;
|
||||
uint _initial_old_region_length;
|
||||
uint _num_eden_regions;
|
||||
uint _num_survivor_regions;
|
||||
uint _num_initial_old_regions;
|
||||
|
||||
// When doing mixed collections we can add old regions to the collection set, which
|
||||
// will be collected only if there is enough time. We call these optional (old)
|
||||
@ -174,7 +174,7 @@ class G1CollectionSet {
|
||||
CSetBuildType _inc_build_state;
|
||||
#endif
|
||||
// Index into the _regions indicating the start of the current collection set increment.
|
||||
size_t _regions_inc_part_start;
|
||||
uint _regions_inc_part_start;
|
||||
// Index into the _groups indicating the start of the current collection set increment.
|
||||
uint _groups_inc_part_start;
|
||||
|
||||
@ -188,6 +188,9 @@ class G1CollectionSet {
|
||||
// Add the given old region to the current collection set.
|
||||
void add_old_region(G1HeapRegion* hr);
|
||||
|
||||
void prepare_for_collection(uint num_eden_cset_regions,
|
||||
uint num_survivor_cset_regions);
|
||||
|
||||
void prepare_optional_group(G1CSetCandidateGroup* gr, uint cur_index);
|
||||
|
||||
void add_group_to_collection_set(G1CSetCandidateGroup* gr);
|
||||
@ -201,7 +204,7 @@ class G1CollectionSet {
|
||||
// Select groups for evacuation from the optional candidates given the remaining time
|
||||
// and return the number of actually selected regions.
|
||||
uint select_optional_groups(double time_remaining_ms);
|
||||
double select_candidates_from_optional_groups(double time_remaining_ms, uint& num_groups_selected);
|
||||
double select_candidates_from_optional_groups(double time_remaining_ms, uint& num_regions_selected);
|
||||
|
||||
// Finalize the young part of the initial collection set. Relabel survivor regions
|
||||
// as Eden and calculate a prediction on how long the evacuation of all young regions
|
||||
@ -217,8 +220,8 @@ class G1CollectionSet {
|
||||
// to allow for more efficient parallel iteration.
|
||||
void iterate_part_from(G1HeapRegionClosure* cl,
|
||||
G1HeapRegionClaimer* hr_claimer,
|
||||
size_t offset,
|
||||
size_t length,
|
||||
uint offset,
|
||||
uint length,
|
||||
uint worker_id) const;
|
||||
|
||||
// Adds the given group to the optional groups list (_optional_groups)
|
||||
@ -232,8 +235,8 @@ public:
|
||||
G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy);
|
||||
~G1CollectionSet();
|
||||
|
||||
// Initializes the collection set giving the maximum possible length of the collection set.
|
||||
void initialize(uint max_region_length);
|
||||
// Initializes the collection set giving the maximum possible number of regions in the collection set.
|
||||
void initialize(uint max_num_regions);
|
||||
|
||||
// Drop the collection set and collection set candidates.
|
||||
void abandon();
|
||||
@ -245,26 +248,23 @@ public:
|
||||
|
||||
void prepare_for_scan();
|
||||
|
||||
void init_region_lengths(uint eden_cset_region_length,
|
||||
uint survivor_cset_region_length);
|
||||
// Total number of regions in the initial collection set.
|
||||
uint num_initial_regions() const { return num_young_regions() +
|
||||
num_initial_old_regions(); }
|
||||
uint num_young_regions() const { return num_eden_regions() +
|
||||
num_survivor_regions(); }
|
||||
|
||||
// Total length of the initial collection set in regions.
|
||||
uint initial_region_length() const { return young_region_length() +
|
||||
initial_old_region_length(); }
|
||||
uint young_region_length() const { return eden_region_length() +
|
||||
survivor_region_length(); }
|
||||
|
||||
uint eden_region_length() const { return _eden_region_length; }
|
||||
uint survivor_region_length() const { return _survivor_region_length; }
|
||||
uint initial_old_region_length() const { return _initial_old_region_length; }
|
||||
uint num_eden_regions() const { return _num_eden_regions; }
|
||||
uint num_survivor_regions() const { return _num_survivor_regions; }
|
||||
uint num_initial_old_regions() const { return _num_initial_old_regions; }
|
||||
uint num_optional_regions() const { return _optional_groups.num_regions(); }
|
||||
|
||||
bool only_contains_young_regions() const { return (initial_old_region_length() + num_optional_regions()) == 0; }
|
||||
bool only_contains_young_regions() const { return (num_initial_old_regions() + num_optional_regions()) == 0; }
|
||||
|
||||
template <class CardOrRangeVisitor>
|
||||
inline void merge_cardsets_for_collection_groups(CardOrRangeVisitor& cl, uint worker_id, uint num_workers);
|
||||
|
||||
uint groups_increment_length() const;
|
||||
uint num_groups_in_increment() const;
|
||||
|
||||
// Reset the contents of the collection set.
|
||||
void clear();
|
||||
@ -282,10 +282,10 @@ public:
|
||||
// from a starting position determined by the given worker id.
|
||||
void iterate_incremental_part_from(G1HeapRegionClosure* cl, G1HeapRegionClaimer* hr_claimer, uint worker_id) const;
|
||||
|
||||
// Returns the length of the current increment in number of regions.
|
||||
size_t regions_cur_length() const { return _regions_cur_length - _regions_inc_part_start; }
|
||||
// Returns the length of the whole current collection set in number of regions
|
||||
size_t cur_length() const { return _regions_cur_length; }
|
||||
// Returns the number of regions in the current collection set increment.
|
||||
uint num_regions_in_increment() const { return num_regions() - _regions_inc_part_start; }
|
||||
// Returns the total number of regions in the current collection set.
|
||||
uint num_regions() const { return _num_regions; }
|
||||
|
||||
// Iterate over the entire collection set (all increments calculated so far), applying
|
||||
// the given G1HeapRegionClosure on all of the regions.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2024, 2026, 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
|
||||
@ -31,24 +31,22 @@
|
||||
|
||||
template <class CardOrRangeVisitor>
|
||||
inline void G1CollectionSet::merge_cardsets_for_collection_groups(CardOrRangeVisitor& cl, uint worker_id, uint num_workers) {
|
||||
uint offset = _groups_inc_part_start;
|
||||
uint offset = _groups_inc_part_start;
|
||||
if (offset == 0) {
|
||||
G1HeapRegionRemSet::iterate_for_merge(_g1h->young_regions_cset_group()->card_set(), cl);
|
||||
}
|
||||
|
||||
uint next_increment_length = groups_increment_length();
|
||||
if (next_increment_length == 0) {
|
||||
const uint next_group_increment = num_groups_in_increment();
|
||||
if (next_group_increment == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint start_pos = (worker_id * next_increment_length) / num_workers;
|
||||
uint start_pos = (worker_id * next_group_increment) / num_workers;
|
||||
uint cur_pos = start_pos;
|
||||
uint count = 0;
|
||||
do {
|
||||
G1HeapRegionRemSet::iterate_for_merge(_groups.at(offset + cur_pos)->card_set(), cl);
|
||||
cur_pos++;
|
||||
count++;
|
||||
if (cur_pos == next_increment_length) {
|
||||
if (cur_pos == next_group_increment) {
|
||||
cur_pos = 0;
|
||||
}
|
||||
} while (cur_pos != start_pos);
|
||||
|
||||
@ -76,7 +76,7 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h,
|
||||
_trim_ticks(),
|
||||
_surviving_young_words_base(nullptr),
|
||||
_surviving_young_words(nullptr),
|
||||
_surviving_words_length(collection_set->young_region_length() + 1),
|
||||
_surviving_words_length(collection_set->num_young_regions() + 1),
|
||||
_old_gen_is_full(false),
|
||||
_partial_array_splitter(g1h->partial_array_state_manager(), num_workers),
|
||||
_string_dedup_requests(),
|
||||
@ -717,7 +717,7 @@ G1ParScanThreadStateSet::G1ParScanThreadStateSet(G1CollectedHeap* g1h,
|
||||
_g1h(g1h),
|
||||
_collection_set(collection_set),
|
||||
_states(NEW_C_HEAP_ARRAY(G1ParScanThreadState*, num_workers, mtGC)),
|
||||
_surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, collection_set->young_region_length() + 1, mtGC)),
|
||||
_surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, collection_set->num_young_regions() + 1, mtGC)),
|
||||
_num_workers(num_workers),
|
||||
_flushed(false),
|
||||
_evac_failure_regions(evac_failure_regions)
|
||||
@ -725,7 +725,7 @@ G1ParScanThreadStateSet::G1ParScanThreadStateSet(G1CollectedHeap* g1h,
|
||||
for (uint i = 0; i < num_workers; ++i) {
|
||||
_states[i] = nullptr;
|
||||
}
|
||||
memset(_surviving_young_words_total, 0, (collection_set->young_region_length() + 1) * sizeof(size_t));
|
||||
memset(_surviving_young_words_total, 0, (collection_set->num_young_regions() + 1) * sizeof(size_t));
|
||||
}
|
||||
|
||||
G1ParScanThreadStateSet::~G1ParScanThreadStateSet() {
|
||||
|
||||
@ -849,13 +849,13 @@ G1CollectorState G1Policy::record_young_collection_end(bool concurrent_operation
|
||||
if (update_stats) {
|
||||
// We maintain the invariant that all objects allocated by mutator
|
||||
// threads will be allocated out of eden regions. So, we can use
|
||||
// the eden region number allocated since the previous GC to
|
||||
// calculate the application's allocate rate. The only exception
|
||||
// the number of eden regions allocated since the previous GC to
|
||||
// calculate the application's allocation rate. The only exception
|
||||
// to that is humongous objects that are allocated separately. But
|
||||
// given that humongous object allocations do not really affect
|
||||
// either the pause's duration nor when the next pause will take
|
||||
// place we can safely ignore them here.
|
||||
uint regions_allocated = _collection_set->eden_region_length();
|
||||
uint regions_allocated = _collection_set->num_eden_regions();
|
||||
double alloc_rate_ms = (double) regions_allocated / app_time_ms;
|
||||
_analytics->report_alloc_rate_ms(alloc_rate_ms);
|
||||
|
||||
@ -919,14 +919,14 @@ G1CollectorState G1Policy::record_young_collection_end(bool concurrent_operation
|
||||
_analytics->report_cost_per_byte_ms(cost_per_byte_ms, is_young_only_pause);
|
||||
}
|
||||
|
||||
if (_collection_set->young_region_length() > 0) {
|
||||
if (_collection_set->num_young_regions() > 0) {
|
||||
_analytics->report_young_other_cost_per_region_ms(young_other_time_ms() /
|
||||
_collection_set->young_region_length());
|
||||
_collection_set->num_young_regions());
|
||||
}
|
||||
|
||||
if (_collection_set->initial_old_region_length() > 0) {
|
||||
if (_collection_set->num_initial_old_regions() > 0) {
|
||||
_analytics->report_non_young_other_cost_per_region_ms(non_young_other_time_ms() /
|
||||
_collection_set->initial_old_region_length());
|
||||
_collection_set->num_initial_old_regions());
|
||||
}
|
||||
|
||||
_analytics->report_constant_other_time_ms(constant_other_time_ms(pause_time_ms));
|
||||
|
||||
@ -1232,14 +1232,14 @@ void G1RemSet::merge_heap_roots(bool initial_evacuation) {
|
||||
{
|
||||
WorkerThreads* workers = g1h->workers();
|
||||
|
||||
size_t const increment_length = g1h->collection_set()->groups_increment_length();
|
||||
uint const num_groups_in_increment = g1h->collection_set()->num_groups_in_increment();
|
||||
|
||||
uint const num_workers = initial_evacuation ? workers->active_workers() :
|
||||
MIN2(workers->active_workers(), (uint)increment_length);
|
||||
MIN2(workers->active_workers(), num_groups_in_increment);
|
||||
|
||||
G1MergeHeapRootsTask cl(_scan_state, num_workers, initial_evacuation);
|
||||
log_debug(gc, ergo)("Running %s using %u workers for %zu regions",
|
||||
cl.name(), num_workers, increment_length);
|
||||
log_debug(gc, ergo)("Running %s using %u workers for %u groups",
|
||||
cl.name(), num_workers, num_groups_in_increment);
|
||||
workers->run_task(&cl, num_workers);
|
||||
}
|
||||
|
||||
|
||||
@ -260,7 +260,7 @@ void G1YoungCollector::calculate_collection_set(G1EvacInfo* evacuation_info, dou
|
||||
allocator()->release_mutator_alloc_regions();
|
||||
|
||||
collection_set()->finalize_initial_collection_set(target_pause_time_ms, survivor_regions());
|
||||
evacuation_info->set_collection_set_regions(collection_set()->initial_region_length() +
|
||||
evacuation_info->set_collection_set_regions(collection_set()->num_initial_regions() +
|
||||
collection_set()->num_optional_regions());
|
||||
|
||||
concurrent_mark()->verify_no_collection_set_oops();
|
||||
|
||||
@ -56,7 +56,7 @@ G1YoungGCAllocationFailureInjector::G1YoungGCAllocationFailureInjector()
|
||||
void G1YoungGCAllocationFailureInjector::select_allocation_failure_regions() {
|
||||
G1CollectedHeap* g1h = G1CollectedHeap::heap();
|
||||
_allocation_failure_regions.reinitialize(g1h->max_num_regions());
|
||||
SelectAllocationFailureRegionClosure closure(_allocation_failure_regions, g1h->collection_set()->cur_length());
|
||||
SelectAllocationFailureRegionClosure closure(_allocation_failure_regions, g1h->collection_set()->num_regions());
|
||||
g1h->collection_set_iterate_all(&closure);
|
||||
}
|
||||
|
||||
|
||||
@ -649,9 +649,9 @@ class FreeCSetClosure : public G1HeapRegionClosure {
|
||||
|
||||
void assert_tracks_surviving_words(G1HeapRegion* r) {
|
||||
assert(r->young_index_in_cset() != 0 &&
|
||||
(uint)r->young_index_in_cset() <= _g1h->collection_set()->young_region_length(),
|
||||
(uint)r->young_index_in_cset() <= _g1h->collection_set()->num_young_regions(),
|
||||
"Young index %u is wrong for region %u of type %s with %u young regions",
|
||||
r->young_index_in_cset(), r->hrm_index(), r->get_type_str(), _g1h->collection_set()->young_region_length());
|
||||
r->young_index_in_cset(), r->hrm_index(), r->get_type_str(), _g1h->collection_set()->num_young_regions());
|
||||
}
|
||||
|
||||
void handle_evacuated_region(G1HeapRegion* r) {
|
||||
@ -810,7 +810,7 @@ public:
|
||||
p->record_serial_free_cset_time_ms((Ticks::now() - serial_time).seconds() * 1000.0);
|
||||
}
|
||||
|
||||
double worker_cost() const override { return G1CollectedHeap::heap()->collection_set()->initial_region_length(); }
|
||||
double worker_cost() const override { return G1CollectedHeap::heap()->collection_set()->num_initial_regions(); }
|
||||
|
||||
void set_max_workers(uint max_workers) override {
|
||||
_active_workers = max_workers;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user