Tue, 12 Oct 2010 09:36:48 -0700
6971296: G1: simplify G1RemSet class hierarchy
Summary: Remove G1RemSet base class and StupidG1RemSet class; rename HRInto_G1RemSet to just G1RemSet.
Reviewed-by: ysr, tonyp
ysr@777 | 1 | /* |
trims@1907 | 2 | * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
ysr@777 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ysr@777 | 4 | * |
ysr@777 | 5 | * This code is free software; you can redistribute it and/or modify it |
ysr@777 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ysr@777 | 7 | * published by the Free Software Foundation. |
ysr@777 | 8 | * |
ysr@777 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ysr@777 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ysr@777 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ysr@777 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
ysr@777 | 13 | * accompanied this code). |
ysr@777 | 14 | * |
ysr@777 | 15 | * You should have received a copy of the GNU General Public License version |
ysr@777 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
ysr@777 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ysr@777 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
ysr@777 | 22 | * |
ysr@777 | 23 | */ |
ysr@777 | 24 | |
ysr@777 | 25 | class G1CollectorPolicy; |
ysr@777 | 26 | |
ysr@777 | 27 | class SurvRateGroup : public CHeapObj { |
ysr@777 | 28 | private: |
ysr@777 | 29 | G1CollectorPolicy* _g1p; |
ysr@777 | 30 | const char* _name; |
ysr@777 | 31 | |
apetrusenko@980 | 32 | size_t _stats_arrays_length; |
ysr@777 | 33 | double* _surv_rate; |
ysr@777 | 34 | double* _accum_surv_rate_pred; |
ysr@777 | 35 | double _last_pred; |
ysr@777 | 36 | double _accum_surv_rate; |
ysr@777 | 37 | TruncatedSeq** _surv_rate_pred; |
ysr@777 | 38 | NumberSeq** _summary_surv_rates; |
ysr@777 | 39 | size_t _summary_surv_rates_len; |
ysr@777 | 40 | size_t _summary_surv_rates_max_len; |
ysr@777 | 41 | |
ysr@777 | 42 | int _all_regions_allocated; |
apetrusenko@980 | 43 | size_t _region_num; |
ysr@777 | 44 | size_t _setup_seq_num; |
ysr@777 | 45 | |
ysr@777 | 46 | public: |
ysr@777 | 47 | SurvRateGroup(G1CollectorPolicy* g1p, |
ysr@777 | 48 | const char* name, |
ysr@777 | 49 | size_t summary_surv_rates_len); |
apetrusenko@980 | 50 | void reset(); |
ysr@777 | 51 | void start_adding_regions(); |
ysr@777 | 52 | void stop_adding_regions(); |
ysr@777 | 53 | void record_surviving_words(int age_in_group, size_t surv_words); |
ysr@777 | 54 | void all_surviving_words_recorded(bool propagate); |
ysr@777 | 55 | const char* name() { return _name; } |
ysr@777 | 56 | |
apetrusenko@980 | 57 | size_t region_num() { return _region_num; } |
ysr@777 | 58 | double accum_surv_rate_pred(int age) { |
ysr@777 | 59 | assert(age >= 0, "must be"); |
apetrusenko@980 | 60 | if ((size_t)age < _stats_arrays_length) |
ysr@777 | 61 | return _accum_surv_rate_pred[age]; |
ysr@777 | 62 | else { |
apetrusenko@980 | 63 | double diff = (double) (age - _stats_arrays_length + 1); |
apetrusenko@980 | 64 | return _accum_surv_rate_pred[_stats_arrays_length-1] + diff * _last_pred; |
ysr@777 | 65 | } |
ysr@777 | 66 | } |
ysr@777 | 67 | |
ysr@777 | 68 | double accum_surv_rate(size_t adjustment); |
ysr@777 | 69 | |
ysr@777 | 70 | TruncatedSeq* get_seq(size_t age) { |
ysr@777 | 71 | if (age >= _setup_seq_num) { |
ysr@777 | 72 | guarantee( _setup_seq_num > 0, "invariant" ); |
ysr@777 | 73 | age = _setup_seq_num-1; |
ysr@777 | 74 | } |
ysr@777 | 75 | TruncatedSeq* seq = _surv_rate_pred[age]; |
ysr@777 | 76 | guarantee( seq != NULL, "invariant" ); |
ysr@777 | 77 | return seq; |
ysr@777 | 78 | } |
ysr@777 | 79 | |
ysr@777 | 80 | int next_age_index(); |
ysr@777 | 81 | int age_in_group(int age_index) { |
johnc@1829 | 82 | int ret = (int) (_all_regions_allocated - age_index); |
ysr@777 | 83 | assert( ret >= 0, "invariant" ); |
ysr@777 | 84 | return ret; |
ysr@777 | 85 | } |
ysr@777 | 86 | void finished_recalculating_age_indexes() { |
johnc@1829 | 87 | _all_regions_allocated = 0; |
ysr@777 | 88 | } |
ysr@777 | 89 | |
ysr@777 | 90 | #ifndef PRODUCT |
ysr@777 | 91 | void print(); |
ysr@777 | 92 | void print_surv_rate_summary(); |
ysr@777 | 93 | #endif // PRODUCT |
ysr@777 | 94 | }; |