8151633: Don't keep copies of the survivor lists and counts in the G1CollectorPolicy
Reviewed-by: tbenson, tschatzl
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp Fri Mar 11 10:06:30 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp Fri Mar 11 10:18:11 2016 +0100
@@ -2731,7 +2731,7 @@
uint young_regions = _young_list->length();
st->print("%u young (" SIZE_FORMAT "K), ", young_regions,
(size_t) young_regions * HeapRegion::GrainBytes / K);
- uint survivor_regions = g1_policy()->recorded_survivor_regions();
+ uint survivor_regions = _young_list->survivor_length();
st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
(size_t) survivor_regions * HeapRegion::GrainBytes / K);
st->cr();
@@ -3405,10 +3405,6 @@
assert(check_young_list_empty(false /* check_heap */),
"young list should be empty");
- g1_policy()->record_survivor_regions(_young_list->survivor_length(),
- _young_list->first_survivor_region(),
- _young_list->last_survivor_region());
-
_young_list->reset_auxilary_lists();
if (evacuation_failed()) {
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp Fri Mar 11 10:06:30 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp Fri Mar 11 10:18:11 2016 +0100
@@ -118,9 +118,6 @@
_max_survivor_regions(0),
// add here any more surv rate groups
- _recorded_survivor_regions(0),
- _recorded_survivor_head(NULL),
- _recorded_survivor_tail(NULL),
_survivors_age_table(true),
_gc_overhead_perc(0.0),
@@ -430,7 +427,7 @@
// Calculate the absolute and desired min bounds first.
// This is how many young regions we already have (currently: the survivors).
- uint base_min_length = recorded_survivor_regions();
+ const uint base_min_length = _g1->young_list()->survivor_length();
uint desired_min_length = calculate_young_list_desired_min_length(base_min_length);
// This is the absolute minimum young length. Ensure that we
// will at least have one eden region available for allocation.
@@ -481,7 +478,7 @@
young_list_target_length = desired_min_length;
}
- assert(young_list_target_length > recorded_survivor_regions(),
+ assert(young_list_target_length > base_min_length,
"we should be able to allocate at least one eden region");
assert(young_list_target_length >= absolute_min_length, "post-condition");
@@ -595,8 +592,8 @@
double G1CollectorPolicy::predict_survivor_regions_evac_time() const {
double survivor_regions_evac_time = 0.0;
- for (HeapRegion * r = _recorded_survivor_head;
- r != NULL && r != _recorded_survivor_tail->get_next_young_region();
+ for (HeapRegion * r = _g1->young_list()->first_survivor_region();
+ r != NULL && r != _g1->young_list()->last_survivor_region()->get_next_young_region();
r = r->get_next_young_region()) {
survivor_regions_evac_time += predict_region_elapsed_time_ms(r, collector_state()->gcs_are_young());
}
@@ -700,8 +697,6 @@
_short_lived_surv_rate_group->start_adding_regions();
// also call this on any additional surv rate groups
- record_survivor_regions(0, NULL, NULL);
-
_free_regions_at_end_of_collection = _g1->num_free_regions();
// Reset survivors SurvRateGroup.
_survivor_surv_rate_group->reset();
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp Fri Mar 11 10:06:30 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp Fri Mar 11 10:18:11 2016 +0100
@@ -522,16 +522,6 @@
// The limit on the number of regions allocated for survivors.
uint _max_survivor_regions;
- // For reporting purposes.
- // The value of _heap_bytes_before_gc is also used to calculate
- // the cost of copying.
-
- // The amount of survivor regions after a collection.
- uint _recorded_survivor_regions;
- // List of survivor regions.
- HeapRegion* _recorded_survivor_head;
- HeapRegion* _recorded_survivor_tail;
-
AgeTable _survivors_age_table;
public:
@@ -565,18 +555,6 @@
_survivor_surv_rate_group->stop_adding_regions();
}
- void record_survivor_regions(uint regions,
- HeapRegion* head,
- HeapRegion* tail) {
- _recorded_survivor_regions = regions;
- _recorded_survivor_head = head;
- _recorded_survivor_tail = tail;
- }
-
- uint recorded_survivor_regions() const {
- return _recorded_survivor_regions;
- }
-
void record_age_table(AgeTable* age_table) {
_survivors_age_table.merge(age_table);
}
--- a/hotspot/src/share/vm/gc/g1/g1MonitoringSupport.cpp Fri Mar 11 10:06:30 2016 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1MonitoringSupport.cpp Fri Mar 11 10:18:11 2016 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, 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
@@ -178,7 +178,7 @@
// of a GC).
uint young_list_length = g1->young_list()->length();
- uint survivor_list_length = g1->g1_policy()->recorded_survivor_regions();
+ uint survivor_list_length = g1->young_list()->survivor_length();
assert(young_list_length >= survivor_list_length, "invariant");
uint eden_list_length = young_list_length - survivor_list_length;
// Max length includes any potential extensions to the young gen