139 uint calculate_default_min_length(uint new_number_of_heap_regions);
140 uint calculate_default_max_length(uint new_number_of_heap_regions);
141
142 // Update the given values for minimum and maximum young gen length in regions
143 // given the number of heap regions depending on the kind of sizing algorithm.
144 void recalculate_min_max_young_length(uint number_of_heap_regions, uint* min_young_length, uint* max_young_length);
145
146 public:
147 G1YoungGenSizer();
148 // Calculate the maximum length of the young gen given the number of regions
149 // depending on the sizing algorithm.
150 uint max_young_length(uint number_of_heap_regions);
151
152 void heap_size_changed(uint new_number_of_heap_regions);
153 uint min_desired_young_length() {
154 return _min_desired_young_length;
155 }
156 uint max_desired_young_length() {
157 return _max_desired_young_length;
158 }
159 bool adaptive_young_list_length() const {
160 return _adaptive_size;
161 }
162 };
163
164 class G1CollectorPolicy: public CollectorPolicy {
165 private:
166 G1Predictions _predictor;
167
168 double get_new_prediction(TruncatedSeq const* seq) const;
169
170 // either equal to the number of parallel threads, if ParallelGCThreads
171 // has been set, or 1 otherwise
172 int _parallel_gc_threads;
173
174 // The number of GC threads currently active.
175 uintx _no_of_gc_threads;
176
177 G1MMUTracker* _mmu_tracker;
178
579 void record_full_collection_end();
580
581 // Must currently be called while the world is stopped.
582 void record_concurrent_mark_init_end(double mark_init_elapsed_time_ms);
583
584 // Record start and end of remark.
585 void record_concurrent_mark_remark_start();
586 void record_concurrent_mark_remark_end();
587
588 // Record start, end, and completion of cleanup.
589 void record_concurrent_mark_cleanup_start();
590 void record_concurrent_mark_cleanup_end();
591 void record_concurrent_mark_cleanup_completed();
592
593 // Records the information about the heap size for reporting in
594 // print_detailed_heap_transition
595 void record_heap_size_info_at_start(bool full);
596
597 // Print heap sizing transition (with less and more detail).
598
599 void print_heap_transition(size_t bytes_before) const;
600 void print_heap_transition() const;
601 void print_detailed_heap_transition(bool full = false) const;
602
603 virtual void print_phases(double pause_time_sec);
604
605 void record_stop_world_start();
606 void record_concurrent_pause();
607
608 // Record how much space we copied during a GC. This is typically
609 // called when a GC alloc region is being retired.
610 void record_bytes_copied_during_gc(size_t bytes) {
611 _bytes_copied_during_gc += bytes;
612 }
613
614 // The amount of space we copied during a GC.
615 size_t bytes_copied_during_gc() const {
616 return _bytes_copied_during_gc;
617 }
618
619 size_t collection_set_bytes_used_before() const {
620 return _collection_set_bytes_used_before;
621 }
736 }
737
738 private:
739 //
740 // Survivor regions policy.
741 //
742
743 // Current tenuring threshold, set to 0 if the collector reaches the
744 // maximum amount of survivors regions.
745 uint _tenuring_threshold;
746
747 // The limit on the number of regions allocated for survivors.
748 uint _max_survivor_regions;
749
750 // For reporting purposes.
751 // The value of _heap_bytes_before_gc is also used to calculate
752 // the cost of copying.
753
754 size_t _eden_used_bytes_before_gc; // Eden occupancy before GC
755 size_t _survivor_used_bytes_before_gc; // Survivor occupancy before GC
756 size_t _heap_used_bytes_before_gc; // Heap occupancy before GC
757 size_t _metaspace_used_bytes_before_gc; // Metaspace occupancy before GC
758
759 size_t _eden_capacity_bytes_before_gc; // Eden capacity before GC
760 size_t _heap_capacity_bytes_before_gc; // Heap capacity before GC
761
762 // The amount of survivor regions after a collection.
763 uint _recorded_survivor_regions;
764 // List of survivor regions.
765 HeapRegion* _recorded_survivor_head;
766 HeapRegion* _recorded_survivor_tail;
767
768 ageTable _survivors_age_table;
769
770 public:
771 uint tenuring_threshold() const { return _tenuring_threshold; }
772
773 static const uint REGIONS_UNLIMITED = (uint) -1;
774
775 uint max_regions(InCSetState dest) const {
|
139 uint calculate_default_min_length(uint new_number_of_heap_regions);
140 uint calculate_default_max_length(uint new_number_of_heap_regions);
141
142 // Update the given values for minimum and maximum young gen length in regions
143 // given the number of heap regions depending on the kind of sizing algorithm.
144 void recalculate_min_max_young_length(uint number_of_heap_regions, uint* min_young_length, uint* max_young_length);
145
146 public:
147 G1YoungGenSizer();
148 // Calculate the maximum length of the young gen given the number of regions
149 // depending on the sizing algorithm.
150 uint max_young_length(uint number_of_heap_regions);
151
152 void heap_size_changed(uint new_number_of_heap_regions);
153 uint min_desired_young_length() {
154 return _min_desired_young_length;
155 }
156 uint max_desired_young_length() {
157 return _max_desired_young_length;
158 }
159
160 bool adaptive_young_list_length() const {
161 return _adaptive_size;
162 }
163 };
164
165 class G1CollectorPolicy: public CollectorPolicy {
166 private:
167 G1Predictions _predictor;
168
169 double get_new_prediction(TruncatedSeq const* seq) const;
170
171 // either equal to the number of parallel threads, if ParallelGCThreads
172 // has been set, or 1 otherwise
173 int _parallel_gc_threads;
174
175 // The number of GC threads currently active.
176 uintx _no_of_gc_threads;
177
178 G1MMUTracker* _mmu_tracker;
179
580 void record_full_collection_end();
581
582 // Must currently be called while the world is stopped.
583 void record_concurrent_mark_init_end(double mark_init_elapsed_time_ms);
584
585 // Record start and end of remark.
586 void record_concurrent_mark_remark_start();
587 void record_concurrent_mark_remark_end();
588
589 // Record start, end, and completion of cleanup.
590 void record_concurrent_mark_cleanup_start();
591 void record_concurrent_mark_cleanup_end();
592 void record_concurrent_mark_cleanup_completed();
593
594 // Records the information about the heap size for reporting in
595 // print_detailed_heap_transition
596 void record_heap_size_info_at_start(bool full);
597
598 // Print heap sizing transition (with less and more detail).
599
600 void print_detailed_heap_transition() const;
601
602 virtual void print_phases(double pause_time_sec);
603
604 void record_stop_world_start();
605 void record_concurrent_pause();
606
607 // Record how much space we copied during a GC. This is typically
608 // called when a GC alloc region is being retired.
609 void record_bytes_copied_during_gc(size_t bytes) {
610 _bytes_copied_during_gc += bytes;
611 }
612
613 // The amount of space we copied during a GC.
614 size_t bytes_copied_during_gc() const {
615 return _bytes_copied_during_gc;
616 }
617
618 size_t collection_set_bytes_used_before() const {
619 return _collection_set_bytes_used_before;
620 }
735 }
736
737 private:
738 //
739 // Survivor regions policy.
740 //
741
742 // Current tenuring threshold, set to 0 if the collector reaches the
743 // maximum amount of survivors regions.
744 uint _tenuring_threshold;
745
746 // The limit on the number of regions allocated for survivors.
747 uint _max_survivor_regions;
748
749 // For reporting purposes.
750 // The value of _heap_bytes_before_gc is also used to calculate
751 // the cost of copying.
752
753 size_t _eden_used_bytes_before_gc; // Eden occupancy before GC
754 size_t _survivor_used_bytes_before_gc; // Survivor occupancy before GC
755 size_t _old_used_bytes_before_gc; // Old occupancy before GC
756 size_t _heap_used_bytes_before_gc; // Heap occupancy before GC
757 size_t _metaspace_used_bytes_before_gc; // Metaspace occupancy before GC
758
759 size_t _eden_capacity_bytes_before_gc; // Eden capacity before GC
760 size_t _heap_capacity_bytes_before_gc; // Heap capacity before GC
761
762 // The amount of survivor regions after a collection.
763 uint _recorded_survivor_regions;
764 // List of survivor regions.
765 HeapRegion* _recorded_survivor_head;
766 HeapRegion* _recorded_survivor_tail;
767
768 ageTable _survivors_age_table;
769
770 public:
771 uint tenuring_threshold() const { return _tenuring_threshold; }
772
773 static const uint REGIONS_UNLIMITED = (uint) -1;
774
775 uint max_regions(InCSetState dest) const {
|