src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp

Print this page
rev 2591 : 6814390: G1: remove the concept of non-generational G1
Summary: Removed the possibility to turn off generational mode for G1.
Reviewed-by:

@@ -199,11 +199,10 @@
 
   _pause_time_target_ms((double) MaxGCPauseMillis),
 
   // </NEW PREDICTION>
 
-  _in_young_gc_mode(false),
   _full_young_gcs(true),
   _full_young_pause_num(0),
   _partial_young_pause_num(0),
 
   _during_marking(false),

@@ -466,13 +465,10 @@
 
   assert(Heap_lock->owned_by_self(), "Locking discipline.");
 
   initialize_gc_policy_counters();
 
-  if (G1Gen) {
-    _in_young_gc_mode = true;
-
     G1YoungGenSizer sizer;
     size_t initial_region_num = sizer.initial_young_region_num();
 
     if (UseAdaptiveSizePolicy) {
       set_adaptive_young_list_length(true);

@@ -483,24 +479,20 @@
     }
     _free_regions_at_end_of_collection = _g1->free_regions();
     calculate_young_list_min_length();
     guarantee( _young_list_min_length == 0, "invariant, not enough info" );
     calculate_young_list_target_length();
-  } else {
-     _young_list_fixed_length = 0;
-    _in_young_gc_mode = false;
-  }
 
   // We may immediately start allocating regions and placing them on the
   // collection set list. Initialize the per-collection set info
   start_incremental_cset_building();
 }
 
 // Create the jstat counters for the policy.
 void G1CollectorPolicy::initialize_gc_policy_counters()
 {
-  _gc_policy_counters = new GCPolicyCounters("GarbageFirst", 1, 2 + G1Gen);
+  _gc_policy_counters = new GCPolicyCounters("GarbageFirst", 1, 3);
 }
 
 void G1CollectorPolicy::calculate_young_list_min_length() {
   _young_list_min_length = 0;
 

@@ -866,11 +858,10 @@
 void G1CollectorPolicy::record_collection_pause_start(double start_time_sec,
                                                       size_t start_used) {
   if (PrintGCDetails) {
     gclog_or_tty->stamp(PrintGCTimeStamps);
     gclog_or_tty->print("[GC pause");
-    if (in_young_gc_mode())
       gclog_or_tty->print(" (%s)", full_young_gcs() ? "young" : "partial");
   }
 
   assert(_g1->used() == _g1->recalculate_used(),
          err_msg("sanity, used: "SIZE_FORMAT" recalculate_used: "SIZE_FORMAT,

@@ -919,11 +910,10 @@
   }
 
   _satb_drain_time_set = false;
   _last_satb_drain_processed_buffers = -1;
 
-  if (in_young_gc_mode())
     _last_young_gc_full = false;
 
   // do that for any other surv rate groups
   _short_lived_surv_rate_group->stop_adding_regions();
   _survivors_age_table.clear();

@@ -935,11 +925,10 @@
   _mark_closure_time_ms = mark_closure_time_ms;
 }
 
 void G1CollectorPolicy::record_concurrent_mark_init_start() {
   _mark_init_start_sec = os::elapsedTime();
-  guarantee(!in_young_gc_mode(), "should not do be here in young GC mode");
 }
 
 void G1CollectorPolicy::record_concurrent_mark_init_end_pre(double
                                                    mark_init_elapsed_time_ms) {
   _during_marking = true;

@@ -1017,17 +1006,15 @@
   _n_marks_since_last_pause++;
 }
 
 void
 G1CollectorPolicy::record_concurrent_mark_cleanup_completed() {
-  if (in_young_gc_mode()) {
     _should_revert_to_full_young_gcs = false;
     _last_full_young_gc = true;
     _in_marking_window = false;
     if (adaptive_young_list_length())
       calculate_young_list_target_length();
-  }
 }
 
 void G1CollectorPolicy::record_concurrent_pause() {
   if (_stop_world_start > 0.0) {
     double yield_ms = (os::elapsedTime() - _stop_world_start) * 1000.0;

@@ -1172,11 +1159,10 @@
     _short_lived_surv_rate_group->print();
     // do that for any other surv rate groups too
   }
 #endif // PRODUCT
 
-  if (in_young_gc_mode()) {
     last_pause_included_initial_mark = during_initial_mark_pause();
     if (last_pause_included_initial_mark)
       record_concurrent_mark_init_end_pre(0.0);
 
     size_t min_used_targ =

@@ -1195,11 +1181,10 @@
         set_initiate_conc_mark_if_possible();
       }
     }
 
     _prev_collection_pause_used_at_end_bytes = cur_used_bytes;
-  }
 
   _mmu_tracker->add_pause(end_time_sec - elapsed_ms/1000.0,
                           end_time_sec, false);
 
   guarantee(_cur_collection_pause_used_regions_at_start >=

@@ -1466,11 +1451,10 @@
   if (during_initial_mark_pause()) {
     new_in_marking_window = true;
     new_in_marking_window_im = true;
   }
 
-  if (in_young_gc_mode()) {
     if (_last_full_young_gc) {
       set_full_young_gcs(false);
       _last_full_young_gc = false;
     }
 

@@ -1482,11 +1466,11 @@
         set_full_young_gcs(true);
       }
     }
     _should_revert_to_full_young_gcs = false;
 
-    if (_last_young_gc_full && !_during_marking)
+  if (_last_young_gc_full && !_during_marking) {
       _young_gc_eff_seq->add(cur_efficiency);
   }
 
   _short_lived_surv_rate_group->start_adding_regions();
   // do that for any other surv rate groupsx

@@ -1908,20 +1892,10 @@
 void G1CollectorPolicy::check_if_region_is_too_expensive(double
                                                            predicted_time_ms) {
   // I don't think we need to do this when in young GC mode since
   // marking will be initiated next time we hit the soft limit anyway...
   if (predicted_time_ms > _expensive_region_limit_ms) {
-    if (!in_young_gc_mode()) {
-        set_full_young_gcs(true);
-        // We might want to do something different here. However,
-        // right now we don't support the non-generational G1 mode
-        // (and in fact we are planning to remove the associated code,
-        // see CR 6814390). So, let's leave it as is and this will be
-        // removed some time in the future
-        ShouldNotReachHere();
-        set_during_initial_mark_pause();
-    } else
       // no point in doing another partial one
       _should_revert_to_full_young_gcs = true;
   }
 }
 

@@ -2615,13 +2589,11 @@
   _inc_cset_head = NULL;
   _inc_cset_tail = NULL;
   _inc_cset_size = 0;
   _inc_cset_bytes_used_before = 0;
 
-  if (in_young_gc_mode()) {
     _inc_cset_young_index = 0;
-  }
 
   _inc_cset_max_finger = 0;
   _inc_cset_recorded_young_bytes = 0;
   _inc_cset_recorded_rs_lengths = 0;
   _inc_cset_predicted_elapsed_time_ms = 0;

@@ -2846,11 +2818,10 @@
 
   // Adjust for expansion and slop.
   max_live_bytes = max_live_bytes + expansion_bytes;
 
   HeapRegion* hr;
-  if (in_young_gc_mode()) {
     double young_start_time_sec = os::elapsedTime();
 
     if (G1PolicyVerbose > 0) {
       gclog_or_tty->print_cr("Adding %d young regions to the CSet",
                     _g1->young_list()->length());

@@ -2923,13 +2894,12 @@
     // _young_cset_length here
     if (_collection_set_size > 0 && _last_young_gc_full) {
       // don't bother adding more regions...
       goto choose_collection_set_end;
     }
-  }
 
-  if (!in_young_gc_mode() || !full_young_gcs()) {
+  if (!full_young_gcs()) {
     bool should_continue = true;
     NumberSeq seq;
     double avg_prediction = 100000000000000000.0; // something very large
 
     do {