< prev index next >
src/hotspot/share/gc/g1/survRateGroup.cpp
Print this page
rev 55208 : imported patch 8220089.webrev.0
rev 55209 : imported patch 8220089.webrev.1
rev 55210 : imported patch 8220089.webrev.2
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -35,11 +35,12 @@
_accum_surv_rate_pred(NULL),
_last_pred(0.0),
_surv_rate_pred(NULL),
_all_regions_allocated(0),
_region_num(0),
- _setup_seq_num(0)
+ _setup_seq_num(0),
+ _retained_region_num(0)
{
reset();
start_adding_regions();
}
@@ -47,10 +48,11 @@
_all_regions_allocated = 0;
_setup_seq_num = 0;
_last_pred = 0.0;
// the following will set up the arrays with length 1
_region_num = 1;
+ _retained_region_num = 0;
// The call to stop_adding_regions() will use "new" to refill
// the _surv_rate_pred array, so we need to make sure to call
// "delete".
for (size_t i = 0; i < _stats_arrays_length; ++i) {
@@ -70,11 +72,13 @@
_region_num = 0;
}
void SurvRateGroup::start_adding_regions() {
_setup_seq_num = _stats_arrays_length;
- _region_num = 0;
+ // Retained region number should be reflected to address actual reused case.
+ _region_num = _retained_region_num;
+ _retained_region_num = 0;
}
void SurvRateGroup::stop_adding_regions() {
if (_region_num > _stats_arrays_length) {
_accum_surv_rate_pred = REALLOC_C_HEAP_ARRAY(double, _accum_surv_rate_pred, _region_num, mtGC);
@@ -88,11 +92,12 @@
}
}
void SurvRateGroup::record_surviving_words(int age_in_group, size_t surv_words) {
guarantee( 0 <= age_in_group && (size_t) age_in_group < _region_num,
- "pre-condition" );
+ "Age in group (" PTR_FORMAT ") should be [0, " SIZE_FORMAT "), but it is %d",
+ p2i(this), _region_num, age_in_group);
double surv_rate = (double) surv_words / (double) HeapRegion::GrainWords;
_surv_rate_pred[age_in_group]->add(surv_rate);
}
< prev index next >