src/share/vm/memory/defNewGeneration.cpp

Print this page




 545                                                 bool   is_tlab,
 546                                                 bool   parallel) {
 547   // We don't attempt to expand the young generation (but perhaps we should.)
 548   return allocate(size, is_tlab);
 549 }
 550 
 551 void DefNewGeneration::adjust_desired_tenuring_threshold() {
 552   // Set the desired survivor size to half the real survivor space
 553   _tenuring_threshold =
 554     age_table()->compute_tenuring_threshold(to()->capacity()/HeapWordSize);
 555 }
 556 
 557 void DefNewGeneration::collect(bool   full,
 558                                bool   clear_all_soft_refs,
 559                                size_t size,
 560                                bool   is_tlab) {
 561   assert(full || size > 0, "otherwise we don't want to collect");
 562 
 563   GenCollectedHeap* gch = GenCollectedHeap::heap();
 564 
 565   _gc_timer->register_gc_start(os::elapsed_counter());
 566   DefNewTracer gc_tracer;
 567   gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
 568 
 569   _next_gen = gch->next_gen(this);
 570 
 571   // If the next generation is too full to accommodate promotion
 572   // from this generation, pass on collection; let the next generation
 573   // do it.
 574   if (!collection_attempt_is_safe()) {
 575     if (Verbose && PrintGCDetails) {
 576       gclog_or_tty->print(" :: Collection attempt not safe :: ");
 577     }
 578     gch->set_incremental_collection_failed(); // Slight lie: we did not even attempt one
 579     return;
 580   }
 581   assert(to()->is_empty(), "Else not collection_attempt_is_safe");
 582 
 583   init_assuming_no_promotion_failure();
 584 
 585   GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL);


 692     _next_gen->promotion_failure_occurred();
 693     gc_tracer.report_promotion_failed(_promotion_failed_info);
 694 
 695     // Reset the PromotionFailureALot counters.
 696     NOT_PRODUCT(Universe::heap()->reset_promotion_should_fail();)
 697   }
 698   // set new iteration safe limit for the survivor spaces
 699   from()->set_concurrent_iteration_safe_limit(from()->top());
 700   to()->set_concurrent_iteration_safe_limit(to()->top());
 701   SpecializationStats::print();
 702 
 703   // We need to use a monotonically non-decreasing time in ms
 704   // or we will see time-warp warnings and os::javaTimeMillis()
 705   // does not guarantee monotonicity.
 706   jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
 707   update_time_of_last_gc(now);
 708 
 709   gch->trace_heap_after_gc(&gc_tracer);
 710   gc_tracer.report_tenuring_threshold(tenuring_threshold());
 711 
 712   _gc_timer->register_gc_end(os::elapsed_counter());
 713 
 714   gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
 715 }
 716 
 717 class RemoveForwardPointerClosure: public ObjectClosure {
 718 public:
 719   void do_object(oop obj) {
 720     obj->init_mark();
 721   }
 722 };
 723 
 724 void DefNewGeneration::init_assuming_no_promotion_failure() {
 725   _promotion_failed = false;
 726   _promotion_failed_info.reset();
 727   from()->set_next_compaction_space(NULL);
 728 }
 729 
 730 void DefNewGeneration::remove_forwarding_pointers() {
 731   RemoveForwardPointerClosure rspc;
 732   eden()->object_iterate(&rspc);




 545                                                 bool   is_tlab,
 546                                                 bool   parallel) {
 547   // We don't attempt to expand the young generation (but perhaps we should.)
 548   return allocate(size, is_tlab);
 549 }
 550 
 551 void DefNewGeneration::adjust_desired_tenuring_threshold() {
 552   // Set the desired survivor size to half the real survivor space
 553   _tenuring_threshold =
 554     age_table()->compute_tenuring_threshold(to()->capacity()/HeapWordSize);
 555 }
 556 
 557 void DefNewGeneration::collect(bool   full,
 558                                bool   clear_all_soft_refs,
 559                                size_t size,
 560                                bool   is_tlab) {
 561   assert(full || size > 0, "otherwise we don't want to collect");
 562 
 563   GenCollectedHeap* gch = GenCollectedHeap::heap();
 564 
 565   _gc_timer->register_gc_start();
 566   DefNewTracer gc_tracer;
 567   gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
 568 
 569   _next_gen = gch->next_gen(this);
 570 
 571   // If the next generation is too full to accommodate promotion
 572   // from this generation, pass on collection; let the next generation
 573   // do it.
 574   if (!collection_attempt_is_safe()) {
 575     if (Verbose && PrintGCDetails) {
 576       gclog_or_tty->print(" :: Collection attempt not safe :: ");
 577     }
 578     gch->set_incremental_collection_failed(); // Slight lie: we did not even attempt one
 579     return;
 580   }
 581   assert(to()->is_empty(), "Else not collection_attempt_is_safe");
 582 
 583   init_assuming_no_promotion_failure();
 584 
 585   GCTraceTime t1(GCCauseString("GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL);


 692     _next_gen->promotion_failure_occurred();
 693     gc_tracer.report_promotion_failed(_promotion_failed_info);
 694 
 695     // Reset the PromotionFailureALot counters.
 696     NOT_PRODUCT(Universe::heap()->reset_promotion_should_fail();)
 697   }
 698   // set new iteration safe limit for the survivor spaces
 699   from()->set_concurrent_iteration_safe_limit(from()->top());
 700   to()->set_concurrent_iteration_safe_limit(to()->top());
 701   SpecializationStats::print();
 702 
 703   // We need to use a monotonically non-decreasing time in ms
 704   // or we will see time-warp warnings and os::javaTimeMillis()
 705   // does not guarantee monotonicity.
 706   jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
 707   update_time_of_last_gc(now);
 708 
 709   gch->trace_heap_after_gc(&gc_tracer);
 710   gc_tracer.report_tenuring_threshold(tenuring_threshold());
 711 
 712   _gc_timer->register_gc_end();
 713 
 714   gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
 715 }
 716 
 717 class RemoveForwardPointerClosure: public ObjectClosure {
 718 public:
 719   void do_object(oop obj) {
 720     obj->init_mark();
 721   }
 722 };
 723 
 724 void DefNewGeneration::init_assuming_no_promotion_failure() {
 725   _promotion_failed = false;
 726   _promotion_failed_info.reset();
 727   from()->set_next_compaction_space(NULL);
 728 }
 729 
 730 void DefNewGeneration::remove_forwarding_pointers() {
 731   RemoveForwardPointerClosure rspc;
 732   eden()->object_iterate(&rspc);