128 virtual GenCollectorPolicy* as_generation_policy() { return NULL; }
129 virtual MarkSweepPolicy* as_mark_sweep_policy() { return NULL; }
130 #if INCLUDE_ALL_GCS
131 virtual ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return NULL; }
132 virtual G1CollectorPolicy* as_g1_policy() { return NULL; }
133 #endif // INCLUDE_ALL_GCS
134 // Note that these are not virtual.
135 bool is_generation_policy() { return as_generation_policy() != NULL; }
136 bool is_mark_sweep_policy() { return as_mark_sweep_policy() != NULL; }
137 #if INCLUDE_ALL_GCS
138 bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; }
139 bool is_g1_policy() { return as_g1_policy() != NULL; }
140 #else // INCLUDE_ALL_GCS
141 bool is_concurrent_mark_sweep_policy() { return false; }
142 bool is_g1_policy() { return false; }
143 #endif // INCLUDE_ALL_GCS
144
145
146 virtual CardTableRS* create_rem_set(MemRegion reserved);
147
148 // This method controls how a collector satisfies a request
149 // for a block of memory. "gc_time_limit_was_exceeded" will
150 // be set to true if the adaptive size policy determine that
151 // an excessive amount of time is being spent doing collections
152 // and caused a NULL to be returned. If a NULL is not returned,
153 // "gc_time_limit_was_exceeded" has an undefined meaning.
154 virtual HeapWord* mem_allocate_work(size_t size,
155 bool is_tlab,
156 bool* gc_overhead_limit_was_exceeded) = 0;
157
158 // This method controls how a collector handles one or more
159 // of its generations being fully allocated.
160 virtual HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab) = 0;
161 // This method controls how a collector handles a metadata allocation
162 // failure.
163 virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
164 size_t size,
165 Metaspace::MetadataType mdtype);
166
167 // Performance Counter support
168 GCPolicyCounters* counters() { return _gc_policy_counters; }
169
170 // Create the jstat counters for the GC policy. By default, policy's
171 // don't have associated counters, and we complain if this is invoked.
172 virtual void initialize_gc_policy_counters() {
173 ShouldNotReachHere();
174 }
175
176 // Do any updates required to global flags that are due to heap initialization
177 // changes
178 virtual void post_heap_initialize() = 0;
179 };
180
181 class ClearedAllSoftRefs : public StackObj {
182 bool _clear_all_soft_refs;
183 CollectorPolicy* _collector_policy;
|
128 virtual GenCollectorPolicy* as_generation_policy() { return NULL; }
129 virtual MarkSweepPolicy* as_mark_sweep_policy() { return NULL; }
130 #if INCLUDE_ALL_GCS
131 virtual ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return NULL; }
132 virtual G1CollectorPolicy* as_g1_policy() { return NULL; }
133 #endif // INCLUDE_ALL_GCS
134 // Note that these are not virtual.
135 bool is_generation_policy() { return as_generation_policy() != NULL; }
136 bool is_mark_sweep_policy() { return as_mark_sweep_policy() != NULL; }
137 #if INCLUDE_ALL_GCS
138 bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; }
139 bool is_g1_policy() { return as_g1_policy() != NULL; }
140 #else // INCLUDE_ALL_GCS
141 bool is_concurrent_mark_sweep_policy() { return false; }
142 bool is_g1_policy() { return false; }
143 #endif // INCLUDE_ALL_GCS
144
145
146 virtual CardTableRS* create_rem_set(MemRegion reserved);
147
148 MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
149 size_t size,
150 Metaspace::MetadataType mdtype);
151
152 // Performance Counter support
153 GCPolicyCounters* counters() { return _gc_policy_counters; }
154
155 // Create the jstat counters for the GC policy. By default, policy's
156 // don't have associated counters, and we complain if this is invoked.
157 virtual void initialize_gc_policy_counters() {
158 ShouldNotReachHere();
159 }
160
161 // Do any updates required to global flags that are due to heap initialization
162 // changes
163 virtual void post_heap_initialize() = 0;
164 };
165
166 class ClearedAllSoftRefs : public StackObj {
167 bool _clear_all_soft_refs;
168 CollectorPolicy* _collector_policy;
|