392 Universe::verify("After GC");
393 }
394 }
395
396 void GenCollectedHeap::do_collection(bool full,
397 bool clear_all_soft_refs,
398 size_t size,
399 bool is_tlab,
400 GenerationType max_generation) {
401 ResourceMark rm;
402 DEBUG_ONLY(Thread* my_thread = Thread::current();)
403
404 assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
405 assert(my_thread->is_VM_thread() ||
406 my_thread->is_ConcurrentGC_thread(),
407 "incorrect thread type capability");
408 assert(Heap_lock->is_locked(),
409 "the requesting thread should have the Heap_lock");
410 guarantee(!is_gc_active(), "collection is not reentrant");
411
412 if (GC_locker::check_active_before_gc()) {
413 return; // GC is disabled (e.g. JNI GetXXXCritical operation)
414 }
415
416 GCIdMarkAndRestore gc_id_mark;
417
418 const bool do_clear_all_soft_refs = clear_all_soft_refs ||
419 collector_policy()->should_clear_all_soft_refs();
420
421 ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
422
423 const size_t metadata_prev_used = MetaspaceAux::used_bytes();
424
425 print_heap_before_gc();
426
427 {
428 FlagSetting fl(_is_gc_active, true);
429
430 bool complete = full && (max_generation == OldGen);
431 bool old_collects_young = complete && !ScavengeBeforeFullGC;
432 bool do_young_collection = !old_collects_young && _young_gen->should_collect(full, size, is_tlab);
|
392 Universe::verify("After GC");
393 }
394 }
395
396 void GenCollectedHeap::do_collection(bool full,
397 bool clear_all_soft_refs,
398 size_t size,
399 bool is_tlab,
400 GenerationType max_generation) {
401 ResourceMark rm;
402 DEBUG_ONLY(Thread* my_thread = Thread::current();)
403
404 assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
405 assert(my_thread->is_VM_thread() ||
406 my_thread->is_ConcurrentGC_thread(),
407 "incorrect thread type capability");
408 assert(Heap_lock->is_locked(),
409 "the requesting thread should have the Heap_lock");
410 guarantee(!is_gc_active(), "collection is not reentrant");
411
412 if (GCLocker::check_active_before_gc()) {
413 return; // GC is disabled (e.g. JNI GetXXXCritical operation)
414 }
415
416 GCIdMarkAndRestore gc_id_mark;
417
418 const bool do_clear_all_soft_refs = clear_all_soft_refs ||
419 collector_policy()->should_clear_all_soft_refs();
420
421 ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
422
423 const size_t metadata_prev_used = MetaspaceAux::used_bytes();
424
425 print_heap_before_gc();
426
427 {
428 FlagSetting fl(_is_gc_active, true);
429
430 bool complete = full && (max_generation == OldGen);
431 bool old_collects_young = complete && !ScavengeBeforeFullGC;
432 bool do_young_collection = !old_collects_young && _young_gen->should_collect(full, size, is_tlab);
|