Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @ 3867:ff53346271fe
6814390: G1: remove the concept of non-generational G1
Summary: Removed the possibility to turn off generational mode for G1.
Reviewed-by: johnc, ysr, tonyp
author | brutisso |
---|---|
date | Fri, 19 Aug 2011 09:30:59 +0200 |
parents | f44782f04dd4 |
children | ae73da50be4b |
comparison
equal
deleted
inserted
replaced
3866:7c29742c41b4 | 3867:ff53346271fe |
---|---|
168 _all_aux_times_ms(new NumberSeq[_aux_num]), | 168 _all_aux_times_ms(new NumberSeq[_aux_num]), |
169 _cur_aux_start_times_ms(new double[_aux_num]), | 169 _cur_aux_start_times_ms(new double[_aux_num]), |
170 _cur_aux_times_ms(new double[_aux_num]), | 170 _cur_aux_times_ms(new double[_aux_num]), |
171 _cur_aux_times_set(new bool[_aux_num]), | 171 _cur_aux_times_set(new bool[_aux_num]), |
172 | 172 |
173 _concurrent_mark_init_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), | |
174 _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), | 173 _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), |
175 _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), | 174 _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)), |
176 | 175 |
177 // <NEW PREDICTION> | 176 // <NEW PREDICTION> |
178 | 177 |
199 | 198 |
200 _pause_time_target_ms((double) MaxGCPauseMillis), | 199 _pause_time_target_ms((double) MaxGCPauseMillis), |
201 | 200 |
202 // </NEW PREDICTION> | 201 // </NEW PREDICTION> |
203 | 202 |
204 _in_young_gc_mode(false), | |
205 _full_young_gcs(true), | 203 _full_young_gcs(true), |
206 _full_young_pause_num(0), | 204 _full_young_pause_num(0), |
207 _partial_young_pause_num(0), | 205 _partial_young_pause_num(0), |
208 | 206 |
209 _during_marking(false), | 207 _during_marking(false), |
398 double time_slice = (double) GCPauseIntervalMillis / 1000.0; | 396 double time_slice = (double) GCPauseIntervalMillis / 1000.0; |
399 _mmu_tracker = new G1MMUTrackerQueue(time_slice, max_gc_time); | 397 _mmu_tracker = new G1MMUTrackerQueue(time_slice, max_gc_time); |
400 _sigma = (double) G1ConfidencePercent / 100.0; | 398 _sigma = (double) G1ConfidencePercent / 100.0; |
401 | 399 |
402 // start conservatively (around 50ms is about right) | 400 // start conservatively (around 50ms is about right) |
403 _concurrent_mark_init_times_ms->add(0.05); | |
404 _concurrent_mark_remark_times_ms->add(0.05); | 401 _concurrent_mark_remark_times_ms->add(0.05); |
405 _concurrent_mark_cleanup_times_ms->add(0.20); | 402 _concurrent_mark_cleanup_times_ms->add(0.20); |
406 _tenuring_threshold = MaxTenuringThreshold; | 403 _tenuring_threshold = MaxTenuringThreshold; |
407 | 404 |
408 // if G1FixedSurvivorSpaceSize is 0 which means the size is not | 405 // if G1FixedSurvivorSpaceSize is 0 which means the size is not |
466 | 463 |
467 assert(Heap_lock->owned_by_self(), "Locking discipline."); | 464 assert(Heap_lock->owned_by_self(), "Locking discipline."); |
468 | 465 |
469 initialize_gc_policy_counters(); | 466 initialize_gc_policy_counters(); |
470 | 467 |
471 if (G1Gen) { | 468 G1YoungGenSizer sizer; |
472 _in_young_gc_mode = true; | 469 size_t initial_region_num = sizer.initial_young_region_num(); |
473 | 470 |
474 G1YoungGenSizer sizer; | 471 if (UseAdaptiveSizePolicy) { |
475 size_t initial_region_num = sizer.initial_young_region_num(); | 472 set_adaptive_young_list_length(true); |
476 | 473 _young_list_fixed_length = 0; |
477 if (UseAdaptiveSizePolicy) { | |
478 set_adaptive_young_list_length(true); | |
479 _young_list_fixed_length = 0; | |
480 } else { | |
481 set_adaptive_young_list_length(false); | |
482 _young_list_fixed_length = initial_region_num; | |
483 } | |
484 _free_regions_at_end_of_collection = _g1->free_regions(); | |
485 calculate_young_list_min_length(); | |
486 guarantee( _young_list_min_length == 0, "invariant, not enough info" ); | |
487 calculate_young_list_target_length(); | |
488 } else { | 474 } else { |
489 _young_list_fixed_length = 0; | 475 set_adaptive_young_list_length(false); |
490 _in_young_gc_mode = false; | 476 _young_list_fixed_length = initial_region_num; |
491 } | 477 } |
478 _free_regions_at_end_of_collection = _g1->free_regions(); | |
479 calculate_young_list_min_length(); | |
480 guarantee( _young_list_min_length == 0, "invariant, not enough info" ); | |
481 calculate_young_list_target_length(); | |
492 | 482 |
493 // We may immediately start allocating regions and placing them on the | 483 // We may immediately start allocating regions and placing them on the |
494 // collection set list. Initialize the per-collection set info | 484 // collection set list. Initialize the per-collection set info |
495 start_incremental_cset_building(); | 485 start_incremental_cset_building(); |
496 } | 486 } |
497 | 487 |
498 // Create the jstat counters for the policy. | 488 // Create the jstat counters for the policy. |
499 void G1CollectorPolicy::initialize_gc_policy_counters() | 489 void G1CollectorPolicy::initialize_gc_policy_counters() |
500 { | 490 { |
501 _gc_policy_counters = new GCPolicyCounters("GarbageFirst", 1, 2 + G1Gen); | 491 _gc_policy_counters = new GCPolicyCounters("GarbageFirst", 1, 3); |
502 } | 492 } |
503 | 493 |
504 void G1CollectorPolicy::calculate_young_list_min_length() { | 494 void G1CollectorPolicy::calculate_young_list_min_length() { |
505 _young_list_min_length = 0; | 495 _young_list_min_length = 0; |
506 | 496 |
866 void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, | 856 void G1CollectorPolicy::record_collection_pause_start(double start_time_sec, |
867 size_t start_used) { | 857 size_t start_used) { |
868 if (PrintGCDetails) { | 858 if (PrintGCDetails) { |
869 gclog_or_tty->stamp(PrintGCTimeStamps); | 859 gclog_or_tty->stamp(PrintGCTimeStamps); |
870 gclog_or_tty->print("[GC pause"); | 860 gclog_or_tty->print("[GC pause"); |
871 if (in_young_gc_mode()) | 861 gclog_or_tty->print(" (%s)", full_young_gcs() ? "young" : "partial"); |
872 gclog_or_tty->print(" (%s)", full_young_gcs() ? "young" : "partial"); | |
873 } | 862 } |
874 | 863 |
875 assert(_g1->used() == _g1->recalculate_used(), | 864 assert(_g1->used() == _g1->recalculate_used(), |
876 err_msg("sanity, used: "SIZE_FORMAT" recalculate_used: "SIZE_FORMAT, | 865 err_msg("sanity, used: "SIZE_FORMAT" recalculate_used: "SIZE_FORMAT, |
877 _g1->used(), _g1->recalculate_used())); | 866 _g1->used(), _g1->recalculate_used())); |
919 } | 908 } |
920 | 909 |
921 _satb_drain_time_set = false; | 910 _satb_drain_time_set = false; |
922 _last_satb_drain_processed_buffers = -1; | 911 _last_satb_drain_processed_buffers = -1; |
923 | 912 |
924 if (in_young_gc_mode()) | 913 _last_young_gc_full = false; |
925 _last_young_gc_full = false; | |
926 | 914 |
927 // do that for any other surv rate groups | 915 // do that for any other surv rate groups |
928 _short_lived_surv_rate_group->stop_adding_regions(); | 916 _short_lived_surv_rate_group->stop_adding_regions(); |
929 _survivors_age_table.clear(); | 917 _survivors_age_table.clear(); |
930 | 918 |
933 | 921 |
934 void G1CollectorPolicy::record_mark_closure_time(double mark_closure_time_ms) { | 922 void G1CollectorPolicy::record_mark_closure_time(double mark_closure_time_ms) { |
935 _mark_closure_time_ms = mark_closure_time_ms; | 923 _mark_closure_time_ms = mark_closure_time_ms; |
936 } | 924 } |
937 | 925 |
938 void G1CollectorPolicy::record_concurrent_mark_init_start() { | 926 void G1CollectorPolicy::record_concurrent_mark_init_end(double |
939 _mark_init_start_sec = os::elapsedTime(); | |
940 guarantee(!in_young_gc_mode(), "should not do be here in young GC mode"); | |
941 } | |
942 | |
943 void G1CollectorPolicy::record_concurrent_mark_init_end_pre(double | |
944 mark_init_elapsed_time_ms) { | 927 mark_init_elapsed_time_ms) { |
945 _during_marking = true; | 928 _during_marking = true; |
946 assert(!initiate_conc_mark_if_possible(), "we should have cleared it by now"); | 929 assert(!initiate_conc_mark_if_possible(), "we should have cleared it by now"); |
947 clear_during_initial_mark_pause(); | 930 clear_during_initial_mark_pause(); |
948 _cur_mark_stop_world_time_ms = mark_init_elapsed_time_ms; | 931 _cur_mark_stop_world_time_ms = mark_init_elapsed_time_ms; |
949 } | |
950 | |
951 void G1CollectorPolicy::record_concurrent_mark_init_end() { | |
952 double end_time_sec = os::elapsedTime(); | |
953 double elapsed_time_ms = (end_time_sec - _mark_init_start_sec) * 1000.0; | |
954 _concurrent_mark_init_times_ms->add(elapsed_time_ms); | |
955 record_concurrent_mark_init_end_pre(elapsed_time_ms); | |
956 | |
957 _mmu_tracker->add_pause(_mark_init_start_sec, end_time_sec, true); | |
958 } | 932 } |
959 | 933 |
960 void G1CollectorPolicy::record_concurrent_mark_remark_start() { | 934 void G1CollectorPolicy::record_concurrent_mark_remark_start() { |
961 _mark_remark_start_sec = os::elapsedTime(); | 935 _mark_remark_start_sec = os::elapsedTime(); |
962 _during_marking = false; | 936 _during_marking = false; |
1017 _n_marks_since_last_pause++; | 991 _n_marks_since_last_pause++; |
1018 } | 992 } |
1019 | 993 |
1020 void | 994 void |
1021 G1CollectorPolicy::record_concurrent_mark_cleanup_completed() { | 995 G1CollectorPolicy::record_concurrent_mark_cleanup_completed() { |
1022 if (in_young_gc_mode()) { | 996 _should_revert_to_full_young_gcs = false; |
1023 _should_revert_to_full_young_gcs = false; | 997 _last_full_young_gc = true; |
1024 _last_full_young_gc = true; | 998 _in_marking_window = false; |
1025 _in_marking_window = false; | 999 if (adaptive_young_list_length()) |
1026 if (adaptive_young_list_length()) | 1000 calculate_young_list_target_length(); |
1027 calculate_young_list_target_length(); | |
1028 } | |
1029 } | 1001 } |
1030 | 1002 |
1031 void G1CollectorPolicy::record_concurrent_pause() { | 1003 void G1CollectorPolicy::record_concurrent_pause() { |
1032 if (_stop_world_start > 0.0) { | 1004 if (_stop_world_start > 0.0) { |
1033 double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0; | 1005 double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0; |
1172 _short_lived_surv_rate_group->print(); | 1144 _short_lived_surv_rate_group->print(); |
1173 // do that for any other surv rate groups too | 1145 // do that for any other surv rate groups too |
1174 } | 1146 } |
1175 #endif // PRODUCT | 1147 #endif // PRODUCT |
1176 | 1148 |
1177 if (in_young_gc_mode()) { | 1149 last_pause_included_initial_mark = during_initial_mark_pause(); |
1178 last_pause_included_initial_mark = during_initial_mark_pause(); | 1150 if (last_pause_included_initial_mark) |
1179 if (last_pause_included_initial_mark) | 1151 record_concurrent_mark_init_end(0.0); |
1180 record_concurrent_mark_init_end_pre(0.0); | 1152 |
1181 | 1153 size_t min_used_targ = |
1182 size_t min_used_targ = | 1154 (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent; |
1183 (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent; | 1155 |
1184 | 1156 |
1185 | 1157 if (!_g1->mark_in_progress() && !_last_full_young_gc) { |
1186 if (!_g1->mark_in_progress() && !_last_full_young_gc) { | 1158 assert(!last_pause_included_initial_mark, "invariant"); |
1187 assert(!last_pause_included_initial_mark, "invariant"); | 1159 if (cur_used_bytes > min_used_targ && |
1188 if (cur_used_bytes > min_used_targ && | 1160 cur_used_bytes > _prev_collection_pause_used_at_end_bytes) { |
1189 cur_used_bytes > _prev_collection_pause_used_at_end_bytes) { | |
1190 assert(!during_initial_mark_pause(), "we should not see this here"); | 1161 assert(!during_initial_mark_pause(), "we should not see this here"); |
1191 | 1162 |
1192 // Note: this might have already been set, if during the last | 1163 // Note: this might have already been set, if during the last |
1193 // pause we decided to start a cycle but at the beginning of | 1164 // pause we decided to start a cycle but at the beginning of |
1194 // this pause we decided to postpone it. That's OK. | 1165 // this pause we decided to postpone it. That's OK. |
1195 set_initiate_conc_mark_if_possible(); | 1166 set_initiate_conc_mark_if_possible(); |
1196 } | 1167 } |
1197 } | 1168 } |
1198 | 1169 |
1199 _prev_collection_pause_used_at_end_bytes = cur_used_bytes; | 1170 _prev_collection_pause_used_at_end_bytes = cur_used_bytes; |
1200 } | |
1201 | 1171 |
1202 _mmu_tracker->add_pause(end_time_sec - elapsed_ms/1000.0, | 1172 _mmu_tracker->add_pause(end_time_sec - elapsed_ms/1000.0, |
1203 end_time_sec, false); | 1173 end_time_sec, false); |
1204 | 1174 |
1205 guarantee(_cur_collection_pause_used_regions_at_start >= | 1175 guarantee(_cur_collection_pause_used_regions_at_start >= |
1466 if (during_initial_mark_pause()) { | 1436 if (during_initial_mark_pause()) { |
1467 new_in_marking_window = true; | 1437 new_in_marking_window = true; |
1468 new_in_marking_window_im = true; | 1438 new_in_marking_window_im = true; |
1469 } | 1439 } |
1470 | 1440 |
1471 if (in_young_gc_mode()) { | 1441 if (_last_full_young_gc) { |
1472 if (_last_full_young_gc) { | 1442 set_full_young_gcs(false); |
1473 set_full_young_gcs(false); | 1443 _last_full_young_gc = false; |
1474 _last_full_young_gc = false; | 1444 } |
1475 } | 1445 |
1476 | 1446 if ( !_last_young_gc_full ) { |
1477 if ( !_last_young_gc_full ) { | 1447 if ( _should_revert_to_full_young_gcs || |
1478 if ( _should_revert_to_full_young_gcs || | 1448 _known_garbage_ratio < 0.05 || |
1479 _known_garbage_ratio < 0.05 || | 1449 (adaptive_young_list_length() && |
1480 (adaptive_young_list_length() && | 1450 (get_gc_eff_factor() * cur_efficiency < predict_young_gc_eff())) ) { |
1481 (get_gc_eff_factor() * cur_efficiency < predict_young_gc_eff())) ) { | |
1482 set_full_young_gcs(true); | 1451 set_full_young_gcs(true); |
1483 } | 1452 } |
1484 } | 1453 } |
1485 _should_revert_to_full_young_gcs = false; | 1454 _should_revert_to_full_young_gcs = false; |
1486 | 1455 |
1487 if (_last_young_gc_full && !_during_marking) | 1456 if (_last_young_gc_full && !_during_marking) { |
1488 _young_gc_eff_seq->add(cur_efficiency); | 1457 _young_gc_eff_seq->add(cur_efficiency); |
1489 } | 1458 } |
1490 | 1459 |
1491 _short_lived_surv_rate_group->start_adding_regions(); | 1460 _short_lived_surv_rate_group->start_adding_regions(); |
1492 // do that for any other surv rate groupsx | 1461 // do that for any other surv rate groupsx |
1493 | 1462 |
1908 void G1CollectorPolicy::check_if_region_is_too_expensive(double | 1877 void G1CollectorPolicy::check_if_region_is_too_expensive(double |
1909 predicted_time_ms) { | 1878 predicted_time_ms) { |
1910 // I don't think we need to do this when in young GC mode since | 1879 // I don't think we need to do this when in young GC mode since |
1911 // marking will be initiated next time we hit the soft limit anyway... | 1880 // marking will be initiated next time we hit the soft limit anyway... |
1912 if (predicted_time_ms > _expensive_region_limit_ms) { | 1881 if (predicted_time_ms > _expensive_region_limit_ms) { |
1913 if (!in_young_gc_mode()) { | 1882 // no point in doing another partial one |
1914 set_full_young_gcs(true); | 1883 _should_revert_to_full_young_gcs = true; |
1915 // We might want to do something different here. However, | |
1916 // right now we don't support the non-generational G1 mode | |
1917 // (and in fact we are planning to remove the associated code, | |
1918 // see CR 6814390). So, let's leave it as is and this will be | |
1919 // removed some time in the future | |
1920 ShouldNotReachHere(); | |
1921 set_during_initial_mark_pause(); | |
1922 } else | |
1923 // no point in doing another partial one | |
1924 _should_revert_to_full_young_gcs = true; | |
1925 } | 1884 } |
1926 } | 1885 } |
1927 | 1886 |
1928 // </NEW PREDICTION> | 1887 // </NEW PREDICTION> |
1929 | 1888 |
2615 _inc_cset_head = NULL; | 2574 _inc_cset_head = NULL; |
2616 _inc_cset_tail = NULL; | 2575 _inc_cset_tail = NULL; |
2617 _inc_cset_size = 0; | 2576 _inc_cset_size = 0; |
2618 _inc_cset_bytes_used_before = 0; | 2577 _inc_cset_bytes_used_before = 0; |
2619 | 2578 |
2620 if (in_young_gc_mode()) { | 2579 _inc_cset_young_index = 0; |
2621 _inc_cset_young_index = 0; | |
2622 } | |
2623 | 2580 |
2624 _inc_cset_max_finger = 0; | 2581 _inc_cset_max_finger = 0; |
2625 _inc_cset_recorded_young_bytes = 0; | 2582 _inc_cset_recorded_young_bytes = 0; |
2626 _inc_cset_recorded_rs_lengths = 0; | 2583 _inc_cset_recorded_rs_lengths = 0; |
2627 _inc_cset_predicted_elapsed_time_ms = 0; | 2584 _inc_cset_predicted_elapsed_time_ms = 0; |
2846 | 2803 |
2847 // Adjust for expansion and slop. | 2804 // Adjust for expansion and slop. |
2848 max_live_bytes = max_live_bytes + expansion_bytes; | 2805 max_live_bytes = max_live_bytes + expansion_bytes; |
2849 | 2806 |
2850 HeapRegion* hr; | 2807 HeapRegion* hr; |
2851 if (in_young_gc_mode()) { | 2808 double young_start_time_sec = os::elapsedTime(); |
2852 double young_start_time_sec = os::elapsedTime(); | 2809 |
2853 | 2810 if (G1PolicyVerbose > 0) { |
2854 if (G1PolicyVerbose > 0) { | 2811 gclog_or_tty->print_cr("Adding %d young regions to the CSet", |
2855 gclog_or_tty->print_cr("Adding %d young regions to the CSet", | 2812 _g1->young_list()->length()); |
2856 _g1->young_list()->length()); | 2813 } |
2857 } | 2814 |
2858 | 2815 _young_cset_length = 0; |
2859 _young_cset_length = 0; | 2816 _last_young_gc_full = full_young_gcs() ? true : false; |
2860 _last_young_gc_full = full_young_gcs() ? true : false; | 2817 |
2861 | 2818 if (_last_young_gc_full) |
2862 if (_last_young_gc_full) | 2819 ++_full_young_pause_num; |
2863 ++_full_young_pause_num; | 2820 else |
2864 else | 2821 ++_partial_young_pause_num; |
2865 ++_partial_young_pause_num; | 2822 |
2866 | 2823 // The young list is laid with the survivor regions from the previous |
2867 // The young list is laid with the survivor regions from the previous | 2824 // pause are appended to the RHS of the young list, i.e. |
2868 // pause are appended to the RHS of the young list, i.e. | 2825 // [Newly Young Regions ++ Survivors from last pause]. |
2869 // [Newly Young Regions ++ Survivors from last pause]. | 2826 |
2870 | 2827 hr = _g1->young_list()->first_survivor_region(); |
2871 hr = _g1->young_list()->first_survivor_region(); | 2828 while (hr != NULL) { |
2872 while (hr != NULL) { | 2829 assert(hr->is_survivor(), "badly formed young list"); |
2873 assert(hr->is_survivor(), "badly formed young list"); | 2830 hr->set_young(); |
2874 hr->set_young(); | 2831 hr = hr->get_next_young_region(); |
2875 hr = hr->get_next_young_region(); | 2832 } |
2876 } | 2833 |
2877 | 2834 // Clear the fields that point to the survivor list - they are |
2878 // Clear the fields that point to the survivor list - they are | 2835 // all young now. |
2879 // all young now. | 2836 _g1->young_list()->clear_survivors(); |
2880 _g1->young_list()->clear_survivors(); | 2837 |
2881 | 2838 if (_g1->mark_in_progress()) |
2882 if (_g1->mark_in_progress()) | 2839 _g1->concurrent_mark()->register_collection_set_finger(_inc_cset_max_finger); |
2883 _g1->concurrent_mark()->register_collection_set_finger(_inc_cset_max_finger); | 2840 |
2884 | 2841 _young_cset_length = _inc_cset_young_index; |
2885 _young_cset_length = _inc_cset_young_index; | 2842 _collection_set = _inc_cset_head; |
2886 _collection_set = _inc_cset_head; | 2843 _collection_set_size = _inc_cset_size; |
2887 _collection_set_size = _inc_cset_size; | 2844 _collection_set_bytes_used_before = _inc_cset_bytes_used_before; |
2888 _collection_set_bytes_used_before = _inc_cset_bytes_used_before; | 2845 |
2889 | 2846 // For young regions in the collection set, we assume the worst |
2890 // For young regions in the collection set, we assume the worst | 2847 // case of complete survival |
2891 // case of complete survival | 2848 max_live_bytes -= _inc_cset_size * HeapRegion::GrainBytes; |
2892 max_live_bytes -= _inc_cset_size * HeapRegion::GrainBytes; | 2849 |
2893 | 2850 time_remaining_ms -= _inc_cset_predicted_elapsed_time_ms; |
2894 time_remaining_ms -= _inc_cset_predicted_elapsed_time_ms; | 2851 predicted_pause_time_ms += _inc_cset_predicted_elapsed_time_ms; |
2895 predicted_pause_time_ms += _inc_cset_predicted_elapsed_time_ms; | 2852 |
2896 | 2853 // The number of recorded young regions is the incremental |
2897 // The number of recorded young regions is the incremental | 2854 // collection set's current size |
2898 // collection set's current size | 2855 set_recorded_young_regions(_inc_cset_size); |
2899 set_recorded_young_regions(_inc_cset_size); | 2856 set_recorded_rs_lengths(_inc_cset_recorded_rs_lengths); |
2900 set_recorded_rs_lengths(_inc_cset_recorded_rs_lengths); | 2857 set_recorded_young_bytes(_inc_cset_recorded_young_bytes); |
2901 set_recorded_young_bytes(_inc_cset_recorded_young_bytes); | |
2902 #if PREDICTIONS_VERBOSE | 2858 #if PREDICTIONS_VERBOSE |
2903 set_predicted_bytes_to_copy(_inc_cset_predicted_bytes_to_copy); | 2859 set_predicted_bytes_to_copy(_inc_cset_predicted_bytes_to_copy); |
2904 #endif // PREDICTIONS_VERBOSE | 2860 #endif // PREDICTIONS_VERBOSE |
2905 | 2861 |
2906 if (G1PolicyVerbose > 0) { | 2862 if (G1PolicyVerbose > 0) { |
2907 gclog_or_tty->print_cr(" Added " PTR_FORMAT " Young Regions to CS.", | 2863 gclog_or_tty->print_cr(" Added " PTR_FORMAT " Young Regions to CS.", |
2908 _inc_cset_size); | 2864 _inc_cset_size); |
2909 gclog_or_tty->print_cr(" (" SIZE_FORMAT " KB left in heap.)", | 2865 gclog_or_tty->print_cr(" (" SIZE_FORMAT " KB left in heap.)", |
2910 max_live_bytes/K); | 2866 max_live_bytes/K); |
2911 } | 2867 } |
2912 | 2868 |
2913 assert(_inc_cset_size == _g1->young_list()->length(), "Invariant"); | 2869 assert(_inc_cset_size == _g1->young_list()->length(), "Invariant"); |
2914 | 2870 |
2915 double young_end_time_sec = os::elapsedTime(); | 2871 double young_end_time_sec = os::elapsedTime(); |
2916 _recorded_young_cset_choice_time_ms = | 2872 _recorded_young_cset_choice_time_ms = |
2917 (young_end_time_sec - young_start_time_sec) * 1000.0; | 2873 (young_end_time_sec - young_start_time_sec) * 1000.0; |
2918 | 2874 |
2919 // We are doing young collections so reset this. | 2875 // We are doing young collections so reset this. |
2920 non_young_start_time_sec = young_end_time_sec; | 2876 non_young_start_time_sec = young_end_time_sec; |
2921 | 2877 |
2922 // Note we can use either _collection_set_size or | 2878 if (!full_young_gcs()) { |
2923 // _young_cset_length here | |
2924 if (_collection_set_size > 0 && _last_young_gc_full) { | |
2925 // don't bother adding more regions... | |
2926 goto choose_collection_set_end; | |
2927 } | |
2928 } | |
2929 | |
2930 if (!in_young_gc_mode() || !full_young_gcs()) { | |
2931 bool should_continue = true; | 2879 bool should_continue = true; |
2932 NumberSeq seq; | 2880 NumberSeq seq; |
2933 double avg_prediction = 100000000000000000.0; // something very large | 2881 double avg_prediction = 100000000000000000.0; // something very large |
2934 | 2882 |
2935 do { | 2883 do { |
2958 if (!adaptive_young_list_length() && | 2906 if (!adaptive_young_list_length() && |
2959 _collection_set_size < _young_list_fixed_length) | 2907 _collection_set_size < _young_list_fixed_length) |
2960 _should_revert_to_full_young_gcs = true; | 2908 _should_revert_to_full_young_gcs = true; |
2961 } | 2909 } |
2962 | 2910 |
2963 choose_collection_set_end: | |
2964 stop_incremental_cset_building(); | 2911 stop_incremental_cset_building(); |
2965 | 2912 |
2966 count_CS_bytes_used(); | 2913 count_CS_bytes_used(); |
2967 | 2914 |
2968 end_recording_regions(); | 2915 end_recording_regions(); |