86 void record_bytes_allocated(size_t bytes);
87 void record_bytes_reclaimed(size_t bytes);
88 void record_bytes_start_CM(size_t bytes);
89 void record_bytes_end_CM(size_t bytes);
90
91 void record_gc_start() {
92 // Do nothing.
93 }
94
95 void record_gc_end() {
96 _bytes_allocated_after_last_gc = ShenandoahHeap::heap()->used();
97 }
98
99 size_t bytes_in_cset() const { return _bytes_in_cset; }
100
101 virtual void print_thresholds() {
102 }
103
104 virtual bool should_start_concurrent_mark(size_t used, size_t capacity) const=0;
105
106 virtual bool should_start_partial_gc() {
107 return false;
108 }
109
110 virtual bool handover_cancelled_marking() {
111 return _cancelled_cm_cycles_in_a_row <= ShenandoahFullGCThreshold;
112 }
113
114 virtual void record_cm_cancelled() {
115 _cancelled_cm_cycles_in_a_row++;
116 _successful_cm_cycles_in_a_row = 0;
117 }
118
119 virtual void record_cm_success() {
120 _cancelled_cm_cycles_in_a_row = 0;
121 _successful_cm_cycles_in_a_row++;
122 }
123
124 virtual void record_full_gc() {
125 _bytes_in_cset = 0;
769
770 _phase_names[recycle_regions] = " Recycle regions";
771 _phase_names[reset_bitmaps] = "Reset Bitmaps";
772 _phase_names[resize_tlabs] = "Resize TLABs";
773
774 _phase_names[full_gc] = "Full GC";
775 _phase_names[full_gc_heapdumps] = " Heap Dumps";
776 _phase_names[full_gc_prepare] = " Prepare";
777 _phase_names[full_gc_mark] = " Mark";
778 _phase_names[full_gc_mark_drain_queues] = " Drain Queues";
779 _phase_names[full_gc_mark_weakrefs] = " Weak References";
780 _phase_names[full_gc_mark_class_unloading] = " Class Unloading";
781 _phase_names[full_gc_calculate_addresses] = " Calculate Addresses";
782 _phase_names[full_gc_adjust_pointers] = " Adjust Pointers";
783 _phase_names[full_gc_copy_objects] = " Copy Objects";
784
785 _phase_names[partial_gc] = "Partial GC";
786 _phase_names[conc_mark] = "Concurrent Marking";
787 _phase_names[conc_evac] = "Concurrent Evacuation";
788
789 if (ShenandoahGCHeuristics != NULL) {
790 if (strcmp(ShenandoahGCHeuristics, "aggressive") == 0) {
791 log_info(gc, init)("Shenandoah heuristics: aggressive");
792 _heuristics = new AggressiveHeuristics();
793 } else if (strcmp(ShenandoahGCHeuristics, "dynamic") == 0) {
794 log_info(gc, init)("Shenandoah heuristics: dynamic");
795 _heuristics = new DynamicHeuristics();
796 } else if (strcmp(ShenandoahGCHeuristics, "global") == 0) {
797 log_info(gc, init)("Shenandoah heuristics: global");
798 _heuristics = new GlobalHeuristics();
799 } else if (strcmp(ShenandoahGCHeuristics, "ratio") == 0) {
800 log_info(gc, init)("Shenandoah heuristics: ratio");
801 _heuristics = new RatioHeuristics();
802 } else if (strcmp(ShenandoahGCHeuristics, "adaptive") == 0) {
803 log_info(gc, init)("Shenandoah heuristics: adaptive");
804 _heuristics = new AdaptiveHeuristics();
805 } else if (strcmp(ShenandoahGCHeuristics, "passive") == 0) {
806 log_info(gc, init)("Shenandoah heuristics: passive");
807 _heuristics = new PassiveHeuristics();
808 } else if (strcmp(ShenandoahGCHeuristics, "connections") == 0) {
866
867 void ShenandoahCollectorPolicy::record_bytes_reclaimed(size_t bytes) {
868 _heuristics->record_bytes_reclaimed(bytes);
869 }
870
871 void ShenandoahCollectorPolicy::record_user_requested_gc() {
872 _user_requested_gcs++;
873 }
874
875 void ShenandoahCollectorPolicy::record_allocation_failure_gc() {
876 _allocation_failure_gcs++;
877 }
878
879 bool ShenandoahCollectorPolicy::should_start_concurrent_mark(size_t used,
880 size_t capacity) {
881 return _heuristics->should_start_concurrent_mark(used, capacity);
882 }
883
884 bool ShenandoahCollectorPolicy::handover_cancelled_marking() {
885 return _heuristics->handover_cancelled_marking();
886 }
887
888 void ShenandoahCollectorPolicy::record_cm_success() {
889 _heuristics->record_cm_success();
890 _successful_cm++;
891 }
892
893 void ShenandoahCollectorPolicy::record_cm_degenerated() {
894 _degenerated_cm++;
895 }
896
897 void ShenandoahCollectorPolicy::record_cm_cancelled() {
898 _heuristics->record_cm_cancelled();
899 }
900
901 void ShenandoahCollectorPolicy::record_full_gc() {
902 _heuristics->record_full_gc();
903 }
904
905 void ShenandoahCollectorPolicy::choose_collection_set(ShenandoahCollectionSet* collection_set, int* connections) {
|
86 void record_bytes_allocated(size_t bytes);
87 void record_bytes_reclaimed(size_t bytes);
88 void record_bytes_start_CM(size_t bytes);
89 void record_bytes_end_CM(size_t bytes);
90
91 void record_gc_start() {
92 // Do nothing.
93 }
94
95 void record_gc_end() {
96 _bytes_allocated_after_last_gc = ShenandoahHeap::heap()->used();
97 }
98
99 size_t bytes_in_cset() const { return _bytes_in_cset; }
100
101 virtual void print_thresholds() {
102 }
103
104 virtual bool should_start_concurrent_mark(size_t used, size_t capacity) const=0;
105
106 virtual bool update_refs_early() {
107 return ShenandoahUpdateRefsEarly;
108 }
109
110 virtual bool should_start_partial_gc() {
111 return false;
112 }
113
114 virtual bool handover_cancelled_marking() {
115 return _cancelled_cm_cycles_in_a_row <= ShenandoahFullGCThreshold;
116 }
117
118 virtual void record_cm_cancelled() {
119 _cancelled_cm_cycles_in_a_row++;
120 _successful_cm_cycles_in_a_row = 0;
121 }
122
123 virtual void record_cm_success() {
124 _cancelled_cm_cycles_in_a_row = 0;
125 _successful_cm_cycles_in_a_row++;
126 }
127
128 virtual void record_full_gc() {
129 _bytes_in_cset = 0;
773
774 _phase_names[recycle_regions] = " Recycle regions";
775 _phase_names[reset_bitmaps] = "Reset Bitmaps";
776 _phase_names[resize_tlabs] = "Resize TLABs";
777
778 _phase_names[full_gc] = "Full GC";
779 _phase_names[full_gc_heapdumps] = " Heap Dumps";
780 _phase_names[full_gc_prepare] = " Prepare";
781 _phase_names[full_gc_mark] = " Mark";
782 _phase_names[full_gc_mark_drain_queues] = " Drain Queues";
783 _phase_names[full_gc_mark_weakrefs] = " Weak References";
784 _phase_names[full_gc_mark_class_unloading] = " Class Unloading";
785 _phase_names[full_gc_calculate_addresses] = " Calculate Addresses";
786 _phase_names[full_gc_adjust_pointers] = " Adjust Pointers";
787 _phase_names[full_gc_copy_objects] = " Copy Objects";
788
789 _phase_names[partial_gc] = "Partial GC";
790 _phase_names[conc_mark] = "Concurrent Marking";
791 _phase_names[conc_evac] = "Concurrent Evacuation";
792
793 _phase_names[conc_update_refs] = "Concurrent Update References";
794 _phase_names[pre_update_refs] = "Pause Pre Update References";
795 _phase_names[post_update_refs] = "Pause Post Update References";
796
797 if (ShenandoahGCHeuristics != NULL) {
798 if (strcmp(ShenandoahGCHeuristics, "aggressive") == 0) {
799 log_info(gc, init)("Shenandoah heuristics: aggressive");
800 _heuristics = new AggressiveHeuristics();
801 } else if (strcmp(ShenandoahGCHeuristics, "dynamic") == 0) {
802 log_info(gc, init)("Shenandoah heuristics: dynamic");
803 _heuristics = new DynamicHeuristics();
804 } else if (strcmp(ShenandoahGCHeuristics, "global") == 0) {
805 log_info(gc, init)("Shenandoah heuristics: global");
806 _heuristics = new GlobalHeuristics();
807 } else if (strcmp(ShenandoahGCHeuristics, "ratio") == 0) {
808 log_info(gc, init)("Shenandoah heuristics: ratio");
809 _heuristics = new RatioHeuristics();
810 } else if (strcmp(ShenandoahGCHeuristics, "adaptive") == 0) {
811 log_info(gc, init)("Shenandoah heuristics: adaptive");
812 _heuristics = new AdaptiveHeuristics();
813 } else if (strcmp(ShenandoahGCHeuristics, "passive") == 0) {
814 log_info(gc, init)("Shenandoah heuristics: passive");
815 _heuristics = new PassiveHeuristics();
816 } else if (strcmp(ShenandoahGCHeuristics, "connections") == 0) {
874
875 void ShenandoahCollectorPolicy::record_bytes_reclaimed(size_t bytes) {
876 _heuristics->record_bytes_reclaimed(bytes);
877 }
878
879 void ShenandoahCollectorPolicy::record_user_requested_gc() {
880 _user_requested_gcs++;
881 }
882
883 void ShenandoahCollectorPolicy::record_allocation_failure_gc() {
884 _allocation_failure_gcs++;
885 }
886
887 bool ShenandoahCollectorPolicy::should_start_concurrent_mark(size_t used,
888 size_t capacity) {
889 return _heuristics->should_start_concurrent_mark(used, capacity);
890 }
891
892 bool ShenandoahCollectorPolicy::handover_cancelled_marking() {
893 return _heuristics->handover_cancelled_marking();
894 }
895
896 bool ShenandoahCollectorPolicy::update_refs_early() {
897 return _heuristics->update_refs_early();
898 }
899
900 void ShenandoahCollectorPolicy::record_cm_success() {
901 _heuristics->record_cm_success();
902 _successful_cm++;
903 }
904
905 void ShenandoahCollectorPolicy::record_cm_degenerated() {
906 _degenerated_cm++;
907 }
908
909 void ShenandoahCollectorPolicy::record_cm_cancelled() {
910 _heuristics->record_cm_cancelled();
911 }
912
913 void ShenandoahCollectorPolicy::record_full_gc() {
914 _heuristics->record_full_gc();
915 }
916
917 void ShenandoahCollectorPolicy::choose_collection_set(ShenandoahCollectionSet* collection_set, int* connections) {
|