24 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
26
27 #include "gc/shared/gcTrace.hpp"
28 #include "gc/shared/gcTimer.hpp"
29 #include "gc/shared/collectorPolicy.hpp"
30 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
31 #include "gc/shenandoah/shenandoahHeap.hpp"
32 #include "runtime/arguments.hpp"
33 #include "utilities/numberSeq.hpp"
34
35 class ShenandoahCollectionSet;
36 class ShenandoahConnectionMatrix;
37 class ShenandoahFreeSet;
38 class ShenandoahHeap;
39 class ShenandoahHeuristics;
40 class outputStream;
41
42 class ShenandoahCollectorPolicy: public CollectorPolicy {
43 private:
44 size_t _success_partial_gcs;
45 size_t _success_concurrent_gcs;
46 size_t _success_degenerated_gcs;
47 size_t _success_full_gcs;
48 size_t _alloc_failure_degenerated;
49 size_t _alloc_failure_degenerated_upgrade_to_full;
50 size_t _alloc_failure_full;
51 size_t _explicit_concurrent;
52 size_t _explicit_full;
53 size_t _degen_points[ShenandoahHeap::_DEGENERATED_LIMIT];
54
55 ShenandoahSharedFlag _in_shutdown;
56
57 ShenandoahHeuristics* _heuristics;
58 ShenandoahHeuristics* _minor_heuristics;
59 ShenandoahTracer* _tracer;
60
61 size_t _cycle_counter;
62
63
64 public:
65 ShenandoahCollectorPolicy();
66
67 virtual ShenandoahCollectorPolicy* as_pgc_policy();
68
69 BarrierSet::Name barrier_set_name();
70
71 HeapWord* mem_allocate_work(size_t size,
72 bool is_tlab,
73 bool* gc_overhead_limit_was_exceeded);
74
75 HeapWord* satisfy_failed_allocation(size_t size, bool is_tlab);
76
77 void initialize_alignments();
78
79 void post_heap_initialize();
80
81 void record_gc_start();
82 void record_gc_end();
83 ShenandoahHeuristics* heuristics() { return _heuristics;}
84 // TODO: This is different from gc_end: that one encompasses one VM operation.
85 // These two encompass the entire cycle.
86 void record_cycle_start();
87 void record_cycle_end();
88
89 void record_phase_time(ShenandoahPhaseTimings::Phase phase, double secs);
90
91 void record_success_partial();
92 void record_success_concurrent();
93 void record_success_degenerated();
94 void record_success_full();
95 void record_alloc_failure_to_degenerated(ShenandoahHeap::ShenandoahDegenPoint point);
96 void record_alloc_failure_to_full();
97 void record_degenerated_upgrade_to_full();
98 void record_explicit_to_concurrent();
99 void record_explicit_to_full();
100
101 bool should_start_normal_gc();
102 bool should_start_partial_gc();
103 bool can_do_partial_gc();
104 bool should_start_traversal_gc();
105 bool can_do_traversal_gc();
106
107 // Returns true when there should be a separate concurrent reference
108 // updating phase after evacuation.
109 bool should_start_update_refs();
110 bool update_refs();
111
112 bool should_degenerate_cycle();
113
114
115 void record_peak_occupancy();
116
117 void record_shutdown();
118 bool is_at_shutdown();
119
120 void choose_collection_set(ShenandoahCollectionSet* collection_set,
121 bool minor = false);
122
123 bool should_process_references();
124 bool should_unload_classes();
|
24 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
26
27 #include "gc/shared/gcTrace.hpp"
28 #include "gc/shared/gcTimer.hpp"
29 #include "gc/shared/collectorPolicy.hpp"
30 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
31 #include "gc/shenandoah/shenandoahHeap.hpp"
32 #include "runtime/arguments.hpp"
33 #include "utilities/numberSeq.hpp"
34
35 class ShenandoahCollectionSet;
36 class ShenandoahConnectionMatrix;
37 class ShenandoahFreeSet;
38 class ShenandoahHeap;
39 class ShenandoahHeuristics;
40 class outputStream;
41
42 class ShenandoahCollectorPolicy: public CollectorPolicy {
43 private:
44 size_t _success_concurrent_gcs;
45 size_t _success_degenerated_gcs;
46 size_t _success_full_gcs;
47 size_t _alloc_failure_degenerated;
48 size_t _alloc_failure_degenerated_upgrade_to_full;
49 size_t _alloc_failure_full;
50 size_t _explicit_concurrent;
51 size_t _explicit_full;
52 size_t _degen_points[ShenandoahHeap::_DEGENERATED_LIMIT];
53
54 ShenandoahSharedFlag _in_shutdown;
55
56 ShenandoahHeuristics* _heuristics;
57 ShenandoahTracer* _tracer;
58
59 size_t _cycle_counter;
60
61
62 public:
63 ShenandoahCollectorPolicy();
64
65 virtual ShenandoahCollectorPolicy* as_pgc_policy();
66
67 BarrierSet::Name barrier_set_name();
68
69 HeapWord* mem_allocate_work(size_t size,
70 bool is_tlab,
71 bool* gc_overhead_limit_was_exceeded);
72
73 HeapWord* satisfy_failed_allocation(size_t size, bool is_tlab);
74
75 void initialize_alignments();
76
77 void post_heap_initialize();
78
79 void record_gc_start();
80 void record_gc_end();
81 ShenandoahHeuristics* heuristics() { return _heuristics;}
82 // TODO: This is different from gc_end: that one encompasses one VM operation.
83 // These two encompass the entire cycle.
84 void record_cycle_start();
85 void record_cycle_end();
86
87 void record_phase_time(ShenandoahPhaseTimings::Phase phase, double secs);
88
89 void record_success_concurrent();
90 void record_success_degenerated();
91 void record_success_full();
92 void record_alloc_failure_to_degenerated(ShenandoahHeap::ShenandoahDegenPoint point);
93 void record_alloc_failure_to_full();
94 void record_degenerated_upgrade_to_full();
95 void record_explicit_to_concurrent();
96 void record_explicit_to_full();
97
98 bool should_start_normal_gc();
99 ShenandoahHeap::GCCycleMode should_start_traversal_gc();
100 bool can_do_traversal_gc();
101
102 // Returns true when there should be a separate concurrent reference
103 // updating phase after evacuation.
104 bool should_start_update_refs();
105 bool update_refs();
106
107 bool should_degenerate_cycle();
108
109
110 void record_peak_occupancy();
111
112 void record_shutdown();
113 bool is_at_shutdown();
114
115 void choose_collection_set(ShenandoahCollectionSet* collection_set,
116 bool minor = false);
117
118 bool should_process_references();
119 bool should_unload_classes();
|