< prev index next >

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Print this page




2763   size_t candidate_humongous() const { return _candidate_humongous; }
2764 
2765   void flush_rem_set_entries() { _dcq.flush(); }
2766 };
2767 
2768 void G1CollectedHeap::register_regions_with_region_attr() {
2769   Ticks start = Ticks::now();
2770 
2771   RegisterRegionsWithRegionAttrTableClosure cl;
2772   heap_region_iterate(&cl);
2773 
2774   phase_times()->record_register_regions((Ticks::now() - start).seconds() * 1000.0,
2775                                          cl.total_humongous(),
2776                                          cl.candidate_humongous());
2777   _has_humongous_reclaim_candidates = cl.candidate_humongous() > 0;
2778 
2779   // Finally flush all remembered set entries to re-check into the global DCQS.
2780   cl.flush_rem_set_entries();
2781 }
2782 
2783 #ifndef PRODUCT
2784 void G1CollectedHeap::verify_region_attr_remset_update() {
2785   class VerifyRegionAttrRemSet : public HeapRegionClosure {
2786   public:
2787     virtual bool do_heap_region(HeapRegion* r) {
2788       G1CollectedHeap* g1h = G1CollectedHeap::heap();
2789       bool const needs_remset_update = g1h->region_attr(r->bottom()).needs_remset_update();
2790       assert(r->rem_set()->is_tracked() == needs_remset_update,
2791              "Region %u remset tracking status (%s) different to region attribute (%s)",
2792              r->hrm_index(), BOOL_TO_STR(r->rem_set()->is_tracked()), BOOL_TO_STR(needs_remset_update));
2793       return false;
2794     }
2795   } cl;
2796   heap_region_iterate(&cl);
2797 }
2798 #endif
2799 
2800 class VerifyRegionRemSetClosure : public HeapRegionClosure {
2801   public:
2802     bool do_heap_region(HeapRegion* hr) {
2803       if (!hr->is_archive() && !hr->is_continues_humongous()) {
2804         hr->verify_rem_set();
2805       }
2806       return false;
2807     }
2808 };
2809 
2810 uint G1CollectedHeap::num_task_queues() const {
2811   return _task_queues->size();
2812 }
2813 
2814 #if TASKQUEUE_STATS
2815 void G1CollectedHeap::print_taskqueue_stats_hdr(outputStream* const st) {
2816   st->print_raw_cr("GC Task Stats");
2817   st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr();
2818   st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr();
2819 }


3059         // on again later if we do. Using a scoped
3060         // NoRefDiscovery object will do this.
3061         NoRefDiscovery no_cm_discovery(_ref_processor_cm);
3062 
3063         policy()->record_collection_pause_start(sample_start_time_sec);
3064 
3065         // Forget the current allocation region (we might even choose it to be part
3066         // of the collection set!).
3067         _allocator->release_mutator_alloc_region();
3068 
3069         calculate_collection_set(evacuation_info, target_pause_time_ms);
3070 
3071         G1ParScanThreadStateSet per_thread_states(this,
3072                                                   workers()->active_workers(),
3073                                                   collection_set()->young_region_length(),
3074                                                   collection_set()->optional_region_length());
3075         pre_evacuate_collection_set(evacuation_info);
3076 
3077         // Actually do the work...
3078         evacuate_initial_collection_set(&per_thread_states);
3079 
3080         if (_collection_set.optional_region_length() != 0) {
3081           evacuate_optional_collection_set(&per_thread_states);
3082         }
3083         post_evacuate_collection_set(evacuation_info, &per_thread_states);
3084 
3085         start_new_collection_set();
3086 
3087         _survivor_evac_stats.adjust_desired_plab_sz();
3088         _old_evac_stats.adjust_desired_plab_sz();
3089 
3090         if (should_start_conc_mark) {
3091           // We have to do this before we notify the CM threads that
3092           // they can start working to make sure that all the
3093           // appropriate initialization is done on the CM object.
3094           concurrent_mark()->post_initial_mark();
3095           // Note that we don't actually trigger the CM thread at
3096           // this point. We do that later when we're sure that
3097           // the current thread has completed its logging output.
3098         }
3099 


4641     register_region_with_region_attr(new_alloc_region);
4642     _hr_printer.alloc(new_alloc_region);
4643     return new_alloc_region;
4644   }
4645   return NULL;
4646 }
4647 
4648 void G1CollectedHeap::retire_gc_alloc_region(HeapRegion* alloc_region,
4649                                              size_t allocated_bytes,
4650                                              G1HeapRegionAttr dest) {
4651   policy()->record_bytes_copied_during_gc(allocated_bytes);
4652   if (dest.is_old()) {
4653     old_set_add(alloc_region);
4654   } else {
4655     assert(dest.is_young(), "Retiring alloc region should be young (%d)", dest.type());
4656     _survivor.add_used_bytes(allocated_bytes);
4657   }
4658 
4659   bool const during_im = collector_state()->in_initial_mark_gc();
4660   if (during_im && allocated_bytes > 0) {
4661     _cm->root_regions()->add(alloc_region->next_top_at_mark_start(), alloc_region->top());
4662   }
4663   _hr_printer.retire(alloc_region);
4664 }
4665 
4666 HeapRegion* G1CollectedHeap::alloc_highest_free_region() {
4667   bool expanded = false;
4668   uint index = _hrm->find_highest_free(&expanded);
4669 
4670   if (index != G1_NO_HRM_INDEX) {
4671     if (expanded) {
4672       log_debug(gc, ergo, heap)("Attempt heap expansion (requested address range outside heap bounds). region size: " SIZE_FORMAT "B",
4673                                 HeapRegion::GrainWords * HeapWordSize);
4674     }
4675     _hrm->allocate_free_regions_starting_at(index, 1);
4676     return region_at(index);
4677   }
4678   return NULL;
4679 }
4680 
4681 // Optimized nmethod scanning




