531 assert(full || size > 0, "otherwise we don't want to collect");
532 GenCollectedHeap* gch = GenCollectedHeap::heap();
533 _next_gen = gch->next_gen(this);
534 assert(_next_gen != NULL,
535 "This must be the youngest gen, and not the only gen");
536
537 // If the next generation is too full to accomodate promotion
538 // from this generation, pass on collection; let the next generation
539 // do it.
540 if (!collection_attempt_is_safe()) {
541 if (Verbose && PrintGCDetails) {
542 gclog_or_tty->print(" :: Collection attempt not safe :: ");
543 }
544 gch->set_incremental_collection_failed(); // Slight lie: we did not even attempt one
545 return;
546 }
547 assert(to()->is_empty(), "Else not collection_attempt_is_safe");
548
549 init_assuming_no_promotion_failure();
550
551 TraceTime t1("GC", PrintGC && !PrintGCDetails, true, gclog_or_tty);
552 // Capture heap used before collection (for printing).
553 size_t gch_prev_used = gch->used();
554
555 SpecializationStats::clear();
556
557 // These can be shared for all code paths
558 IsAliveClosure is_alive(this);
559 ScanWeakRefClosure scan_weak_ref(this);
560
561 age_table()->clear();
562 to()->clear(SpaceDecorator::Mangle);
563
564 gch->rem_set()->prepare_for_younger_refs_iterate(false);
565
566 assert(gch->no_allocs_since_save_marks(0),
567 "save marks have not been newly set.");
568
569 // Not very pretty.
570 CollectorPolicy* cp = gch->collector_policy();
571
|
531 assert(full || size > 0, "otherwise we don't want to collect");
532 GenCollectedHeap* gch = GenCollectedHeap::heap();
533 _next_gen = gch->next_gen(this);
534 assert(_next_gen != NULL,
535 "This must be the youngest gen, and not the only gen");
536
537 // If the next generation is too full to accomodate promotion
538 // from this generation, pass on collection; let the next generation
539 // do it.
540 if (!collection_attempt_is_safe()) {
541 if (Verbose && PrintGCDetails) {
542 gclog_or_tty->print(" :: Collection attempt not safe :: ");
543 }
544 gch->set_incremental_collection_failed(); // Slight lie: we did not even attempt one
545 return;
546 }
547 assert(to()->is_empty(), "Else not collection_attempt_is_safe");
548
549 init_assuming_no_promotion_failure();
550
551 TraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, gclog_or_tty);
552 // Capture heap used before collection (for printing).
553 size_t gch_prev_used = gch->used();
554
555 SpecializationStats::clear();
556
557 // These can be shared for all code paths
558 IsAliveClosure is_alive(this);
559 ScanWeakRefClosure scan_weak_ref(this);
560
561 age_table()->clear();
562 to()->clear(SpaceDecorator::Mangle);
563
564 gch->rem_set()->prepare_for_younger_refs_iterate(false);
565
566 assert(gch->no_allocs_since_save_marks(0),
567 "save marks have not been newly set.");
568
569 // Not very pretty.
570 CollectorPolicy* cp = gch->collector_policy();
571
|