8382625: G1: Constify G1Policy::need_to_start_conc_mark()

Reviewed-by: ayang
This commit is contained in:
Thomas Schatzl 2026-04-21 14:16:47 +00:00
parent aa314b8c6b
commit a1dee68858
6 changed files with 6 additions and 6 deletions

View File

@ -2956,7 +2956,7 @@ void G1CollectedHeap::abandon_collection_set() {
collection_set()->abandon();
}
size_t G1CollectedHeap::non_young_occupancy_after_allocation(size_t allocation_word_size) {
size_t G1CollectedHeap::non_young_occupancy_after_allocation(size_t allocation_word_size) const {
const size_t cur_occupancy = (old_regions_count() + humongous_regions_count()) * G1HeapRegion::GrainBytes -
_allocator->free_bytes_in_retained_old_region();
// Humongous allocations will always be assigned to non-young heap, so consider

View File

@ -1032,7 +1032,7 @@ public:
// Returns how much memory there is assigned to non-young heap that can not be
// allocated into any more without garbage collection after a hypothetical
// allocation of allocation_word_size.
size_t non_young_occupancy_after_allocation(size_t allocation_word_size);
size_t non_young_occupancy_after_allocation(size_t allocation_word_size) const;
// Determine whether the given region is one that we are using as an
// old GC alloc region.

View File

@ -114,7 +114,7 @@ void G1IHOPControl::add_marking_start_to_mixed_length(double length_s) {
// Determine the old generation occupancy threshold at which to start
// concurrent marking such that reclamation (first Mixed GC) begins
// before the heap reaches a critical occupancy level.
size_t G1IHOPControl::old_gen_threshold_for_conc_mark_start() {
size_t G1IHOPControl::old_gen_threshold_for_conc_mark_start() const {
guarantee(_target_occupancy > 0, "Target occupancy must be initialized");
if (!_is_adaptive || !have_enough_data_for_prediction()) {

View File

@ -115,7 +115,7 @@ class G1IHOPControl : public CHeapObj<mtGC> {
void add_marking_start_to_mixed_length(double length_s);
// Get the current non-young occupancy at which concurrent marking should start.
size_t old_gen_threshold_for_conc_mark_start();
size_t old_gen_threshold_for_conc_mark_start() const;
void report_statistics(G1NewTracer* tracer, size_t non_young_occupancy);
};

View File

@ -728,7 +728,7 @@ bool G1Policy::about_to_start_mixed_phase() const {
return collector_state()->is_in_concurrent_cycle() || collector_state()->is_in_prepare_mixed_gc();
}
bool G1Policy::need_to_start_conc_mark(const char* source, size_t allocation_word_size) {
bool G1Policy::need_to_start_conc_mark(const char* source, size_t allocation_word_size) const {
if (about_to_start_mixed_phase()) {
return false;
}

View File

@ -296,7 +296,7 @@ public:
void record_young_gc_pause_start();
void record_young_gc_pause_end(bool evacuation_failed);
bool need_to_start_conc_mark(const char* source, size_t allocation_word_size);
bool need_to_start_conc_mark(const char* source, size_t allocation_word_size) const;
bool concurrent_operation_is_full_mark(const char* msg, size_t allocation_word_size);