332 if (res != NULL) return res; 333 else if (first_only) break; 334 } 335 } 336 // Otherwise... 337 return NULL; 338 } 339 340 HeapWord* GenCollectedHeap::mem_allocate(size_t size, 341 bool* gc_overhead_limit_was_exceeded) { 342 return collector_policy()->mem_allocate_work(size, 343 false /* is_tlab */, 344 gc_overhead_limit_was_exceeded); 345 } 346 347 bool GenCollectedHeap::must_clear_all_soft_refs() { 348 return _gc_cause == GCCause::_last_ditch_collection; 349 } 350 351 bool GenCollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) { 352 return UseConcMarkSweepGC && 353 ((cause == GCCause::_gc_locker && GCLockerInvokesConcurrent) || 354 (cause == GCCause::_java_lang_system_gc && ExplicitGCInvokesConcurrent)); 355 } 356 357 void GenCollectedHeap::do_collection(bool full, 358 bool clear_all_soft_refs, 359 size_t size, 360 bool is_tlab, 361 int max_level) { 362 bool prepared_for_verification = false; 363 ResourceMark rm; 364 DEBUG_ONLY(Thread* my_thread = Thread::current();) 365 366 assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint"); 367 assert(my_thread->is_VM_thread() || 368 my_thread->is_ConcurrentGC_thread(), 369 "incorrect thread type capability"); 370 assert(Heap_lock->is_locked(), 371 "the requesting thread should have the Heap_lock"); 372 guarantee(!is_gc_active(), "collection is not reentrant"); 373 assert(max_level < n_gens(), "sanity check"); 374 | 332 if (res != NULL) return res; 333 else if (first_only) break; 334 } 335 } 336 // Otherwise... 337 return NULL; 338 } 339 340 HeapWord* GenCollectedHeap::mem_allocate(size_t size, 341 bool* gc_overhead_limit_was_exceeded) { 342 return collector_policy()->mem_allocate_work(size, 343 false /* is_tlab */, 344 gc_overhead_limit_was_exceeded); 345 } 346 347 bool GenCollectedHeap::must_clear_all_soft_refs() { 348 return _gc_cause == GCCause::_last_ditch_collection; 349 } 350 351 bool GenCollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) { 352 if (!UseConcMarkSweepGC) { 353 return false; 354 } 355 356 switch (cause) { 357 case GCCause::_gc_locker: return GCLockerInvokesConcurrent; 358 case GCCause::_java_lang_system_gc: 359 case GCCause::_dcmd_gc_run: return ExplicitGCInvokesConcurrent; 360 default: return false; 361 } 362 } 363 364 void GenCollectedHeap::do_collection(bool full, 365 bool clear_all_soft_refs, 366 size_t size, 367 bool is_tlab, 368 int max_level) { 369 bool prepared_for_verification = false; 370 ResourceMark rm; 371 DEBUG_ONLY(Thread* my_thread = Thread::current();) 372 373 assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint"); 374 assert(my_thread->is_VM_thread() || 375 my_thread->is_ConcurrentGC_thread(), 376 "incorrect thread type capability"); 377 assert(Heap_lock->is_locked(), 378 "the requesting thread should have the Heap_lock"); 379 guarantee(!is_gc_active(), "collection is not reentrant"); 380 assert(max_level < n_gens(), "sanity check"); 381 |