369
370 HandleMark hm; // Discard invalid handles created during gc
371 save_marks(); // save marks for all gens
372 // We want to discover references, but not process them yet.
373 // This mode is disabled in process_discovered_references if the
374 // generation does some collection work, or in
375 // enqueue_discovered_references if the generation returns
376 // without doing any work.
377 ReferenceProcessor* rp = gen->ref_processor();
378 // If the discovery of ("weak") refs in this generation is
379 // atomic wrt other collectors in this configuration, we
380 // are guaranteed to have empty discovered ref lists.
381 if (rp->discovery_is_atomic()) {
382 rp->enable_discovery();
383 rp->setup_policy(clear_soft_refs);
384 } else {
385 // collect() below will enable discovery as appropriate
386 }
387 gen->collect(full, clear_soft_refs, size, is_tlab);
388 if (!rp->enqueuing_is_done()) {
389 rp->enqueue_discovered_references();
390 } else {
391 rp->set_enqueuing_is_done(false);
392 }
393 rp->verify_no_references_recorded();
394 }
395
396 COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
397
398 gen->stat_record()->accumulated_time.stop();
399
400 update_gc_stats(gen, full);
401
402 if (run_verification && VerifyAfterGC) {
403 HandleMark hm; // Discard invalid handles created during verification
404 Universe::verify("After GC");
405 }
406 }
407
408 void GenCollectedHeap::do_collection(bool full,
409 bool clear_all_soft_refs,
|
369
370 HandleMark hm; // Discard invalid handles created during gc
371 save_marks(); // save marks for all gens
372 // We want to discover references, but not process them yet.
373 // This mode is disabled in process_discovered_references if the
374 // generation does some collection work, or in
375 // enqueue_discovered_references if the generation returns
376 // without doing any work.
377 ReferenceProcessor* rp = gen->ref_processor();
378 // If the discovery of ("weak") refs in this generation is
379 // atomic wrt other collectors in this configuration, we
380 // are guaranteed to have empty discovered ref lists.
381 if (rp->discovery_is_atomic()) {
382 rp->enable_discovery();
383 rp->setup_policy(clear_soft_refs);
384 } else {
385 // collect() below will enable discovery as appropriate
386 }
387 gen->collect(full, clear_soft_refs, size, is_tlab);
388 if (!rp->enqueuing_is_done()) {
389 ReferenceProcessorPhaseTimes pt(NULL, rp->num_q());
390 rp->enqueue_discovered_references(NULL, &pt);
391 pt.print_enqueue_phase();
392 } else {
393 rp->set_enqueuing_is_done(false);
394 }
395 rp->verify_no_references_recorded();
396 }
397
398 COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
399
400 gen->stat_record()->accumulated_time.stop();
401
402 update_gc_stats(gen, full);
403
404 if (run_verification && VerifyAfterGC) {
405 HandleMark hm; // Discard invalid handles created during verification
406 Universe::verify("After GC");
407 }
408 }
409
410 void GenCollectedHeap::do_collection(bool full,
411 bool clear_all_soft_refs,
|