Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 1707:0ce1569c90e5
6963209: G1: remove the concept of abandoned pauses
Summary: As part of 6944166 we disabled the concept of abandoned pauses (i.e., if the collection set is empty, we would still try to do a pause even if it is to update the RSets and scan the roots). This changeset removes the code and structures associated with abandoned pauses.
Reviewed-by: iveresov, johnc
author | tonyp |
---|---|
date | Wed, 04 Aug 2010 13:03:23 -0400 |
parents | 2d160770d2e5 |
children | 5f429ee79634 |
comparison
equal
deleted
inserted
replaced
1706:9d7a8ab3736b | 1707:0ce1569c90e5 |
---|---|
2841 gclog_or_tty->print_cr("\nBefore choosing collection set.\nYoung_list:"); | 2841 gclog_or_tty->print_cr("\nBefore choosing collection set.\nYoung_list:"); |
2842 _young_list->print(); | 2842 _young_list->print(); |
2843 g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty); | 2843 g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty); |
2844 #endif // YOUNG_LIST_VERBOSE | 2844 #endif // YOUNG_LIST_VERBOSE |
2845 | 2845 |
2846 // Now choose the CS. We may abandon a pause if we find no | 2846 g1_policy()->choose_collection_set(target_pause_time_ms); |
2847 // region that will fit in the MMU pause. | |
2848 bool abandoned = g1_policy()->choose_collection_set(target_pause_time_ms); | |
2849 | 2847 |
2850 // Nothing to do if we were unable to choose a collection set. | 2848 // Nothing to do if we were unable to choose a collection set. |
2851 if (!abandoned) { | |
2852 #if G1_REM_SET_LOGGING | 2849 #if G1_REM_SET_LOGGING |
2853 gclog_or_tty->print_cr("\nAfter pause, heap:"); | 2850 gclog_or_tty->print_cr("\nAfter pause, heap:"); |
2854 print(); | 2851 print(); |
2855 #endif | 2852 #endif |
2856 PrepareForRSScanningClosure prepare_for_rs_scan; | 2853 PrepareForRSScanningClosure prepare_for_rs_scan; |
2857 collection_set_iterate(&prepare_for_rs_scan); | 2854 collection_set_iterate(&prepare_for_rs_scan); |
2858 | 2855 |
2859 setup_surviving_young_words(); | 2856 setup_surviving_young_words(); |
2860 | 2857 |
2861 // Set up the gc allocation regions. | 2858 // Set up the gc allocation regions. |
2862 get_gc_alloc_regions(); | 2859 get_gc_alloc_regions(); |
2863 | 2860 |
2864 // Actually do the work... | 2861 // Actually do the work... |
2865 evacuate_collection_set(); | 2862 evacuate_collection_set(); |
2866 | 2863 |
2867 free_collection_set(g1_policy()->collection_set()); | 2864 free_collection_set(g1_policy()->collection_set()); |
2868 g1_policy()->clear_collection_set(); | 2865 g1_policy()->clear_collection_set(); |
2869 | 2866 |
2870 cleanup_surviving_young_words(); | 2867 cleanup_surviving_young_words(); |
2871 | 2868 |
2872 // Start a new incremental collection set for the next pause. | 2869 // Start a new incremental collection set for the next pause. |
2873 g1_policy()->start_incremental_cset_building(); | 2870 g1_policy()->start_incremental_cset_building(); |
2874 | 2871 |
2875 // Clear the _cset_fast_test bitmap in anticipation of adding | 2872 // Clear the _cset_fast_test bitmap in anticipation of adding |
2876 // regions to the incremental collection set for the next | 2873 // regions to the incremental collection set for the next |
2877 // evacuation pause. | 2874 // evacuation pause. |
2878 clear_cset_fast_test(); | 2875 clear_cset_fast_test(); |
2879 | 2876 |
2880 if (g1_policy()->in_young_gc_mode()) { | 2877 if (g1_policy()->in_young_gc_mode()) { |
2881 _young_list->reset_sampled_info(); | 2878 _young_list->reset_sampled_info(); |
2882 | 2879 |
2883 // Don't check the whole heap at this point as the | 2880 // Don't check the whole heap at this point as the |
2884 // GC alloc regions from this pause have been tagged | 2881 // GC alloc regions from this pause have been tagged |
2885 // as survivors and moved on to the survivor list. | 2882 // as survivors and moved on to the survivor list. |
2886 // Survivor regions will fail the !is_young() check. | 2883 // Survivor regions will fail the !is_young() check. |
2887 assert(check_young_list_empty(false /* check_heap */), | 2884 assert(check_young_list_empty(false /* check_heap */), |
2888 "young list should be empty"); | 2885 "young list should be empty"); |
2889 | 2886 |
2890 #if YOUNG_LIST_VERBOSE | 2887 #if YOUNG_LIST_VERBOSE |
2891 gclog_or_tty->print_cr("Before recording survivors.\nYoung List:"); | 2888 gclog_or_tty->print_cr("Before recording survivors.\nYoung List:"); |
2892 _young_list->print(); | 2889 _young_list->print(); |
2893 #endif // YOUNG_LIST_VERBOSE | 2890 #endif // YOUNG_LIST_VERBOSE |
2894 | 2891 |
2895 g1_policy()->record_survivor_regions(_young_list->survivor_length(), | 2892 g1_policy()->record_survivor_regions(_young_list->survivor_length(), |
2896 _young_list->first_survivor_region(), | 2893 _young_list->first_survivor_region(), |
2897 _young_list->last_survivor_region()); | 2894 _young_list->last_survivor_region()); |
2898 | 2895 |
2899 _young_list->reset_auxilary_lists(); | 2896 _young_list->reset_auxilary_lists(); |
2900 } | |
2901 } else { | |
2902 // We have abandoned the current collection. This can only happen | |
2903 // if we're not doing young or partially young collections, and | |
2904 // we didn't find an old region that we're able to collect within | |
2905 // the allowed time. | |
2906 | |
2907 assert(g1_policy()->collection_set() == NULL, "should be"); | |
2908 assert(_young_list->length() == 0, "because it should be"); | |
2909 | |
2910 // This should be a no-op. | |
2911 abandon_collection_set(g1_policy()->inc_cset_head()); | |
2912 | |
2913 g1_policy()->clear_incremental_cset(); | |
2914 g1_policy()->stop_incremental_cset_building(); | |
2915 | |
2916 // Start a new incremental collection set for the next pause. | |
2917 g1_policy()->start_incremental_cset_building(); | |
2918 | |
2919 // Clear the _cset_fast_test bitmap in anticipation of adding | |
2920 // regions to the incremental collection set for the next | |
2921 // evacuation pause. | |
2922 clear_cset_fast_test(); | |
2923 | |
2924 // This looks confusing, because the DPT should really be empty | |
2925 // at this point -- since we have not done any collection work, | |
2926 // there should not be any derived pointers in the table to update; | |
2927 // however, there is some additional state in the DPT which is | |
2928 // reset at the end of the (null) "gc" here via the following call. | |
2929 // A better approach might be to split off that state resetting work | |
2930 // into a separate method that asserts that the DPT is empty and call | |
2931 // that here. That is deferred for now. | |
2932 COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); | |
2933 } | 2897 } |
2934 | 2898 |
2935 if (evacuation_failed()) { | 2899 if (evacuation_failed()) { |
2936 _summary_bytes_used = recalculate_used(); | 2900 _summary_bytes_used = recalculate_used(); |
2937 } else { | 2901 } else { |
2961 #endif // YOUNG_LIST_VERBOSE | 2925 #endif // YOUNG_LIST_VERBOSE |
2962 | 2926 |
2963 double end_time_sec = os::elapsedTime(); | 2927 double end_time_sec = os::elapsedTime(); |
2964 double pause_time_ms = (end_time_sec - start_time_sec) * MILLIUNITS; | 2928 double pause_time_ms = (end_time_sec - start_time_sec) * MILLIUNITS; |
2965 g1_policy()->record_pause_time_ms(pause_time_ms); | 2929 g1_policy()->record_pause_time_ms(pause_time_ms); |
2966 g1_policy()->record_collection_pause_end(abandoned); | 2930 g1_policy()->record_collection_pause_end(); |
2967 | 2931 |
2968 assert(regions_accounted_for(), "Region leakage."); | 2932 assert(regions_accounted_for(), "Region leakage."); |
2969 | 2933 |
2970 MemoryService::track_memory_usage(); | 2934 MemoryService::track_memory_usage(); |
2971 | 2935 |