2763   size_t candidate_humongous() const { return _candidate_humongous; }
2764 
2765   void flush_rem_set_entries() { _dcq.flush(); }
2766 };
2767 
2768 void G1CollectedHeap::register_regions_with_region_attr() {
2769   Ticks start = Ticks::now();
2770 
2771   RegisterRegionsWithRegionAttrTableClosure cl;
2772   heap_region_iterate(&cl);
2773 
2774   phase_times()->record_register_regions((Ticks::now() - start).seconds() * 1000.0,
2775                                          cl.total_humongous(),
2776                                          cl.candidate_humongous());
2777   _has_humongous_reclaim_candidates = cl.candidate_humongous() > 0;
2778 
2779   // Finally flush all remembered set entries to re-check into the global DCQS.
2780   cl.flush_rem_set_entries();
2781 }
2782 

















2783 class VerifyRegionRemSetClosure : public HeapRegionClosure {
2784   public:
2785     bool do_heap_region(HeapRegion* hr) {
2786       if (!hr->is_archive() && !hr->is_continues_humongous()) {
2787         hr->verify_rem_set();
2788       }
2789       return false;
2790     }
2791 };
2792 
2793 uint G1CollectedHeap::num_task_queues() const {
2794   return _task_queues->size();
2795 }
2796 
2797 #if TASKQUEUE_STATS
2798 void G1CollectedHeap::print_taskqueue_stats_hdr(outputStream* const st) {
2799   st->print_raw_cr("GC Task Stats");
2800   st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr();
2801   st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr();
2802 }


3042         // on again later if we do. Using a scoped
3043         // NoRefDiscovery object will do this.
3044         NoRefDiscovery no_cm_discovery(_ref_processor_cm);
3045 
3046         policy()->record_collection_pause_start(sample_start_time_sec);
3047 
3048         // Forget the current allocation region (we might even choose it to be part
3049         // of the collection set!).
3050         _allocator->release_mutator_alloc_region();
3051 
3052         calculate_collection_set(evacuation_info, target_pause_time_ms);
3053 
3054         G1ParScanThreadStateSet per_thread_states(this,
3055                                                   workers()->active_workers(),
3056                                                   collection_set()->young_region_length(),
3057                                                   collection_set()->optional_region_length());
3058         pre_evacuate_collection_set(evacuation_info);
3059 
3060         // Actually do the work...
3061         evacuate_initial_collection_set(&per_thread_states);

3062         if (_collection_set.optional_region_length() != 0) {
3063           evacuate_optional_collection_set(&per_thread_states);
3064         }
3065         post_evacuate_collection_set(evacuation_info, &per_thread_states);
3066 
3067         start_new_collection_set();
3068 
3069         _survivor_evac_stats.adjust_desired_plab_sz();
3070         _old_evac_stats.adjust_desired_plab_sz();
3071 
3072         if (should_start_conc_mark) {
3073           // We have to do this before we notify the CM threads that
3074           // they can start working to make sure that all the
3075           // appropriate initialization is done on the CM object.
3076           concurrent_mark()->post_initial_mark();
3077           // Note that we don't actually trigger the CM thread at
3078           // this point. We do that later when we're sure that
3079           // the current thread has completed its logging output.
3080         }
3081 


4623     register_region_with_region_attr(new_alloc_region);
4624     _hr_printer.alloc(new_alloc_region);
4625     return new_alloc_region;
4626   }
4627   return NULL;
4628 }
4629 
4630 void G1CollectedHeap::retire_gc_alloc_region(HeapRegion* alloc_region,
4631                                              size_t allocated_bytes,
4632                                              G1HeapRegionAttr dest) {
4633   policy()->record_bytes_copied_during_gc(allocated_bytes);
4634   if (dest.is_old()) {
4635     old_set_add(alloc_region);
4636   } else {
4637     assert(dest.is_young(), "Retiring alloc region should be young (%d)", dest.type());
4638     _survivor.add_used_bytes(allocated_bytes);
4639   }
4640 
4641   bool const during_im = collector_state()->in_initial_mark_gc();
4642   if (during_im && allocated_bytes > 0) {
4643     _cm->root_regions()->add(alloc_region);
4644   }
4645   _hr_printer.retire(alloc_region);
4646 }
4647 
4648 HeapRegion* G1CollectedHeap::alloc_highest_free_region() {
4649   bool expanded = false;
4650   uint index = _hrm->find_highest_free(&expanded);
4651 
4652   if (index != G1_NO_HRM_INDEX) {
4653     if (expanded) {
4654       log_debug(gc, ergo, heap)("Attempt heap expansion (requested address range outside heap bounds). region size: " SIZE_FORMAT "B",
4655                                 HeapRegion::GrainWords * HeapWordSize);
4656     }
4657     _hrm->allocate_free_regions_starting_at(index, 1);
4658     return region_at(index);
4659   }
4660   return NULL;
4661 }
4662 
4663 // Optimized nmethod scanning


< prev index next >