Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @ 545:58054a18d735
6484959: G1: introduce survivor spaces
6797754: G1: combined bugfix
Summary: Implemented a policy to control G1 survivor space parameters.
Reviewed-by: tonyp, iveresov
author | apetrusenko |
---|---|
date | Fri, 06 Feb 2009 01:38:50 +0300 |
parents | 37f87013dfd8 |
children | fe3d7c11b4b7 |
comparison
equal
deleted
inserted
replaced
544:82a980778b92 | 545:58054a18d735 |
---|---|
555 | 555 |
556 double predict_young_gc_eff() { | 556 double predict_young_gc_eff() { |
557 return get_new_neg_prediction(_young_gc_eff_seq); | 557 return get_new_neg_prediction(_young_gc_eff_seq); |
558 } | 558 } |
559 | 559 |
560 double predict_survivor_regions_evac_time(); | |
561 | |
560 // </NEW PREDICTION> | 562 // </NEW PREDICTION> |
561 | 563 |
562 public: | 564 public: |
563 void cset_regions_freed() { | 565 void cset_regions_freed() { |
564 bool propagate = _last_young_gc_full && !_in_marking_window; | 566 bool propagate = _last_young_gc_full && !_in_marking_window; |
597 return get_new_prediction(_concurrent_mark_cleanup_times_ms); | 599 return get_new_prediction(_concurrent_mark_cleanup_times_ms); |
598 } | 600 } |
599 | 601 |
600 // Returns an estimate of the survival rate of the region at yg-age | 602 // Returns an estimate of the survival rate of the region at yg-age |
601 // "yg_age". | 603 // "yg_age". |
602 double predict_yg_surv_rate(int age) { | 604 double predict_yg_surv_rate(int age, SurvRateGroup* surv_rate_group) { |
603 TruncatedSeq* seq = _short_lived_surv_rate_group->get_seq(age); | 605 TruncatedSeq* seq = surv_rate_group->get_seq(age); |
604 if (seq->num() == 0) | 606 if (seq->num() == 0) |
605 gclog_or_tty->print("BARF! age is %d", age); | 607 gclog_or_tty->print("BARF! age is %d", age); |
606 guarantee( seq->num() > 0, "invariant" ); | 608 guarantee( seq->num() > 0, "invariant" ); |
607 double pred = get_new_prediction(seq); | 609 double pred = get_new_prediction(seq); |
608 if (pred > 1.0) | 610 if (pred > 1.0) |
609 pred = 1.0; | 611 pred = 1.0; |
610 return pred; | 612 return pred; |
613 } | |
614 | |
615 double predict_yg_surv_rate(int age) { | |
616 return predict_yg_surv_rate(age, _short_lived_surv_rate_group); | |
611 } | 617 } |
612 | 618 |
613 double accum_yg_surv_rate_pred(int age) { | 619 double accum_yg_surv_rate_pred(int age) { |
614 return _short_lived_surv_rate_group->accum_surv_rate_pred(age); | 620 return _short_lived_surv_rate_group->accum_surv_rate_pred(age); |
615 } | 621 } |
820 | 826 |
821 public: | 827 public: |
822 | 828 |
823 virtual void init(); | 829 virtual void init(); |
824 | 830 |
831 // Create jstat counters for the policy. | |
832 virtual void initialize_gc_policy_counters(); | |
833 | |
825 virtual HeapWord* mem_allocate_work(size_t size, | 834 virtual HeapWord* mem_allocate_work(size_t size, |
826 bool is_tlab, | 835 bool is_tlab, |
827 bool* gc_overhead_limit_was_exceeded); | 836 bool* gc_overhead_limit_was_exceeded); |
828 | 837 |
829 // This method controls how a collector handles one or more | 838 // This method controls how a collector handles one or more |
1045 void print_tracing_info() const; | 1054 void print_tracing_info() const; |
1046 | 1055 |
1047 // Print stats on young survival ratio | 1056 // Print stats on young survival ratio |
1048 void print_yg_surv_rate_info() const; | 1057 void print_yg_surv_rate_info() const; |
1049 | 1058 |
1050 void finished_recalculating_age_indexes() { | 1059 void finished_recalculating_age_indexes(bool is_survivors) { |
1051 _short_lived_surv_rate_group->finished_recalculating_age_indexes(); | 1060 if (is_survivors) { |
1061 _survivor_surv_rate_group->finished_recalculating_age_indexes(); | |
1062 } else { | |
1063 _short_lived_surv_rate_group->finished_recalculating_age_indexes(); | |
1064 } | |
1052 // do that for any other surv rate groups | 1065 // do that for any other surv rate groups |
1053 } | 1066 } |
1054 | 1067 |
1055 bool should_add_next_region_to_young_list(); | 1068 bool should_add_next_region_to_young_list(); |
1056 | 1069 |
1095 | 1108 |
1096 // Current tenuring threshold, set to 0 if the collector reaches the | 1109 // Current tenuring threshold, set to 0 if the collector reaches the |
1097 // maximum amount of suvivors regions. | 1110 // maximum amount of suvivors regions. |
1098 int _tenuring_threshold; | 1111 int _tenuring_threshold; |
1099 | 1112 |
1113 // The limit on the number of regions allocated for survivors. | |
1114 size_t _max_survivor_regions; | |
1115 | |
1116 // The amount of survor regions after a collection. | |
1117 size_t _recorded_survivor_regions; | |
1118 // List of survivor regions. | |
1119 HeapRegion* _recorded_survivor_head; | |
1120 HeapRegion* _recorded_survivor_tail; | |
1121 | |
1122 ageTable _survivors_age_table; | |
1123 | |
1100 public: | 1124 public: |
1101 | 1125 |
1102 inline GCAllocPurpose | 1126 inline GCAllocPurpose |
1103 evacuation_destination(HeapRegion* src_region, int age, size_t word_sz) { | 1127 evacuation_destination(HeapRegion* src_region, int age, size_t word_sz) { |
1104 if (age < _tenuring_threshold && src_region->is_young()) { | 1128 if (age < _tenuring_threshold && src_region->is_young()) { |
1114 | 1138 |
1115 inline GCAllocPurpose alternative_purpose(int purpose) { | 1139 inline GCAllocPurpose alternative_purpose(int purpose) { |
1116 return GCAllocForTenured; | 1140 return GCAllocForTenured; |
1117 } | 1141 } |
1118 | 1142 |
1119 uint max_regions(int purpose); | 1143 static const size_t REGIONS_UNLIMITED = ~(size_t)0; |
1144 | |
1145 size_t max_regions(int purpose); | |
1120 | 1146 |
1121 // The limit on regions for a particular purpose is reached. | 1147 // The limit on regions for a particular purpose is reached. |
1122 void note_alloc_region_limit_reached(int purpose) { | 1148 void note_alloc_region_limit_reached(int purpose) { |
1123 if (purpose == GCAllocForSurvived) { | 1149 if (purpose == GCAllocForSurvived) { |
1124 _tenuring_threshold = 0; | 1150 _tenuring_threshold = 0; |
1130 } | 1156 } |
1131 | 1157 |
1132 void note_stop_adding_survivor_regions() { | 1158 void note_stop_adding_survivor_regions() { |
1133 _survivor_surv_rate_group->stop_adding_regions(); | 1159 _survivor_surv_rate_group->stop_adding_regions(); |
1134 } | 1160 } |
1161 | |
1162 void record_survivor_regions(size_t regions, | |
1163 HeapRegion* head, | |
1164 HeapRegion* tail) { | |
1165 _recorded_survivor_regions = regions; | |
1166 _recorded_survivor_head = head; | |
1167 _recorded_survivor_tail = tail; | |
1168 } | |
1169 | |
1170 void record_thread_age_table(ageTable* age_table) | |
1171 { | |
1172 _survivors_age_table.merge_par(age_table); | |
1173 } | |
1174 | |
1175 // Calculates survivor space parameters. | |
1176 void calculate_survivors_policy(); | |
1177 | |
1135 }; | 1178 }; |
1136 | 1179 |
1137 // This encapsulates a particular strategy for a g1 Collector. | 1180 // This encapsulates a particular strategy for a g1 Collector. |
1138 // | 1181 // |
1139 // Start a concurrent mark when our heap size is n bytes | 1182 // Start a concurrent mark when our heap size is n bytes |