142 uint calculate_default_min_length(uint new_number_of_heap_regions);
143 uint calculate_default_max_length(uint new_number_of_heap_regions);
144
145 // Update the given values for minimum and maximum young gen length in regions
146 // given the number of heap regions depending on the kind of sizing algorithm.
147 void recalculate_min_max_young_length(uint number_of_heap_regions, uint* min_young_length, uint* max_young_length);
148
149 public:
150 G1YoungGenSizer();
151 // Calculate the maximum length of the young gen given the number of regions
152 // depending on the sizing algorithm.
153 uint max_young_length(uint number_of_heap_regions);
154
155 void heap_size_changed(uint new_number_of_heap_regions);
156 uint min_desired_young_length() {
157 return _min_desired_young_length;
158 }
159 uint max_desired_young_length() {
160 return _max_desired_young_length;
161 }
162 bool adaptive_young_list_length() const {
163 return _adaptive_size;
164 }
165 };
166
167 class G1CollectorPolicy: public CollectorPolicy {
168 private:
169 G1IHOPControl* _ihop_control;
170
171 G1IHOPControl* create_ihop_control() const;
172 // Update the IHOP control with necessary statistics.
173 void update_ihop_prediction(double mutator_time_s,
174 size_t mutator_alloc_bytes,
175 size_t young_gen_size);
176 void report_ihop_statistics();
177
178 G1Predictions _predictor;
179
180 double get_new_prediction(TruncatedSeq const* seq) const;
181
631 void record_full_collection_end();
632
633 // Must currently be called while the world is stopped.
634 void record_concurrent_mark_init_end(double mark_init_elapsed_time_ms);
635
636 // Record start and end of remark.
637 void record_concurrent_mark_remark_start();
638 void record_concurrent_mark_remark_end();
639
640 // Record start, end, and completion of cleanup.
641 void record_concurrent_mark_cleanup_start();
642 void record_concurrent_mark_cleanup_end();
643 void record_concurrent_mark_cleanup_completed();
644
645 // Records the information about the heap size for reporting in
646 // print_detailed_heap_transition
647 void record_heap_size_info_at_start(bool full);
648
649 // Print heap sizing transition (with less and more detail).
650
651 void print_heap_transition(size_t bytes_before) const;
652 void print_heap_transition() const;
653 void print_detailed_heap_transition(bool full = false) const;
654
655 virtual void print_phases(double pause_time_sec);
656
657 void record_stop_world_start();
658 void record_concurrent_pause();
659
660 // Record how much space we copied during a GC. This is typically
661 // called when a GC alloc region is being retired.
662 void record_bytes_copied_during_gc(size_t bytes) {
663 _bytes_copied_during_gc += bytes;
664 }
665
666 // The amount of space we copied during a GC.
667 size_t bytes_copied_during_gc() const {
668 return _bytes_copied_during_gc;
669 }
670
671 size_t collection_set_bytes_used_before() const {
672 return _collection_set_bytes_used_before;
673 }
792 }
793
794 private:
795 //
796 // Survivor regions policy.
797 //
798
799 // Current tenuring threshold, set to 0 if the collector reaches the
800 // maximum amount of survivors regions.
801 uint _tenuring_threshold;
802
803 // The limit on the number of regions allocated for survivors.
804 uint _max_survivor_regions;
805
806 // For reporting purposes.
807 // The value of _heap_bytes_before_gc is also used to calculate
808 // the cost of copying.
809
810 size_t _eden_used_bytes_before_gc; // Eden occupancy before GC
811 size_t _survivor_used_bytes_before_gc; // Survivor occupancy before GC
812 size_t _heap_used_bytes_before_gc; // Heap occupancy before GC
813 size_t _metaspace_used_bytes_before_gc; // Metaspace occupancy before GC
814
815 size_t _eden_capacity_bytes_before_gc; // Eden capacity before GC
816 size_t _heap_capacity_bytes_before_gc; // Heap capacity before GC
817
818 // The amount of survivor regions after a collection.
819 uint _recorded_survivor_regions;
820 // List of survivor regions.
821 HeapRegion* _recorded_survivor_head;
822 HeapRegion* _recorded_survivor_tail;
823
824 ageTable _survivors_age_table;
825
826 public:
827 uint tenuring_threshold() const { return _tenuring_threshold; }
828
829 static const uint REGIONS_UNLIMITED = (uint) -1;
830
831 uint max_regions(InCSetState dest) const {
|
142 uint calculate_default_min_length(uint new_number_of_heap_regions);
143 uint calculate_default_max_length(uint new_number_of_heap_regions);
144
145 // Update the given values for minimum and maximum young gen length in regions
146 // given the number of heap regions depending on the kind of sizing algorithm.
147 void recalculate_min_max_young_length(uint number_of_heap_regions, uint* min_young_length, uint* max_young_length);
148
149 public:
150 G1YoungGenSizer();
151 // Calculate the maximum length of the young gen given the number of regions
152 // depending on the sizing algorithm.
153 uint max_young_length(uint number_of_heap_regions);
154
155 void heap_size_changed(uint new_number_of_heap_regions);
156 uint min_desired_young_length() {
157 return _min_desired_young_length;
158 }
159 uint max_desired_young_length() {
160 return _max_desired_young_length;
161 }
162
163 bool adaptive_young_list_length() const {
164 return _adaptive_size;
165 }
166 };
167
168 class G1CollectorPolicy: public CollectorPolicy {
169 private:
170 G1IHOPControl* _ihop_control;
171
172 G1IHOPControl* create_ihop_control() const;
173 // Update the IHOP control with necessary statistics.
174 void update_ihop_prediction(double mutator_time_s,
175 size_t mutator_alloc_bytes,
176 size_t young_gen_size);
177 void report_ihop_statistics();
178
179 G1Predictions _predictor;
180
181 double get_new_prediction(TruncatedSeq const* seq) const;
182
632 void record_full_collection_end();
633
634 // Must currently be called while the world is stopped.
635 void record_concurrent_mark_init_end(double mark_init_elapsed_time_ms);
636
637 // Record start and end of remark.
638 void record_concurrent_mark_remark_start();
639 void record_concurrent_mark_remark_end();
640
641 // Record start, end, and completion of cleanup.
642 void record_concurrent_mark_cleanup_start();
643 void record_concurrent_mark_cleanup_end();
644 void record_concurrent_mark_cleanup_completed();
645
646 // Records the information about the heap size for reporting in
647 // print_detailed_heap_transition
648 void record_heap_size_info_at_start(bool full);
649
650 // Print heap sizing transition (with less and more detail).
651
652 void print_detailed_heap_transition() const;
653
654 virtual void print_phases(double pause_time_sec);
655
656 void record_stop_world_start();
657 void record_concurrent_pause();
658
659 // Record how much space we copied during a GC. This is typically
660 // called when a GC alloc region is being retired.
661 void record_bytes_copied_during_gc(size_t bytes) {
662 _bytes_copied_during_gc += bytes;
663 }
664
665 // The amount of space we copied during a GC.
666 size_t bytes_copied_during_gc() const {
667 return _bytes_copied_during_gc;
668 }
669
670 size_t collection_set_bytes_used_before() const {
671 return _collection_set_bytes_used_before;
672 }
791 }
792
793 private:
794 //
795 // Survivor regions policy.
796 //
797
798 // Current tenuring threshold, set to 0 if the collector reaches the
799 // maximum amount of survivors regions.
800 uint _tenuring_threshold;
801
802 // The limit on the number of regions allocated for survivors.
803 uint _max_survivor_regions;
804
805 // For reporting purposes.
806 // The value of _heap_bytes_before_gc is also used to calculate
807 // the cost of copying.
808
809 size_t _eden_used_bytes_before_gc; // Eden occupancy before GC
810 size_t _survivor_used_bytes_before_gc; // Survivor occupancy before GC
811 size_t _old_used_bytes_before_gc; // Old occupancy before GC
812 size_t _humongous_used_bytes_before_gc; // Humongous occupancy before GC
813 size_t _heap_used_bytes_before_gc; // Heap occupancy before GC
814 size_t _metaspace_used_bytes_before_gc; // Metaspace occupancy before GC
815
816 size_t _eden_capacity_bytes_before_gc; // Eden capacity before GC
817 size_t _heap_capacity_bytes_before_gc; // Heap capacity before GC
818
819 // The amount of survivor regions after a collection.
820 uint _recorded_survivor_regions;
821 // List of survivor regions.
822 HeapRegion* _recorded_survivor_head;
823 HeapRegion* _recorded_survivor_tail;
824
825 ageTable _survivors_age_table;
826
827 public:
828 uint tenuring_threshold() const { return _tenuring_threshold; }
829
830 static const uint REGIONS_UNLIMITED = (uint) -1;
831
832 uint max_regions(InCSetState dest) const {
|