342N/A/*
1472N/A * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
342N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
342N/A *
342N/A * This code is free software; you can redistribute it and/or modify it
342N/A * under the terms of the GNU General Public License version 2 only, as
342N/A * published by the Free Software Foundation.
342N/A *
342N/A * This code is distributed in the hope that it will be useful, but WITHOUT
342N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
342N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
342N/A * version 2 for more details (a copy is included in the LICENSE file that
342N/A * accompanied this code).
342N/A *
342N/A * You should have received a copy of the GNU General Public License version
342N/A * 2 along with this work; if not, write to the Free Software Foundation,
342N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
342N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
342N/A *
342N/A */
342N/A
1879N/A#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_SURVRATEGROUP_HPP
1879N/A#define SHARE_VM_GC_IMPLEMENTATION_G1_SURVRATEGROUP_HPP
1879N/A
1879N/A#include "utilities/numberSeq.hpp"
1879N/A
342N/Aclass G1CollectorPolicy;
342N/A
3863N/Aclass SurvRateGroup : public CHeapObj<mtGC> {
342N/Aprivate:
342N/A G1CollectorPolicy* _g1p;
342N/A const char* _name;
342N/A
545N/A size_t _stats_arrays_length;
342N/A double* _surv_rate;
342N/A double* _accum_surv_rate_pred;
342N/A double _last_pred;
342N/A double _accum_surv_rate;
342N/A TruncatedSeq** _surv_rate_pred;
342N/A NumberSeq** _summary_surv_rates;
342N/A size_t _summary_surv_rates_len;
342N/A size_t _summary_surv_rates_max_len;
342N/A
342N/A int _all_regions_allocated;
545N/A size_t _region_num;
342N/A size_t _setup_seq_num;
342N/A
342N/Apublic:
342N/A SurvRateGroup(G1CollectorPolicy* g1p,
342N/A const char* name,
342N/A size_t summary_surv_rates_len);
545N/A void reset();
342N/A void start_adding_regions();
342N/A void stop_adding_regions();
342N/A void record_surviving_words(int age_in_group, size_t surv_words);
342N/A void all_surviving_words_recorded(bool propagate);
342N/A const char* name() { return _name; }
342N/A
545N/A size_t region_num() { return _region_num; }
342N/A double accum_surv_rate_pred(int age) {
342N/A assert(age >= 0, "must be");
545N/A if ((size_t)age < _stats_arrays_length)
342N/A return _accum_surv_rate_pred[age];
342N/A else {
545N/A double diff = (double) (age - _stats_arrays_length + 1);
545N/A return _accum_surv_rate_pred[_stats_arrays_length-1] + diff * _last_pred;
342N/A }
342N/A }
342N/A
342N/A double accum_surv_rate(size_t adjustment);
342N/A
342N/A TruncatedSeq* get_seq(size_t age) {
342N/A if (age >= _setup_seq_num) {
342N/A guarantee( _setup_seq_num > 0, "invariant" );
342N/A age = _setup_seq_num-1;
342N/A }
342N/A TruncatedSeq* seq = _surv_rate_pred[age];
342N/A guarantee( seq != NULL, "invariant" );
342N/A return seq;
342N/A }
342N/A
342N/A int next_age_index();
342N/A int age_in_group(int age_index) {
1394N/A int ret = (int) (_all_regions_allocated - age_index);
342N/A assert( ret >= 0, "invariant" );
342N/A return ret;
342N/A }
342N/A void finished_recalculating_age_indexes() {
1394N/A _all_regions_allocated = 0;
342N/A }
342N/A
342N/A#ifndef PRODUCT
342N/A void print();
342N/A void print_surv_rate_summary();
342N/A#endif // PRODUCT
342N/A};
1879N/A
1879N/A#endif // SHARE_VM_GC_IMPLEMENTATION_G1_SURVRATEGROUP_HPP