498
499 HandleMark hm; // Discard invalid handles created during gc
500 save_marks(); // save marks for all gens
501 // We want to discover references, but not process them yet.
502 // This mode is disabled in process_discovered_references if the
503 // generation does some collection work, or in
504 // enqueue_discovered_references if the generation returns
505 // without doing any work.
506 ReferenceProcessor* rp = gen->ref_processor();
507 // If the discovery of ("weak") refs in this generation is
508 // atomic wrt other collectors in this configuration, we
509 // are guaranteed to have empty discovered ref lists.
510 if (rp->discovery_is_atomic()) {
511 rp->enable_discovery();
512 rp->setup_policy(clear_soft_refs);
513 } else {
514 // collect() below will enable discovery as appropriate
515 }
516 gen->collect(full, clear_soft_refs, size, is_tlab);
517 if (!rp->enqueuing_is_done()) {
518 ReferenceProcessorPhaseTimes pt(NULL, rp->num_queues());
519 rp->enqueue_discovered_references(NULL, &pt);
520 pt.print_enqueue_phase();
521 } else {
522 rp->set_enqueuing_is_done(false);
523 }
524 rp->verify_no_references_recorded();
525 }
526
527 COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
528
529 gen->stat_record()->accumulated_time.stop();
530
531 update_gc_stats(gen, full);
532
533 if (run_verification && VerifyAfterGC) {
534 HandleMark hm; // Discard invalid handles created during verification
535 Universe::verify("After GC");
536 }
537 }
538
539 void GenCollectedHeap::do_collection(bool full,
540 bool clear_all_soft_refs,
|
498
499 HandleMark hm; // Discard invalid handles created during gc
500 save_marks(); // save marks for all gens
501 // We want to discover references, but not process them yet.
502 // This mode is disabled in process_discovered_references if the
503 // generation does some collection work, or in
504 // enqueue_discovered_references if the generation returns
505 // without doing any work.
506 ReferenceProcessor* rp = gen->ref_processor();
507 // If the discovery of ("weak") refs in this generation is
508 // atomic wrt other collectors in this configuration, we
509 // are guaranteed to have empty discovered ref lists.
510 if (rp->discovery_is_atomic()) {
511 rp->enable_discovery();
512 rp->setup_policy(clear_soft_refs);
513 } else {
514 // collect() below will enable discovery as appropriate
515 }
516 gen->collect(full, clear_soft_refs, size, is_tlab);
517 if (!rp->enqueuing_is_done()) {
518 rp->disable_discovery();
519 } else {
520 rp->set_enqueuing_is_done(false);
521 }
522 rp->verify_no_references_recorded();
523 }
524
525 COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
526
527 gen->stat_record()->accumulated_time.stop();
528
529 update_gc_stats(gen, full);
530
531 if (run_verification && VerifyAfterGC) {
532 HandleMark hm; // Discard invalid handles created during verification
533 Universe::verify("After GC");
534 }
535 }
536
537 void GenCollectedHeap::do_collection(bool full,
538 bool clear_all_soft_refs,
|