8150721: Don't explicitly manage G1 young regions in YoungList

Reviewed-by: ehelin, sjohanss, tschatzl
This commit is contained in:
Mikael Gerdin 2016-05-03 12:33:10 +02:00
parent 0adae4d914
commit 462ad706f1
17 changed files with 181 additions and 322 deletions

View file

@ -75,22 +75,18 @@ void G1YoungRemSetSamplingThread::sample_young_list_rs_lengths() {
SuspendibleThreadSetJoiner sts;
G1CollectedHeap* g1h = G1CollectedHeap::heap();
G1Policy* g1p = g1h->g1_policy();
G1CollectionSet* g1cs = g1h->collection_set();
if (g1p->adaptive_young_list_length()) {
int regions_visited = 0;
HeapRegion* hr = g1h->young_list()->first_region();
HeapRegion* hr = g1cs->inc_head();
size_t sampled_rs_lengths = 0;
while (hr != NULL) {
size_t rs_length = hr->rem_set()->occupied();
sampled_rs_lengths += rs_length;
// The current region may not yet have been added to the
// incremental collection set (it gets added when it is
// retired as the current allocation region).
if (hr->in_collection_set()) {
// Update the collection set policy information for this region
g1h->collection_set()->update_young_region_prediction(hr, rs_length);
}
// Update the collection set policy information for this region
g1cs->update_young_region_prediction(hr, rs_length);
++regions_visited;
@ -99,12 +95,13 @@ void G1YoungRemSetSamplingThread::sample_young_list_rs_lengths() {
if (sts.should_yield()) {
sts.yield();
// A gc may have occurred and our sampling data is stale and further
// traversal of the young list is unsafe
// traversal of the collection set is unsafe
return;
}
regions_visited = 0;
}
hr = hr->get_next_young_region();
assert(hr == g1cs->inc_tail() || hr->next_in_collection_set() != NULL, "next should only be null at tail of icset");
hr = hr->next_in_collection_set();
}
g1p->revise_young_list_target_length_if_necessary(sampled_rs_lengths);
}