src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp

changeset 777
37f87013dfd8
child 1229
315a5d70b295
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp	Thu Jun 05 15:57:56 2008 -0700
     1.3 @@ -0,0 +1,104 @@
     1.4 +/*
     1.5 + * Copyright 2001-2007 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.24 + * have any questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +// Forward Decl.
    1.29 +class ConcurrentG1Refine;
    1.30 +
    1.31 +// The G1 Concurrent Refinement Thread (could be several in the future).
    1.32 +
    1.33 +class ConcurrentG1RefineThread: public ConcurrentGCThread {
    1.34 +  friend class VMStructs;
    1.35 +  friend class G1CollectedHeap;
    1.36 +
    1.37 +  double _vtime_start;  // Initial virtual time.
    1.38 +  double _vtime_accum;  // Initial virtual time.
    1.39 +
    1.40 + public:
    1.41 +  virtual void run();
    1.42 +
    1.43 + private:
    1.44 +  ConcurrentG1Refine*              _cg1r;
    1.45 +  bool                             _started;
    1.46 +  bool                             _in_progress;
    1.47 +  volatile bool                    _restart;
    1.48 +
    1.49 +  COTracker                        _co_tracker;
    1.50 +  double                           _interval_ms;
    1.51 +
    1.52 +  bool                             _do_traversal;
    1.53 +
    1.54 +  void decreaseInterval(int processing_time_ms) {
    1.55 +    double min_interval_ms = (double) processing_time_ms;
    1.56 +    _interval_ms = 0.8 * _interval_ms;
    1.57 +    if (_interval_ms < min_interval_ms)
    1.58 +      _interval_ms = min_interval_ms;
    1.59 +  }
    1.60 +  void increaseInterval(int processing_time_ms) {
    1.61 +    double max_interval_ms = 9.0 * (double) processing_time_ms;
    1.62 +    _interval_ms = 1.1 * _interval_ms;
    1.63 +    if (max_interval_ms > 0 && _interval_ms > max_interval_ms)
    1.64 +      _interval_ms = max_interval_ms;
    1.65 +  }
    1.66 +
    1.67 +  void sleepBeforeNextCycle();
    1.68 +
    1.69 +  void traversalBasedRefinement();
    1.70 +
    1.71 +  void queueBasedRefinement();
    1.72 +
    1.73 +  // For use by G1CollectedHeap, which is a friend.
    1.74 +  static SuspendibleThreadSet* sts() { return &_sts; }
    1.75 +
    1.76 + public:
    1.77 +  // Constructor
    1.78 +  ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r);
    1.79 +
    1.80 +  // Printing
    1.81 +  void print();
    1.82 +
    1.83 +  // Total virtual time so far.
    1.84 +  double vtime_accum() { return _vtime_accum; }
    1.85 +
    1.86 +  ConcurrentG1Refine* cg1r()                     { return _cg1r;     }
    1.87 +
    1.88 +
    1.89 +  void            set_started()                  { _started = true;   }
    1.90 +  void            clear_started()                { _started = false;  }
    1.91 +  bool            started()                      { return _started;   }
    1.92 +
    1.93 +  void            set_in_progress()              { _in_progress = true;   }
    1.94 +  void            clear_in_progress()            { _in_progress = false;  }
    1.95 +  bool            in_progress()                  { return _in_progress;   }
    1.96 +
    1.97 +  void            set_do_traversal(bool b);
    1.98 +  bool            do_traversal() { return _do_traversal; }
    1.99 +
   1.100 +  void            sample_young_list_rs_lengths();
   1.101 +
   1.102 +  // Yield for GC
   1.103 +  void            yield();
   1.104 +
   1.105 +  // shutdown
   1.106 +  static void stop();
   1.107 +};

mercurial