37 // to deal with those issues is this class. |
37 // to deal with those issues is this class. |
38 |
38 |
39 // Forward declarations. |
39 // Forward declarations. |
40 class GenCollectorPolicy; |
40 class GenCollectorPolicy; |
41 class TwoGenerationCollectorPolicy; |
41 class TwoGenerationCollectorPolicy; |
|
42 class AdaptiveSizePolicy; |
42 #ifndef SERIALGC |
43 #ifndef SERIALGC |
43 class ConcurrentMarkSweepPolicy; |
44 class ConcurrentMarkSweepPolicy; |
|
45 class G1CollectorPolicy; |
44 #endif // SERIALGC |
46 #endif // SERIALGC |
45 class AdaptiveSizePolicy; |
47 |
46 class GCPolicyCounters; |
48 class GCPolicyCounters; |
47 class PermanentGenerationSpec; |
49 class PermanentGenerationSpec; |
48 class MarkSweepPolicy; |
50 class MarkSweepPolicy; |
49 |
51 |
50 class CollectorPolicy : public CHeapObj { |
52 class CollectorPolicy : public CHeapObj { |
53 GCPolicyCounters* _gc_policy_counters; |
55 GCPolicyCounters* _gc_policy_counters; |
54 |
56 |
55 // Requires that the concrete subclass sets the alignment constraints |
57 // Requires that the concrete subclass sets the alignment constraints |
56 // before calling. |
58 // before calling. |
57 virtual void initialize_flags(); |
59 virtual void initialize_flags(); |
58 virtual void initialize_size_info() = 0; |
60 virtual void initialize_size_info(); |
59 // Initialize "_permanent_generation" to a spec for the given kind of |
61 // Initialize "_permanent_generation" to a spec for the given kind of |
60 // Perm Gen. |
62 // Perm Gen. |
61 void initialize_perm_generation(PermGen::Name pgnm); |
63 void initialize_perm_generation(PermGen::Name pgnm); |
62 |
64 |
63 size_t _initial_heap_byte_size; |
65 size_t _initial_heap_byte_size; |
89 void set_min_heap_byte_size(size_t v) { _min_heap_byte_size = v; } |
91 void set_min_heap_byte_size(size_t v) { _min_heap_byte_size = v; } |
90 |
92 |
91 enum Name { |
93 enum Name { |
92 CollectorPolicyKind, |
94 CollectorPolicyKind, |
93 TwoGenerationCollectorPolicyKind, |
95 TwoGenerationCollectorPolicyKind, |
94 TrainPolicyKind, |
|
95 ConcurrentMarkSweepPolicyKind, |
96 ConcurrentMarkSweepPolicyKind, |
96 ASConcurrentMarkSweepPolicyKind |
97 ASConcurrentMarkSweepPolicyKind, |
|
98 G1CollectorPolicyKind |
97 }; |
99 }; |
98 |
100 |
99 // Identification methods. |
101 // Identification methods. |
100 virtual GenCollectorPolicy* as_generation_policy() { return NULL; } |
102 virtual GenCollectorPolicy* as_generation_policy() { return NULL; } |
101 virtual TwoGenerationCollectorPolicy* as_two_generation_policy() { return NULL; } |
103 virtual TwoGenerationCollectorPolicy* as_two_generation_policy() { return NULL; } |
102 virtual MarkSweepPolicy* as_mark_sweep_policy() { return NULL; } |
104 virtual MarkSweepPolicy* as_mark_sweep_policy() { return NULL; } |
103 #ifndef SERIALGC |
105 #ifndef SERIALGC |
104 virtual ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return NULL; } |
106 virtual ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return NULL; } |
|
107 virtual G1CollectorPolicy* as_g1_policy() { return NULL; } |
105 #endif // SERIALGC |
108 #endif // SERIALGC |
106 // Note that these are not virtual. |
109 // Note that these are not virtual. |
107 bool is_generation_policy() { return as_generation_policy() != NULL; } |
110 bool is_generation_policy() { return as_generation_policy() != NULL; } |
108 bool is_two_generation_policy() { return as_two_generation_policy() != NULL; } |
111 bool is_two_generation_policy() { return as_two_generation_policy() != NULL; } |
109 bool is_mark_sweep_policy() { return as_mark_sweep_policy() != NULL; } |
112 bool is_mark_sweep_policy() { return as_mark_sweep_policy() != NULL; } |
110 #ifndef SERIALGC |
113 #ifndef SERIALGC |
111 bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; } |
114 bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; } |
|
115 bool is_g1_policy() { return as_g1_policy() != NULL; } |
112 #else // SERIALGC |
116 #else // SERIALGC |
113 bool is_concurrent_mark_sweep_policy() { return false; } |
117 bool is_concurrent_mark_sweep_policy() { return false; } |
|
118 bool is_g1_policy() { return false; } |
114 #endif // SERIALGC |
119 #endif // SERIALGC |
|
120 |
115 |
121 |
116 virtual PermanentGenerationSpec *permanent_generation() { |
122 virtual PermanentGenerationSpec *permanent_generation() { |
117 assert(_permanent_generation != NULL, "Sanity check"); |
123 assert(_permanent_generation != NULL, "Sanity check"); |
118 return _permanent_generation; |
124 return _permanent_generation; |
119 } |
125 } |