comparison src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @ 4913:ab4422d0ed59

7146343: PS invoke methods should indicate the type of gc done Reviewed-by: stefank, jmasa
author jcoomes
date Thu, 16 Feb 2012 13:12:25 -0800
parents 95f6641e38e0
children 9d679effd28c
comparison
equal deleted inserted replaced
4912:a9647476d1a4 4913:ab4422d0ed59
213 // we've exceeded policy time limits, or any other special behavior. 213 // we've exceeded policy time limits, or any other special behavior.
214 // All such policy should be placed here. 214 // All such policy should be placed here.
215 // 215 //
216 // Note that this method should only be called from the vm_thread while 216 // Note that this method should only be called from the vm_thread while
217 // at a safepoint! 217 // at a safepoint!
218 void PSScavenge::invoke() { 218 bool PSScavenge::invoke() {
219 assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint"); 219 assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
220 assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread"); 220 assert(Thread::current() == (Thread*)VMThread::vm_thread(), "should be in vm thread");
221 assert(!Universe::heap()->is_gc_active(), "not reentrant"); 221 assert(!Universe::heap()->is_gc_active(), "not reentrant");
222 222
223 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); 223 ParallelScavengeHeap* const heap = (ParallelScavengeHeap*)Universe::heap();
224 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); 224 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
225 225
226 PSAdaptiveSizePolicy* policy = heap->size_policy(); 226 PSAdaptiveSizePolicy* policy = heap->size_policy();
227 IsGCActiveMark mark; 227 IsGCActiveMark mark;
228 228
229 bool scavenge_was_done = PSScavenge::invoke_no_policy(); 229 const bool scavenge_done = PSScavenge::invoke_no_policy();
230 230 const bool need_full_gc = !scavenge_done ||
231 PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters(); 231 policy->should_full_GC(heap->old_gen()->free_in_bytes());
232 if (UsePerfData) 232 bool full_gc_done = false;
233 counters->update_full_follows_scavenge(0); 233
234 if (!scavenge_was_done || 234 if (UsePerfData) {
235 policy->should_full_GC(heap->old_gen()->free_in_bytes())) { 235 PSGCAdaptivePolicyCounters* const counters = heap->gc_policy_counters();
236 if (UsePerfData) 236 const int ffs_val = need_full_gc ? full_follows_scavenge : not_skipped;
237 counters->update_full_follows_scavenge(full_follows_scavenge); 237 counters->update_full_follows_scavenge(ffs_val);
238 }
239
240 if (need_full_gc) {
238 GCCauseSetter gccs(heap, GCCause::_adaptive_size_policy); 241 GCCauseSetter gccs(heap, GCCause::_adaptive_size_policy);
239 CollectorPolicy* cp = heap->collector_policy(); 242 CollectorPolicy* cp = heap->collector_policy();
240 const bool clear_all_softrefs = cp->should_clear_all_soft_refs(); 243 const bool clear_all_softrefs = cp->should_clear_all_soft_refs();
241 244
242 if (UseParallelOldGC) { 245 if (UseParallelOldGC) {
243 PSParallelCompact::invoke_no_policy(clear_all_softrefs); 246 full_gc_done = PSParallelCompact::invoke_no_policy(clear_all_softrefs);
244 } else { 247 } else {
245 PSMarkSweep::invoke_no_policy(clear_all_softrefs); 248 full_gc_done = PSMarkSweep::invoke_no_policy(clear_all_softrefs);
246 } 249 }
247 } 250 }
251
252 return full_gc_done;
248 } 253 }
249 254
250 // This method contains no policy. You should probably 255 // This method contains no policy. You should probably
251 // be calling invoke() instead. 256 // be calling invoke() instead.
252 bool PSScavenge::invoke_no_policy() { 257 bool PSScavenge::invoke_no_policy() {