src/share/vm/gc_implementation/g1/survRateGroup.hpp

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/gc_implementation/g1/survRateGroup.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,101 @@
     1.4 +/*
     1.5 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_SURVRATEGROUP_HPP
    1.29 +#define SHARE_VM_GC_IMPLEMENTATION_G1_SURVRATEGROUP_HPP
    1.30 +
    1.31 +#include "utilities/numberSeq.hpp"
    1.32 +
    1.33 +class G1CollectorPolicy;
    1.34 +
    1.35 +class SurvRateGroup : public CHeapObj<mtGC> {
    1.36 +private:
    1.37 +  G1CollectorPolicy* _g1p;
    1.38 +  const char* _name;
    1.39 +
    1.40 +  size_t  _stats_arrays_length;
    1.41 +  double* _surv_rate;
    1.42 +  double* _accum_surv_rate_pred;
    1.43 +  double  _last_pred;
    1.44 +  double  _accum_surv_rate;
    1.45 +  TruncatedSeq** _surv_rate_pred;
    1.46 +  NumberSeq**    _summary_surv_rates;
    1.47 +  size_t         _summary_surv_rates_len;
    1.48 +  size_t         _summary_surv_rates_max_len;
    1.49 +
    1.50 +  int _all_regions_allocated;
    1.51 +  size_t _region_num;
    1.52 +  size_t _setup_seq_num;
    1.53 +
    1.54 +public:
    1.55 +  SurvRateGroup(G1CollectorPolicy* g1p,
    1.56 +                const char* name,
    1.57 +                size_t summary_surv_rates_len);
    1.58 +  void reset();
    1.59 +  void start_adding_regions();
    1.60 +  void stop_adding_regions();
    1.61 +  void record_surviving_words(int age_in_group, size_t surv_words);
    1.62 +  void all_surviving_words_recorded(bool propagate);
    1.63 +  const char* name() { return _name; }
    1.64 +
    1.65 +  size_t region_num() { return _region_num; }
    1.66 +  double accum_surv_rate_pred(int age) {
    1.67 +    assert(age >= 0, "must be");
    1.68 +    if ((size_t)age < _stats_arrays_length)
    1.69 +      return _accum_surv_rate_pred[age];
    1.70 +    else {
    1.71 +      double diff = (double) (age - _stats_arrays_length + 1);
    1.72 +      return _accum_surv_rate_pred[_stats_arrays_length-1] + diff * _last_pred;
    1.73 +    }
    1.74 +  }
    1.75 +
    1.76 +  double accum_surv_rate(size_t adjustment);
    1.77 +
    1.78 +  TruncatedSeq* get_seq(size_t age) {
    1.79 +    if (age >= _setup_seq_num) {
    1.80 +      guarantee( _setup_seq_num > 0, "invariant" );
    1.81 +      age = _setup_seq_num-1;
    1.82 +    }
    1.83 +    TruncatedSeq* seq = _surv_rate_pred[age];
    1.84 +    guarantee( seq != NULL, "invariant" );
    1.85 +    return seq;
    1.86 +  }
    1.87 +
    1.88 +  int next_age_index();
    1.89 +  int age_in_group(int age_index) {
    1.90 +    int ret = (int) (_all_regions_allocated - age_index);
    1.91 +    assert( ret >= 0, "invariant" );
    1.92 +    return ret;
    1.93 +  }
    1.94 +  void finished_recalculating_age_indexes() {
    1.95 +    _all_regions_allocated = 0;
    1.96 +  }
    1.97 +
    1.98 +#ifndef PRODUCT
    1.99 +  void print();
   1.100 +  void print_surv_rate_summary();
   1.101 +#endif // PRODUCT
   1.102 +};
   1.103 +
   1.104 +#endif // SHARE_VM_GC_IMPLEMENTATION_G1_SURVRATEGROUP_HPP

mercurial