Print this page
rev 2896 : 6484965: G1: piggy-back liveness accounting phase on marking
Summary: Remove the separate counting phase of concurrent marking by tracking the amount of marked bytes and the cards spanned by marked objects in marking task/worker thread local data structures, which are updated as individual objects are marked.
Reviewed-by: brutisso

Split Close
Expand all
Collapse all
          --- old/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
          +++ new/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
↓ open down ↓ 36 lines elided ↑ open up ↑
  37   37  
  38   38  SurrogateLockerThread*
  39   39       ConcurrentMarkThread::_slt = NULL;
  40   40  
  41   41  ConcurrentMarkThread::ConcurrentMarkThread(ConcurrentMark* cm) :
  42   42    ConcurrentGCThread(),
  43   43    _cm(cm),
  44   44    _started(false),
  45   45    _in_progress(false),
  46   46    _vtime_accum(0.0),
  47      -  _vtime_mark_accum(0.0),
  48      -  _vtime_count_accum(0.0)
       47 +  _vtime_mark_accum(0.0)
  49   48  {
  50   49    create_and_start();
  51   50  }
  52   51  
  53   52  class CMCheckpointRootsFinalClosure: public VoidClosure {
  54   53  
  55   54    ConcurrentMark* _cm;
  56   55  public:
  57   56  
  58   57    CMCheckpointRootsFinalClosure(ConcurrentMark* cm) :
↓ open down ↓ 82 lines elided ↑ open up ↑
 141  140  
 142  141          if (cm()->restart_for_overflow()) {
 143  142            if (PrintGC) {
 144  143              gclog_or_tty->date_stamp(PrintGCDateStamps);
 145  144              gclog_or_tty->stamp(PrintGCTimeStamps);
 146  145              gclog_or_tty->print_cr("[GC concurrent-mark-restart-for-overflow]");
 147  146            }
 148  147          }
 149  148        } while (cm()->restart_for_overflow());
 150  149  
 151      -      double counting_start_time = os::elapsedVTime();
 152      -      if (!cm()->has_aborted()) {
 153      -        double count_start_sec = os::elapsedTime();
 154      -        if (PrintGC) {
 155      -          gclog_or_tty->date_stamp(PrintGCDateStamps);
 156      -          gclog_or_tty->stamp(PrintGCTimeStamps);
 157      -          gclog_or_tty->print_cr("[GC concurrent-count-start]");
 158      -        }
 159      -
 160      -        _sts.join();
 161      -        _cm->calcDesiredRegions();
 162      -        _sts.leave();
 163      -
 164      -        if (!cm()->has_aborted()) {
 165      -          double count_end_sec = os::elapsedTime();
 166      -          if (PrintGC) {
 167      -            gclog_or_tty->date_stamp(PrintGCDateStamps);
 168      -            gclog_or_tty->stamp(PrintGCTimeStamps);
 169      -            gclog_or_tty->print_cr("[GC concurrent-count-end, %1.7lf]",
 170      -                                   count_end_sec - count_start_sec);
 171      -          }
 172      -        }
 173      -      }
 174      -
 175  150        double end_time = os::elapsedVTime();
 176      -      _vtime_count_accum += (end_time - counting_start_time);
 177  151        // Update the total virtual time before doing this, since it will try
 178  152        // to measure it to get the vtime for this marking.  We purposely
 179  153        // neglect the presumably-short "completeCleanup" phase here.
 180  154        _vtime_accum = (end_time - _vtime_start);
      155 +
 181  156        if (!cm()->has_aborted()) {
 182  157          if (g1_policy->adaptive_young_list_length()) {
 183  158            double now = os::elapsedTime();
 184  159            double cleanup_prediction_ms = g1_policy->predict_cleanup_time_ms();
 185  160            jlong sleep_time_ms = mmu_tracker->when_ms(now, cleanup_prediction_ms);
 186  161            os::sleep(current_thread, sleep_time_ms, false);
 187  162          }
 188  163  
 189  164          CMCleanUp cl_cl(_cm);
 190  165          sprintf(verbose_str, "GC cleanup");
↓ open down ↓ 160 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX