comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp @ 1656:4e5661ba9d98

6944166: G1: explicit GCs are not always handled correctly Summary: G1 was not handling explicit GCs correctly in many ways. It does now. See the CR for the list of improvements contained in this changeset. Reviewed-by: iveresov, ysr, johnc
author tonyp
date Mon, 28 Jun 2010 14:13:17 -0400
parents 215576b54709
children 2d160770d2e5
comparison
equal deleted inserted replaced
1655:e7ec8cd4dd8a 1656:4e5661ba9d98
197 size_t _young_list_fixed_length; 197 size_t _young_list_fixed_length;
198 198
199 size_t _young_cset_length; 199 size_t _young_cset_length;
200 bool _last_young_gc_full; 200 bool _last_young_gc_full;
201 201
202 double _target_pause_time_ms;
203
204 unsigned _full_young_pause_num; 202 unsigned _full_young_pause_num;
205 unsigned _partial_young_pause_num; 203 unsigned _partial_young_pause_num;
206 204
207 bool _during_marking; 205 bool _during_marking;
208 bool _in_marking_window; 206 bool _in_marking_window;
522 _known_garbage_ratio = (double) _known_garbage_bytes / (double) heap_bytes; 520 _known_garbage_ratio = (double) _known_garbage_bytes / (double) heap_bytes;
523 } 521 }
524 522
525 G1MMUTracker* mmu_tracker() { 523 G1MMUTracker* mmu_tracker() {
526 return _mmu_tracker; 524 return _mmu_tracker;
525 }
526
527 double max_pause_time_ms() {
528 return _mmu_tracker->max_gc_time() * 1000.0;
527 } 529 }
528 530
529 double predict_init_time_ms() { 531 double predict_init_time_ms() {
530 return get_new_prediction(_concurrent_mark_init_times_ms); 532 return get_new_prediction(_concurrent_mark_init_times_ms);
531 } 533 }
1006 virtual bool should_do_collection_pause(size_t word_size) = 0; 1008 virtual bool should_do_collection_pause(size_t word_size) = 0;
1007 1009
1008 // Choose a new collection set. Marks the chosen regions as being 1010 // Choose a new collection set. Marks the chosen regions as being
1009 // "in_collection_set", and links them together. The head and number of 1011 // "in_collection_set", and links them together. The head and number of
1010 // the collection set are available via access methods. 1012 // the collection set are available via access methods.
1011 virtual bool choose_collection_set() = 0; 1013 virtual bool choose_collection_set(double target_pause_time_ms) = 0;
1012 1014
1013 // The head of the list (via "next_in_collection_set()") representing the 1015 // The head of the list (via "next_in_collection_set()") representing the
1014 // current collection set. 1016 // current collection set.
1015 HeapRegion* collection_set() { return _collection_set; } 1017 HeapRegion* collection_set() { return _collection_set; }
1016 1018
1074 void clear_initiate_conc_mark_if_possible() { _initiate_conc_mark_if_possible = false; } 1076 void clear_initiate_conc_mark_if_possible() { _initiate_conc_mark_if_possible = false; }
1075 1077
1076 bool during_initial_mark_pause() { return _during_initial_mark_pause; } 1078 bool during_initial_mark_pause() { return _during_initial_mark_pause; }
1077 void set_during_initial_mark_pause() { _during_initial_mark_pause = true; } 1079 void set_during_initial_mark_pause() { _during_initial_mark_pause = true; }
1078 void clear_during_initial_mark_pause(){ _during_initial_mark_pause = false; } 1080 void clear_during_initial_mark_pause(){ _during_initial_mark_pause = false; }
1081
1082 // This sets the initiate_conc_mark_if_possible() flag to start a
1083 // new cycle, as long as we are not already in one. It's best if it
1084 // is called during a safepoint when the test whether a cycle is in
1085 // progress or not is stable.
1086 bool force_initial_mark_if_outside_cycle();
1079 1087
1080 // This is called at the very beginning of an evacuation pause (it 1088 // This is called at the very beginning of an evacuation pause (it
1081 // has to be the first thing that the pause does). If 1089 // has to be the first thing that the pause does). If
1082 // initiate_conc_mark_if_possible() is true, and the concurrent 1090 // initiate_conc_mark_if_possible() is true, and the concurrent
1083 // marking thread has completed its work during the previous cycle, 1091 // marking thread has completed its work during the previous cycle,
1257 class G1CollectorPolicy_BestRegionsFirst: public G1CollectorPolicy { 1265 class G1CollectorPolicy_BestRegionsFirst: public G1CollectorPolicy {
1258 CollectionSetChooser* _collectionSetChooser; 1266 CollectionSetChooser* _collectionSetChooser;
1259 // If the estimated is less then desirable, resize if possible. 1267 // If the estimated is less then desirable, resize if possible.
1260 void expand_if_possible(size_t numRegions); 1268 void expand_if_possible(size_t numRegions);
1261 1269
1262 virtual bool choose_collection_set(); 1270 virtual bool choose_collection_set(double target_pause_time_ms);
1263 virtual void record_collection_pause_start(double start_time_sec, 1271 virtual void record_collection_pause_start(double start_time_sec,
1264 size_t start_used); 1272 size_t start_used);
1265 virtual void record_concurrent_mark_cleanup_end(size_t freed_bytes, 1273 virtual void record_concurrent_mark_cleanup_end(size_t freed_bytes,
1266 size_t max_live_bytes); 1274 size_t max_live_bytes);
1267 virtual void record_full_collection_end(); 1275 virtual void record_full_collection_end();