6814390: G1: remove the concept of non-generational G1

Fri, 19 Aug 2011 09:30:59 +0200

author
brutisso
date
Fri, 19 Aug 2011 09:30:59 +0200
changeset 3065
ff53346271fe
parent 3064
7c29742c41b4
child 3066
ae73da50be4b
child 3067
7f776886a215

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

src/share/vm/gc_implementation/g1/concurrentMark.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/concurrentMark.hpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp file | annotate | diff | comparison | revisions
src/share/vm/gc_implementation/g1/g1_globals.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Aug 19 14:22:25 2011 -0700
     1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Aug 19 09:30:59 2011 +0200
     1.3 @@ -801,39 +801,6 @@
     1.4    reset();
     1.5  }
     1.6  
     1.7 -class CMMarkRootsClosure: public OopsInGenClosure {
     1.8 -private:
     1.9 -  ConcurrentMark*  _cm;
    1.10 -  G1CollectedHeap* _g1h;
    1.11 -  bool             _do_barrier;
    1.12 -
    1.13 -public:
    1.14 -  CMMarkRootsClosure(ConcurrentMark* cm,
    1.15 -                     G1CollectedHeap* g1h,
    1.16 -                     bool do_barrier) : _cm(cm), _g1h(g1h),
    1.17 -                                        _do_barrier(do_barrier) { }
    1.18 -
    1.19 -  virtual void do_oop(narrowOop* p) { do_oop_work(p); }
    1.20 -  virtual void do_oop(      oop* p) { do_oop_work(p); }
    1.21 -
    1.22 -  template <class T> void do_oop_work(T* p) {
    1.23 -    T heap_oop = oopDesc::load_heap_oop(p);
    1.24 -    if (!oopDesc::is_null(heap_oop)) {
    1.25 -      oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
    1.26 -      assert(obj->is_oop() || obj->mark() == NULL,
    1.27 -             "expected an oop, possibly with mark word displaced");
    1.28 -      HeapWord* addr = (HeapWord*)obj;
    1.29 -      if (_g1h->is_in_g1_reserved(addr)) {
    1.30 -        _cm->grayRoot(obj);
    1.31 -      }
    1.32 -    }
    1.33 -    if (_do_barrier) {
    1.34 -      assert(!_g1h->is_in_g1_reserved(p),
    1.35 -             "Should be called on external roots");
    1.36 -      do_barrier(p);
    1.37 -    }
    1.38 -  }
    1.39 -};
    1.40  
    1.41  void ConcurrentMark::checkpointRootsInitialPost() {
    1.42    G1CollectedHeap*   g1h = G1CollectedHeap::heap();
    1.43 @@ -868,50 +835,6 @@
    1.44    // during it. No need to call it here.
    1.45  }
    1.46  
    1.47 -// Checkpoint the roots into this generation from outside
    1.48 -// this generation. [Note this initial checkpoint need only
    1.49 -// be approximate -- we'll do a catch up phase subsequently.]
    1.50 -void ConcurrentMark::checkpointRootsInitial() {
    1.51 -  assert(SafepointSynchronize::is_at_safepoint(), "world should be stopped");
    1.52 -  G1CollectedHeap* g1h = G1CollectedHeap::heap();
    1.53 -
    1.54 -  double start = os::elapsedTime();
    1.55 -
    1.56 -  G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy();
    1.57 -  g1p->record_concurrent_mark_init_start();
    1.58 -  checkpointRootsInitialPre();
    1.59 -
    1.60 -  // YSR: when concurrent precleaning is in place, we'll
    1.61 -  // need to clear the cached card table here
    1.62 -
    1.63 -  ResourceMark rm;
    1.64 -  HandleMark  hm;
    1.65 -
    1.66 -  g1h->ensure_parsability(false);
    1.67 -  g1h->perm_gen()->save_marks();
    1.68 -
    1.69 -  CMMarkRootsClosure notOlder(this, g1h, false);
    1.70 -  CMMarkRootsClosure older(this, g1h, true);
    1.71 -
    1.72 -  g1h->set_marking_started();
    1.73 -  g1h->rem_set()->prepare_for_younger_refs_iterate(false);
    1.74 -
    1.75 -  g1h->process_strong_roots(true,    // activate StrongRootsScope
    1.76 -                            false,   // fake perm gen collection
    1.77 -                            SharedHeap::SO_AllClasses,
    1.78 -                            &notOlder, // Regular roots
    1.79 -                            NULL,     // do not visit active blobs
    1.80 -                            &older    // Perm Gen Roots
    1.81 -                            );
    1.82 -  checkpointRootsInitialPost();
    1.83 -
    1.84 -  // Statistics.
    1.85 -  double end = os::elapsedTime();
    1.86 -  _init_times.add((end - start) * 1000.0);
    1.87 -
    1.88 -  g1p->record_concurrent_mark_init_end();
    1.89 -}
    1.90 -
    1.91  /*
    1.92   * Notice that in the next two methods, we actually leave the STS
    1.93   * during the barrier sync and join it immediately afterwards. If we
     2.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Fri Aug 19 14:22:25 2011 -0700
     2.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Fri Aug 19 09:30:59 2011 +0200
     2.3 @@ -756,9 +756,6 @@
     2.4    // Clear the next marking bitmap (will be called concurrently).
     2.5    void clearNextBitmap();
     2.6  
     2.7 -  // main CMS steps and related support
     2.8 -  void checkpointRootsInitial();
     2.9 -
    2.10    // These two do the work that needs to be done before and after the
    2.11    // initial root checkpoint. Since this checkpoint can be done at two
    2.12    // different points (i.e. an explicit pause or piggy-backed on a
     3.1 --- a/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Fri Aug 19 14:22:25 2011 -0700
     3.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Fri Aug 19 09:30:59 2011 +0200
     3.3 @@ -50,19 +50,6 @@
     3.4    create_and_start();
     3.5  }
     3.6  
     3.7 -class CMCheckpointRootsInitialClosure: public VoidClosure {
     3.8 -
     3.9 -  ConcurrentMark* _cm;
    3.10 -public:
    3.11 -
    3.12 -  CMCheckpointRootsInitialClosure(ConcurrentMark* cm) :
    3.13 -    _cm(cm) {}
    3.14 -
    3.15 -  void do_void(){
    3.16 -    _cm->checkpointRootsInitial();
    3.17 -  }
    3.18 -};
    3.19 -
    3.20  class CMCheckpointRootsFinalClosure: public VoidClosure {
    3.21  
    3.22    ConcurrentMark* _cm;
    3.23 @@ -116,27 +103,6 @@
    3.24          gclog_or_tty->print_cr("[GC concurrent-mark-start]");
    3.25        }
    3.26  
    3.27 -      if (!g1_policy->in_young_gc_mode()) {
    3.28 -        // this ensures the flag is not set if we bail out of the marking
    3.29 -        // cycle; normally the flag is cleared immediately after cleanup
    3.30 -        g1h->set_marking_complete();
    3.31 -
    3.32 -        if (g1_policy->adaptive_young_list_length()) {
    3.33 -          double now = os::elapsedTime();
    3.34 -          double init_prediction_ms = g1_policy->predict_init_time_ms();
    3.35 -          jlong sleep_time_ms = mmu_tracker->when_ms(now, init_prediction_ms);
    3.36 -          os::sleep(current_thread, sleep_time_ms, false);
    3.37 -        }
    3.38 -
    3.39 -        // We don't have to skip here if we've been asked to restart, because
    3.40 -        // in the worst case we just enqueue a new VM operation to start a
    3.41 -        // marking.  Note that the init operation resets has_aborted()
    3.42 -        CMCheckpointRootsInitialClosure init_cl(_cm);
    3.43 -        strcpy(verbose_str, "GC initial-mark");
    3.44 -        VM_CGC_Operation op(&init_cl, verbose_str);
    3.45 -        VMThread::execute(&op);
    3.46 -      }
    3.47 -
    3.48        int iter = 0;
    3.49        do {
    3.50          iter++;
     4.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Aug 19 14:22:25 2011 -0700
     4.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Aug 19 09:30:59 2011 +0200
     4.3 @@ -1263,10 +1263,8 @@
     4.4      g1_policy()->clear_incremental_cset();
     4.5      g1_policy()->stop_incremental_cset_building();
     4.6  
     4.7 -    if (g1_policy()->in_young_gc_mode()) {
     4.8 -      empty_young_list();
     4.9 -      g1_policy()->set_full_young_gcs(true);
    4.10 -    }
    4.11 +    empty_young_list();
    4.12 +    g1_policy()->set_full_young_gcs(true);
    4.13  
    4.14      // See the comment in G1CollectedHeap::ref_processing_init() about
    4.15      // how reference processing currently works in G1.
    4.16 @@ -1387,13 +1385,11 @@
    4.17             || (G1DeferredRSUpdate && (dirty_card_queue_set().completed_buffers_num() == 0)), "Should not be any");
    4.18    }
    4.19  
    4.20 -  if (g1_policy()->in_young_gc_mode()) {
    4.21 -    _young_list->reset_sampled_info();
    4.22 -    // At this point there should be no regions in the
    4.23 -    // entire heap tagged as young.
    4.24 -    assert( check_young_list_empty(true /* check_heap */),
    4.25 -            "young list should be empty at this point");
    4.26 -  }
    4.27 +  _young_list->reset_sampled_info();
    4.28 +  // At this point there should be no regions in the
    4.29 +  // entire heap tagged as young.
    4.30 +  assert( check_young_list_empty(true /* check_heap */),
    4.31 +    "young list should be empty at this point");
    4.32  
    4.33    // Update the number of full collections that have been completed.
    4.34    increment_full_collections_completed(false /* concurrent */);
    4.35 @@ -3161,12 +3157,6 @@
    4.36    }
    4.37  }
    4.38  
    4.39 -void G1CollectedHeap::do_sync_mark() {
    4.40 -  _cm->checkpointRootsInitial();
    4.41 -  _cm->markFromRoots();
    4.42 -  _cm->checkpointRootsFinal(false);
    4.43 -}
    4.44 -
    4.45  // <NEW PREDICTION>
    4.46  
    4.47  double G1CollectedHeap::predict_region_elapsed_time_ms(HeapRegion *hr,
    4.48 @@ -3317,11 +3307,10 @@
    4.49  
    4.50      char verbose_str[128];
    4.51      sprintf(verbose_str, "GC pause ");
    4.52 -    if (g1_policy()->in_young_gc_mode()) {
    4.53 -      if (g1_policy()->full_young_gcs())
    4.54 -        strcat(verbose_str, "(young)");
    4.55 -      else
    4.56 -        strcat(verbose_str, "(partial)");
    4.57 +    if (g1_policy()->full_young_gcs()) {
    4.58 +      strcat(verbose_str, "(young)");
    4.59 +    } else {
    4.60 +      strcat(verbose_str, "(partial)");
    4.61      }
    4.62      if (g1_policy()->during_initial_mark_pause()) {
    4.63        strcat(verbose_str, " (initial-mark)");
    4.64 @@ -3350,10 +3339,8 @@
    4.65        append_secondary_free_list_if_not_empty_with_lock();
    4.66      }
    4.67  
    4.68 -    if (g1_policy()->in_young_gc_mode()) {
    4.69 -      assert(check_young_list_well_formed(),
    4.70 -             "young list should be well formed");
    4.71 -    }
    4.72 +    assert(check_young_list_well_formed(),
    4.73 +      "young list should be well formed");
    4.74  
    4.75      { // Call to jvmpi::post_class_unload_events must occur outside of active GC
    4.76        IsGCActiveMark x;
    4.77 @@ -3494,27 +3481,25 @@
    4.78        // evacuation pause.
    4.79        clear_cset_fast_test();
    4.80  
    4.81 -      if (g1_policy()->in_young_gc_mode()) {
    4.82 -        _young_list->reset_sampled_info();
    4.83 -
    4.84 -        // Don't check the whole heap at this point as the
    4.85 -        // GC alloc regions from this pause have been tagged
    4.86 -        // as survivors and moved on to the survivor list.
    4.87 -        // Survivor regions will fail the !is_young() check.
    4.88 -        assert(check_young_list_empty(false /* check_heap */),
    4.89 -               "young list should be empty");
    4.90 +      _young_list->reset_sampled_info();
    4.91 +
    4.92 +      // Don't check the whole heap at this point as the
    4.93 +      // GC alloc regions from this pause have been tagged
    4.94 +      // as survivors and moved on to the survivor list.
    4.95 +      // Survivor regions will fail the !is_young() check.
    4.96 +      assert(check_young_list_empty(false /* check_heap */),
    4.97 +        "young list should be empty");
    4.98  
    4.99  #if YOUNG_LIST_VERBOSE
   4.100 -        gclog_or_tty->print_cr("Before recording survivors.\nYoung List:");
   4.101 -        _young_list->print();
   4.102 +      gclog_or_tty->print_cr("Before recording survivors.\nYoung List:");
   4.103 +      _young_list->print();
   4.104  #endif // YOUNG_LIST_VERBOSE
   4.105  
   4.106 -        g1_policy()->record_survivor_regions(_young_list->survivor_length(),
   4.107 -                                          _young_list->first_survivor_region(),
   4.108 -                                          _young_list->last_survivor_region());
   4.109 -
   4.110 -        _young_list->reset_auxilary_lists();
   4.111 -      }
   4.112 +      g1_policy()->record_survivor_regions(_young_list->survivor_length(),
   4.113 +        _young_list->first_survivor_region(),
   4.114 +        _young_list->last_survivor_region());
   4.115 +
   4.116 +      _young_list->reset_auxilary_lists();
   4.117  
   4.118        if (evacuation_failed()) {
   4.119          _summary_bytes_used = recalculate_used();
   4.120 @@ -3524,8 +3509,7 @@
   4.121          _summary_bytes_used += g1_policy()->bytes_copied_during_gc();
   4.122        }
   4.123  
   4.124 -      if (g1_policy()->in_young_gc_mode() &&
   4.125 -          g1_policy()->during_initial_mark_pause()) {
   4.126 +      if (g1_policy()->during_initial_mark_pause()) {
   4.127          concurrent_mark()->checkpointRootsInitialPost();
   4.128          set_marking_started();
   4.129          // CAUTION: after the doConcurrentMark() call below,
   4.130 @@ -5091,7 +5075,6 @@
   4.131  void G1CollectedHeap::empty_young_list() {
   4.132    assert(heap_lock_held_for_gc(),
   4.133                "the heap lock should already be held by or for this thread");
   4.134 -  assert(g1_policy()->in_young_gc_mode(), "should be in young GC mode");
   4.135  
   4.136    _young_list->empty_list();
   4.137  }
     5.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Aug 19 14:22:25 2011 -0700
     5.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Fri Aug 19 09:30:59 2011 +0200
     5.3 @@ -1263,16 +1263,10 @@
     5.4    // in the young gen: for the SATB pre-barrier, there is no
     5.5    // pre-value that needs to be remembered; for the remembered-set
     5.6    // update logging post-barrier, we don't maintain remembered set
     5.7 -  // information for young gen objects. Note that non-generational
     5.8 -  // G1 does not have any "young" objects, should not elide
     5.9 -  // the rs logging barrier and so should always answer false below.
    5.10 -  // However, non-generational G1 (-XX:-G1Gen) appears to have
    5.11 -  // bit-rotted so was not tested below.
    5.12 +  // information for young gen objects.
    5.13    virtual bool can_elide_initializing_store_barrier(oop new_obj) {
    5.14      // Re 6920090, 6920109 above.
    5.15      assert(ReduceInitialCardMarksForG1, "Else cannot be here");
    5.16 -    assert(G1Gen || !is_in_young(new_obj),
    5.17 -           "Non-generational G1 should never return true below");
    5.18      return is_in_young(new_obj);
    5.19    }
    5.20  
    5.21 @@ -1389,9 +1383,6 @@
    5.22    // bitmap off to the side.
    5.23    void doConcurrentMark();
    5.24  
    5.25 -  // Do a full concurrent marking, synchronously.
    5.26 -  void do_sync_mark();
    5.27 -
    5.28    bool isMarkedPrev(oop obj) const;
    5.29    bool isMarkedNext(oop obj) const;
    5.30  
     6.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri Aug 19 14:22:25 2011 -0700
     6.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri Aug 19 09:30:59 2011 +0200
     6.3 @@ -170,7 +170,6 @@
     6.4    _cur_aux_times_ms(new double[_aux_num]),
     6.5    _cur_aux_times_set(new bool[_aux_num]),
     6.6  
     6.7 -  _concurrent_mark_init_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
     6.8    _concurrent_mark_remark_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
     6.9    _concurrent_mark_cleanup_times_ms(new TruncatedSeq(NumPrevPausesForHeuristics)),
    6.10  
    6.11 @@ -201,7 +200,6 @@
    6.12  
    6.13    // </NEW PREDICTION>
    6.14  
    6.15 -  _in_young_gc_mode(false),
    6.16    _full_young_gcs(true),
    6.17    _full_young_pause_num(0),
    6.18    _partial_young_pause_num(0),
    6.19 @@ -400,7 +398,6 @@
    6.20    _sigma = (double) G1ConfidencePercent / 100.0;
    6.21  
    6.22    // start conservatively (around 50ms is about right)
    6.23 -  _concurrent_mark_init_times_ms->add(0.05);
    6.24    _concurrent_mark_remark_times_ms->add(0.05);
    6.25    _concurrent_mark_cleanup_times_ms->add(0.20);
    6.26    _tenuring_threshold = MaxTenuringThreshold;
    6.27 @@ -468,27 +465,20 @@
    6.28  
    6.29    initialize_gc_policy_counters();
    6.30  
    6.31 -  if (G1Gen) {
    6.32 -    _in_young_gc_mode = true;
    6.33 -
    6.34 -    G1YoungGenSizer sizer;
    6.35 -    size_t initial_region_num = sizer.initial_young_region_num();
    6.36 -
    6.37 -    if (UseAdaptiveSizePolicy) {
    6.38 -      set_adaptive_young_list_length(true);
    6.39 -      _young_list_fixed_length = 0;
    6.40 -    } else {
    6.41 -      set_adaptive_young_list_length(false);
    6.42 -      _young_list_fixed_length = initial_region_num;
    6.43 -    }
    6.44 -    _free_regions_at_end_of_collection = _g1->free_regions();
    6.45 -    calculate_young_list_min_length();
    6.46 -    guarantee( _young_list_min_length == 0, "invariant, not enough info" );
    6.47 -    calculate_young_list_target_length();
    6.48 +  G1YoungGenSizer sizer;
    6.49 +  size_t initial_region_num = sizer.initial_young_region_num();
    6.50 +
    6.51 +  if (UseAdaptiveSizePolicy) {
    6.52 +    set_adaptive_young_list_length(true);
    6.53 +    _young_list_fixed_length = 0;
    6.54    } else {
    6.55 -     _young_list_fixed_length = 0;
    6.56 -    _in_young_gc_mode = false;
    6.57 +    set_adaptive_young_list_length(false);
    6.58 +    _young_list_fixed_length = initial_region_num;
    6.59    }
    6.60 +  _free_regions_at_end_of_collection = _g1->free_regions();
    6.61 +  calculate_young_list_min_length();
    6.62 +  guarantee( _young_list_min_length == 0, "invariant, not enough info" );
    6.63 +  calculate_young_list_target_length();
    6.64  
    6.65    // We may immediately start allocating regions and placing them on the
    6.66    // collection set list. Initialize the per-collection set info
    6.67 @@ -498,7 +488,7 @@
    6.68  // Create the jstat counters for the policy.
    6.69  void G1CollectorPolicy::initialize_gc_policy_counters()
    6.70  {
    6.71 -  _gc_policy_counters = new GCPolicyCounters("GarbageFirst", 1, 2 + G1Gen);
    6.72 +  _gc_policy_counters = new GCPolicyCounters("GarbageFirst", 1, 3);
    6.73  }
    6.74  
    6.75  void G1CollectorPolicy::calculate_young_list_min_length() {
    6.76 @@ -868,8 +858,7 @@
    6.77    if (PrintGCDetails) {
    6.78      gclog_or_tty->stamp(PrintGCTimeStamps);
    6.79      gclog_or_tty->print("[GC pause");
    6.80 -    if (in_young_gc_mode())
    6.81 -      gclog_or_tty->print(" (%s)", full_young_gcs() ? "young" : "partial");
    6.82 +    gclog_or_tty->print(" (%s)", full_young_gcs() ? "young" : "partial");
    6.83    }
    6.84  
    6.85    assert(_g1->used() == _g1->recalculate_used(),
    6.86 @@ -921,8 +910,7 @@
    6.87    _satb_drain_time_set = false;
    6.88    _last_satb_drain_processed_buffers = -1;
    6.89  
    6.90 -  if (in_young_gc_mode())
    6.91 -    _last_young_gc_full = false;
    6.92 +  _last_young_gc_full = false;
    6.93  
    6.94    // do that for any other surv rate groups
    6.95    _short_lived_surv_rate_group->stop_adding_regions();
    6.96 @@ -935,12 +923,7 @@
    6.97    _mark_closure_time_ms = mark_closure_time_ms;
    6.98  }
    6.99  
   6.100 -void G1CollectorPolicy::record_concurrent_mark_init_start() {
   6.101 -  _mark_init_start_sec = os::elapsedTime();
   6.102 -  guarantee(!in_young_gc_mode(), "should not do be here in young GC mode");
   6.103 -}
   6.104 -
   6.105 -void G1CollectorPolicy::record_concurrent_mark_init_end_pre(double
   6.106 +void G1CollectorPolicy::record_concurrent_mark_init_end(double
   6.107                                                     mark_init_elapsed_time_ms) {
   6.108    _during_marking = true;
   6.109    assert(!initiate_conc_mark_if_possible(), "we should have cleared it by now");
   6.110 @@ -948,15 +931,6 @@
   6.111    _cur_mark_stop_world_time_ms = mark_init_elapsed_time_ms;
   6.112  }
   6.113  
   6.114 -void G1CollectorPolicy::record_concurrent_mark_init_end() {
   6.115 -  double end_time_sec = os::elapsedTime();
   6.116 -  double elapsed_time_ms = (end_time_sec - _mark_init_start_sec) * 1000.0;
   6.117 -  _concurrent_mark_init_times_ms->add(elapsed_time_ms);
   6.118 -  record_concurrent_mark_init_end_pre(elapsed_time_ms);
   6.119 -
   6.120 -  _mmu_tracker->add_pause(_mark_init_start_sec, end_time_sec, true);
   6.121 -}
   6.122 -
   6.123  void G1CollectorPolicy::record_concurrent_mark_remark_start() {
   6.124    _mark_remark_start_sec = os::elapsedTime();
   6.125    _during_marking = false;
   6.126 @@ -1019,13 +993,11 @@
   6.127  
   6.128  void
   6.129  G1CollectorPolicy::record_concurrent_mark_cleanup_completed() {
   6.130 -  if (in_young_gc_mode()) {
   6.131 -    _should_revert_to_full_young_gcs = false;
   6.132 -    _last_full_young_gc = true;
   6.133 -    _in_marking_window = false;
   6.134 -    if (adaptive_young_list_length())
   6.135 -      calculate_young_list_target_length();
   6.136 -  }
   6.137 +  _should_revert_to_full_young_gcs = false;
   6.138 +  _last_full_young_gc = true;
   6.139 +  _in_marking_window = false;
   6.140 +  if (adaptive_young_list_length())
   6.141 +    calculate_young_list_target_length();
   6.142  }
   6.143  
   6.144  void G1CollectorPolicy::record_concurrent_pause() {
   6.145 @@ -1174,31 +1146,29 @@
   6.146    }
   6.147  #endif // PRODUCT
   6.148  
   6.149 -  if (in_young_gc_mode()) {
   6.150 -    last_pause_included_initial_mark = during_initial_mark_pause();
   6.151 -    if (last_pause_included_initial_mark)
   6.152 -      record_concurrent_mark_init_end_pre(0.0);
   6.153 -
   6.154 -    size_t min_used_targ =
   6.155 -      (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent;
   6.156 -
   6.157 -
   6.158 -    if (!_g1->mark_in_progress() && !_last_full_young_gc) {
   6.159 -      assert(!last_pause_included_initial_mark, "invariant");
   6.160 -      if (cur_used_bytes > min_used_targ &&
   6.161 -          cur_used_bytes > _prev_collection_pause_used_at_end_bytes) {
   6.162 +  last_pause_included_initial_mark = during_initial_mark_pause();
   6.163 +  if (last_pause_included_initial_mark)
   6.164 +    record_concurrent_mark_init_end(0.0);
   6.165 +
   6.166 +  size_t min_used_targ =
   6.167 +    (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent;
   6.168 +
   6.169 +
   6.170 +  if (!_g1->mark_in_progress() && !_last_full_young_gc) {
   6.171 +    assert(!last_pause_included_initial_mark, "invariant");
   6.172 +    if (cur_used_bytes > min_used_targ &&
   6.173 +      cur_used_bytes > _prev_collection_pause_used_at_end_bytes) {
   6.174          assert(!during_initial_mark_pause(), "we should not see this here");
   6.175  
   6.176          // Note: this might have already been set, if during the last
   6.177          // pause we decided to start a cycle but at the beginning of
   6.178          // this pause we decided to postpone it. That's OK.
   6.179          set_initiate_conc_mark_if_possible();
   6.180 -      }
   6.181      }
   6.182 -
   6.183 -    _prev_collection_pause_used_at_end_bytes = cur_used_bytes;
   6.184    }
   6.185  
   6.186 +  _prev_collection_pause_used_at_end_bytes = cur_used_bytes;
   6.187 +
   6.188    _mmu_tracker->add_pause(end_time_sec - elapsed_ms/1000.0,
   6.189                            end_time_sec, false);
   6.190  
   6.191 @@ -1468,24 +1438,23 @@
   6.192      new_in_marking_window_im = true;
   6.193    }
   6.194  
   6.195 -  if (in_young_gc_mode()) {
   6.196 -    if (_last_full_young_gc) {
   6.197 -      set_full_young_gcs(false);
   6.198 -      _last_full_young_gc = false;
   6.199 +  if (_last_full_young_gc) {
   6.200 +    set_full_young_gcs(false);
   6.201 +    _last_full_young_gc = false;
   6.202 +  }
   6.203 +
   6.204 +  if ( !_last_young_gc_full ) {
   6.205 +    if ( _should_revert_to_full_young_gcs ||
   6.206 +      _known_garbage_ratio < 0.05 ||
   6.207 +      (adaptive_young_list_length() &&
   6.208 +      (get_gc_eff_factor() * cur_efficiency < predict_young_gc_eff())) ) {
   6.209 +        set_full_young_gcs(true);
   6.210      }
   6.211 -
   6.212 -    if ( !_last_young_gc_full ) {
   6.213 -      if ( _should_revert_to_full_young_gcs ||
   6.214 -           _known_garbage_ratio < 0.05 ||
   6.215 -           (adaptive_young_list_length() &&
   6.216 -           (get_gc_eff_factor() * cur_efficiency < predict_young_gc_eff())) ) {
   6.217 -        set_full_young_gcs(true);
   6.218 -      }
   6.219 -    }
   6.220 -    _should_revert_to_full_young_gcs = false;
   6.221 -
   6.222 -    if (_last_young_gc_full && !_during_marking)
   6.223 -      _young_gc_eff_seq->add(cur_efficiency);
   6.224 +  }
   6.225 +  _should_revert_to_full_young_gcs = false;
   6.226 +
   6.227 +  if (_last_young_gc_full && !_during_marking) {
   6.228 +    _young_gc_eff_seq->add(cur_efficiency);
   6.229    }
   6.230  
   6.231    _short_lived_surv_rate_group->start_adding_regions();
   6.232 @@ -1910,18 +1879,8 @@
   6.233    // I don't think we need to do this when in young GC mode since
   6.234    // marking will be initiated next time we hit the soft limit anyway...
   6.235    if (predicted_time_ms > _expensive_region_limit_ms) {
   6.236 -    if (!in_young_gc_mode()) {
   6.237 -        set_full_young_gcs(true);
   6.238 -        // We might want to do something different here. However,
   6.239 -        // right now we don't support the non-generational G1 mode
   6.240 -        // (and in fact we are planning to remove the associated code,
   6.241 -        // see CR 6814390). So, let's leave it as is and this will be
   6.242 -        // removed some time in the future
   6.243 -        ShouldNotReachHere();
   6.244 -        set_during_initial_mark_pause();
   6.245 -    } else
   6.246 -      // no point in doing another partial one
   6.247 -      _should_revert_to_full_young_gcs = true;
   6.248 +    // no point in doing another partial one
   6.249 +    _should_revert_to_full_young_gcs = true;
   6.250    }
   6.251  }
   6.252  
   6.253 @@ -2617,9 +2576,7 @@
   6.254    _inc_cset_size = 0;
   6.255    _inc_cset_bytes_used_before = 0;
   6.256  
   6.257 -  if (in_young_gc_mode()) {
   6.258 -    _inc_cset_young_index = 0;
   6.259 -  }
   6.260 +  _inc_cset_young_index = 0;
   6.261  
   6.262    _inc_cset_max_finger = 0;
   6.263    _inc_cset_recorded_young_bytes = 0;
   6.264 @@ -2848,86 +2805,77 @@
   6.265    max_live_bytes = max_live_bytes + expansion_bytes;
   6.266  
   6.267    HeapRegion* hr;
   6.268 -  if (in_young_gc_mode()) {
   6.269 -    double young_start_time_sec = os::elapsedTime();
   6.270 -
   6.271 -    if (G1PolicyVerbose > 0) {
   6.272 -      gclog_or_tty->print_cr("Adding %d young regions to the CSet",
   6.273 -                    _g1->young_list()->length());
   6.274 -    }
   6.275 -
   6.276 -    _young_cset_length  = 0;
   6.277 -    _last_young_gc_full = full_young_gcs() ? true : false;
   6.278 -
   6.279 -    if (_last_young_gc_full)
   6.280 -      ++_full_young_pause_num;
   6.281 -    else
   6.282 -      ++_partial_young_pause_num;
   6.283 -
   6.284 -    // The young list is laid with the survivor regions from the previous
   6.285 -    // pause are appended to the RHS of the young list, i.e.
   6.286 -    //   [Newly Young Regions ++ Survivors from last pause].
   6.287 -
   6.288 -    hr = _g1->young_list()->first_survivor_region();
   6.289 -    while (hr != NULL) {
   6.290 -      assert(hr->is_survivor(), "badly formed young list");
   6.291 -      hr->set_young();
   6.292 -      hr = hr->get_next_young_region();
   6.293 -    }
   6.294 -
   6.295 -    // Clear the fields that point to the survivor list - they are
   6.296 -    // all young now.
   6.297 -    _g1->young_list()->clear_survivors();
   6.298 -
   6.299 -    if (_g1->mark_in_progress())
   6.300 -      _g1->concurrent_mark()->register_collection_set_finger(_inc_cset_max_finger);
   6.301 -
   6.302 -    _young_cset_length = _inc_cset_young_index;
   6.303 -    _collection_set = _inc_cset_head;
   6.304 -    _collection_set_size = _inc_cset_size;
   6.305 -    _collection_set_bytes_used_before = _inc_cset_bytes_used_before;
   6.306 -
   6.307 -    // For young regions in the collection set, we assume the worst
   6.308 -    // case of complete survival
   6.309 -    max_live_bytes -= _inc_cset_size * HeapRegion::GrainBytes;
   6.310 -
   6.311 -    time_remaining_ms -= _inc_cset_predicted_elapsed_time_ms;
   6.312 -    predicted_pause_time_ms += _inc_cset_predicted_elapsed_time_ms;
   6.313 -
   6.314 -    // The number of recorded young regions is the incremental
   6.315 -    // collection set's current size
   6.316 -    set_recorded_young_regions(_inc_cset_size);
   6.317 -    set_recorded_rs_lengths(_inc_cset_recorded_rs_lengths);
   6.318 -    set_recorded_young_bytes(_inc_cset_recorded_young_bytes);
   6.319 +  double young_start_time_sec = os::elapsedTime();
   6.320 +
   6.321 +  if (G1PolicyVerbose > 0) {
   6.322 +    gclog_or_tty->print_cr("Adding %d young regions to the CSet",
   6.323 +      _g1->young_list()->length());
   6.324 +  }
   6.325 +
   6.326 +  _young_cset_length  = 0;
   6.327 +  _last_young_gc_full = full_young_gcs() ? true : false;
   6.328 +
   6.329 +  if (_last_young_gc_full)
   6.330 +    ++_full_young_pause_num;
   6.331 +  else
   6.332 +    ++_partial_young_pause_num;
   6.333 +
   6.334 +  // The young list is laid with the survivor regions from the previous
   6.335 +  // pause are appended to the RHS of the young list, i.e.
   6.336 +  //   [Newly Young Regions ++ Survivors from last pause].
   6.337 +
   6.338 +  hr = _g1->young_list()->first_survivor_region();
   6.339 +  while (hr != NULL) {
   6.340 +    assert(hr->is_survivor(), "badly formed young list");
   6.341 +    hr->set_young();
   6.342 +    hr = hr->get_next_young_region();
   6.343 +  }
   6.344 +
   6.345 +  // Clear the fields that point to the survivor list - they are
   6.346 +  // all young now.
   6.347 +  _g1->young_list()->clear_survivors();
   6.348 +
   6.349 +  if (_g1->mark_in_progress())
   6.350 +    _g1->concurrent_mark()->register_collection_set_finger(_inc_cset_max_finger);
   6.351 +
   6.352 +  _young_cset_length = _inc_cset_young_index;
   6.353 +  _collection_set = _inc_cset_head;
   6.354 +  _collection_set_size = _inc_cset_size;
   6.355 +  _collection_set_bytes_used_before = _inc_cset_bytes_used_before;
   6.356 +
   6.357 +  // For young regions in the collection set, we assume the worst
   6.358 +  // case of complete survival
   6.359 +  max_live_bytes -= _inc_cset_size * HeapRegion::GrainBytes;
   6.360 +
   6.361 +  time_remaining_ms -= _inc_cset_predicted_elapsed_time_ms;
   6.362 +  predicted_pause_time_ms += _inc_cset_predicted_elapsed_time_ms;
   6.363 +
   6.364 +  // The number of recorded young regions is the incremental
   6.365 +  // collection set's current size
   6.366 +  set_recorded_young_regions(_inc_cset_size);
   6.367 +  set_recorded_rs_lengths(_inc_cset_recorded_rs_lengths);
   6.368 +  set_recorded_young_bytes(_inc_cset_recorded_young_bytes);
   6.369  #if PREDICTIONS_VERBOSE
   6.370 -    set_predicted_bytes_to_copy(_inc_cset_predicted_bytes_to_copy);
   6.371 +  set_predicted_bytes_to_copy(_inc_cset_predicted_bytes_to_copy);
   6.372  #endif // PREDICTIONS_VERBOSE
   6.373  
   6.374 -    if (G1PolicyVerbose > 0) {
   6.375 -      gclog_or_tty->print_cr("  Added " PTR_FORMAT " Young Regions to CS.",
   6.376 -                             _inc_cset_size);
   6.377 -      gclog_or_tty->print_cr("    (" SIZE_FORMAT " KB left in heap.)",
   6.378 -                            max_live_bytes/K);
   6.379 -    }
   6.380 -
   6.381 -    assert(_inc_cset_size == _g1->young_list()->length(), "Invariant");
   6.382 -
   6.383 -    double young_end_time_sec = os::elapsedTime();
   6.384 -    _recorded_young_cset_choice_time_ms =
   6.385 -      (young_end_time_sec - young_start_time_sec) * 1000.0;
   6.386 -
   6.387 -    // We are doing young collections so reset this.
   6.388 -    non_young_start_time_sec = young_end_time_sec;
   6.389 -
   6.390 -    // Note we can use either _collection_set_size or
   6.391 -    // _young_cset_length here
   6.392 -    if (_collection_set_size > 0 && _last_young_gc_full) {
   6.393 -      // don't bother adding more regions...
   6.394 -      goto choose_collection_set_end;
   6.395 -    }
   6.396 +  if (G1PolicyVerbose > 0) {
   6.397 +    gclog_or_tty->print_cr("  Added " PTR_FORMAT " Young Regions to CS.",
   6.398 +      _inc_cset_size);
   6.399 +    gclog_or_tty->print_cr("    (" SIZE_FORMAT " KB left in heap.)",
   6.400 +      max_live_bytes/K);
   6.401    }
   6.402  
   6.403 -  if (!in_young_gc_mode() || !full_young_gcs()) {
   6.404 +  assert(_inc_cset_size == _g1->young_list()->length(), "Invariant");
   6.405 +
   6.406 +  double young_end_time_sec = os::elapsedTime();
   6.407 +  _recorded_young_cset_choice_time_ms =
   6.408 +    (young_end_time_sec - young_start_time_sec) * 1000.0;
   6.409 +
   6.410 +  // We are doing young collections so reset this.
   6.411 +  non_young_start_time_sec = young_end_time_sec;
   6.412 +
   6.413 +  if (!full_young_gcs()) {
   6.414      bool should_continue = true;
   6.415      NumberSeq seq;
   6.416      double avg_prediction = 100000000000000000.0; // something very large
   6.417 @@ -2960,7 +2908,6 @@
   6.418        _should_revert_to_full_young_gcs  = true;
   6.419    }
   6.420  
   6.421 -choose_collection_set_end:
   6.422    stop_incremental_cset_building();
   6.423  
   6.424    count_CS_bytes_used();
     7.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Fri Aug 19 14:22:25 2011 -0700
     7.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Fri Aug 19 09:30:59 2011 +0200
     7.3 @@ -141,7 +141,6 @@
     7.4  
     7.5    TruncatedSeq* _recent_rs_sizes;
     7.6  
     7.7 -  TruncatedSeq* _concurrent_mark_init_times_ms;
     7.8    TruncatedSeq* _concurrent_mark_remark_times_ms;
     7.9    TruncatedSeq* _concurrent_mark_cleanup_times_ms;
    7.10  
    7.11 @@ -178,9 +177,6 @@
    7.12    double* _par_last_gc_worker_end_times_ms;
    7.13    double* _par_last_gc_worker_times_ms;
    7.14  
    7.15 -  // indicates that we are in young GC mode
    7.16 -  bool _in_young_gc_mode;
    7.17 -
    7.18    // indicates whether we are in full young or partially young GC mode
    7.19    bool _full_young_gcs;
    7.20  
    7.21 @@ -527,10 +523,6 @@
    7.22      return _mmu_tracker->max_gc_time() * 1000.0;
    7.23    }
    7.24  
    7.25 -  double predict_init_time_ms() {
    7.26 -    return get_new_prediction(_concurrent_mark_init_times_ms);
    7.27 -  }
    7.28 -
    7.29    double predict_remark_time_ms() {
    7.30      return get_new_prediction(_concurrent_mark_remark_times_ms);
    7.31    }
    7.32 @@ -776,7 +768,6 @@
    7.33    // This set of variables tracks the collector efficiency, in order to
    7.34    // determine whether we should initiate a new marking.
    7.35    double _cur_mark_stop_world_time_ms;
    7.36 -  double _mark_init_start_sec;
    7.37    double _mark_remark_start_sec;
    7.38    double _mark_cleanup_start_sec;
    7.39    double _mark_closure_time_ms;
    7.40 @@ -849,9 +840,7 @@
    7.41                                               size_t start_used);
    7.42  
    7.43    // Must currently be called while the world is stopped.
    7.44 -  virtual void record_concurrent_mark_init_start();
    7.45 -  virtual void record_concurrent_mark_init_end();
    7.46 -  void record_concurrent_mark_init_end_pre(double
    7.47 +  void record_concurrent_mark_init_end(double
    7.48                                             mark_init_elapsed_time_ms);
    7.49  
    7.50    void record_mark_closure_time(double mark_closure_time_ms);
    7.51 @@ -1118,13 +1107,6 @@
    7.52  
    7.53    void update_region_num(bool young);
    7.54  
    7.55 -  bool in_young_gc_mode() {
    7.56 -    return _in_young_gc_mode;
    7.57 -  }
    7.58 -  void set_in_young_gc_mode(bool in_young_gc_mode) {
    7.59 -    _in_young_gc_mode = in_young_gc_mode;
    7.60 -  }
    7.61 -
    7.62    bool full_young_gcs() {
    7.63      return _full_young_gcs;
    7.64    }
     8.1 --- a/src/share/vm/gc_implementation/g1/g1_globals.hpp	Fri Aug 19 14:22:25 2011 -0700
     8.2 +++ b/src/share/vm/gc_implementation/g1/g1_globals.hpp	Fri Aug 19 09:30:59 2011 +0200
     8.3 @@ -39,8 +39,6 @@
     8.4    develop(intx, G1MarkingOverheadPercent, 0,                                \
     8.5            "Overhead of concurrent marking")                                 \
     8.6                                                                              \
     8.7 -  develop(bool, G1Gen, true,                                                \
     8.8 -          "If true, it will enable the generational G1")                    \
     8.9                                                                              \
    8.10    develop(intx, G1PolicyVerbose, 0,                                         \
    8.11            "The verbosity level on G1 policy decisions")                     \

mercurial