305 if (res != NULL) return res; 306 else if (first_only) break; 307 } 308 } 309 // Otherwise... 310 return NULL; 311 } 312 313 HeapWord* GenCollectedHeap::mem_allocate(size_t size, 314 bool* gc_overhead_limit_was_exceeded) { 315 return collector_policy()->mem_allocate_work(size, 316 false /* is_tlab */, 317 gc_overhead_limit_was_exceeded); 318 } 319 320 bool GenCollectedHeap::must_clear_all_soft_refs() { 321 return _gc_cause == GCCause::_last_ditch_collection; 322 } 323 324 bool GenCollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) { 325 return UseConcMarkSweepGC && 326 ((cause == GCCause::_gc_locker && GCLockerInvokesConcurrent) || 327 (cause == GCCause::_java_lang_system_gc && ExplicitGCInvokesConcurrent)); 328 } 329 330 void GenCollectedHeap::do_collection(bool full, 331 bool clear_all_soft_refs, 332 size_t size, 333 bool is_tlab, 334 int max_level) { 335 bool prepared_for_verification = false; 336 ResourceMark rm; 337 DEBUG_ONLY(Thread* my_thread = Thread::current();) 338 339 assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint"); 340 assert(my_thread->is_VM_thread() || 341 my_thread->is_ConcurrentGC_thread(), 342 "incorrect thread type capability"); 343 assert(Heap_lock->is_locked(), 344 "the requesting thread should have the Heap_lock"); 345 guarantee(!is_gc_active(), "collection is not reentrant"); 346 assert(max_level < n_gens(), "sanity check"); 347 | 305 if (res != NULL) return res; 306 else if (first_only) break; 307 } 308 } 309 // Otherwise... 310 return NULL; 311 } 312 313 HeapWord* GenCollectedHeap::mem_allocate(size_t size, 314 bool* gc_overhead_limit_was_exceeded) { 315 return collector_policy()->mem_allocate_work(size, 316 false /* is_tlab */, 317 gc_overhead_limit_was_exceeded); 318 } 319 320 bool GenCollectedHeap::must_clear_all_soft_refs() { 321 return _gc_cause == GCCause::_last_ditch_collection; 322 } 323 324 bool GenCollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) { 325 if (!UseConcMarkSweepGC) { 326 return false; 327 } 328 329 switch (cause) { 330 case GCCause::_gc_locker: return GCLockerInvokesConcurrent; 331 case GCCause::_java_lang_system_gc: 332 case GCCause::_dcmd_gc_run: return ExplicitGCInvokesConcurrent; 333 default: return false; 334 } 335 } 336 337 void GenCollectedHeap::do_collection(bool full, 338 bool clear_all_soft_refs, 339 size_t size, 340 bool is_tlab, 341 int max_level) { 342 bool prepared_for_verification = false; 343 ResourceMark rm; 344 DEBUG_ONLY(Thread* my_thread = Thread::current();) 345 346 assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint"); 347 assert(my_thread->is_VM_thread() || 348 my_thread->is_ConcurrentGC_thread(), 349 "incorrect thread type capability"); 350 assert(Heap_lock->is_locked(), 351 "the requesting thread should have the Heap_lock"); 352 guarantee(!is_gc_active(), "collection is not reentrant"); 353 assert(max_level < n_gens(), "sanity check"); 354 |