< prev index next >

src/hotspot/share/gc/g1/g1Policy.hpp

Print this page




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_GC_G1_G1POLICY_HPP
  26 #define SHARE_GC_G1_G1POLICY_HPP
  27 
  28 #include "gc/g1/g1CollectorState.hpp"
  29 #include "gc/g1/g1GCPhaseTimes.hpp"
  30 #include "gc/g1/g1HeapRegionAttr.hpp"
  31 #include "gc/g1/g1InitialMarkToMixedTimeTracker.hpp"
  32 #include "gc/g1/g1MMUTracker.hpp"

  33 #include "gc/g1/g1RemSetTrackingPolicy.hpp"
  34 #include "gc/g1/g1Predictions.hpp"
  35 #include "gc/g1/g1YoungGenSizer.hpp"
  36 #include "gc/shared/gcCause.hpp"
  37 #include "utilities/pair.hpp"
  38 
  39 // A G1Policy makes policy decisions that determine the
  40 // characteristics of the collector.  Examples include:
  41 //   * choice of collection set.
  42 //   * when to collect.
  43 
  44 class HeapRegion;
  45 class G1CollectionSet;
  46 class G1CollectionSetCandidates;
  47 class G1CollectionSetChooser;
  48 class G1IHOPControl;
  49 class G1Analytics;
  50 class G1SurvivorRegions;
  51 class G1YoungGenSizer;
  52 class GCPolicyCounters;


  85   // The survivor rate groups below must be initialized after the predictor because they
  86   // indirectly use it through the "this" object passed to their constructor.
  87   G1SurvRateGroup* _eden_surv_rate_group;
  88   G1SurvRateGroup* _survivor_surv_rate_group;
  89 
  90   double _reserve_factor;
  91   // This will be set when the heap is expanded
  92   // for the first time during initialization.
  93   uint   _reserve_regions;
  94 
  95   G1YoungGenSizer* _young_gen_sizer;
  96 
  97   uint _free_regions_at_end_of_collection;
  98 
  99   size_t _rs_length;
 100 
 101   size_t _rs_length_prediction;
 102 
 103   size_t _pending_cards_at_gc_start;
 104 
 105   // The amount of allocated bytes in old gen during the last mutator and the following
 106   // young GC phase.
 107   size_t _bytes_allocated_in_old_since_last_gc;
 108 
 109   G1InitialMarkToMixedTimeTracker _initial_mark_to_mixed;
 110 
 111   bool should_update_surv_rate_group_predictors() {
 112     return collector_state()->in_young_only_phase() && !collector_state()->mark_or_rebuild_in_progress();
 113   }
 114 
 115   double logged_cards_processing_time() const;
 116 public:
 117   const G1Predictions& predictor() const { return _predictor; }
 118   const G1Analytics* analytics()   const { return const_cast<const G1Analytics*>(_analytics); }
 119 
 120   G1RemSetTrackingPolicy* remset_tracker() { return &_remset_tracker; }
 121 
 122   // Add the given number of bytes to the total number of allocated bytes in the old gen.
 123   void add_bytes_allocated_in_old_since_last_gc(size_t bytes) { _bytes_allocated_in_old_since_last_gc += bytes; }
 124 
 125   void set_region_eden(HeapRegion* hr) {
 126     hr->set_eden();
 127     hr->install_surv_rate_group(_eden_surv_rate_group);
 128   }
 129 
 130   void set_region_survivor(HeapRegion* hr) {
 131     assert(hr->is_survivor(), "pre-condition");
 132     hr->install_surv_rate_group(_survivor_surv_rate_group);
 133   }
 134 
 135   void record_rs_length(size_t rs_length) {
 136     _rs_length = rs_length;
 137   }
 138 
 139   double predict_base_elapsed_time_ms(size_t num_pending_cards) const;
 140 
 141 private:
 142   double predict_base_elapsed_time_ms(size_t num_pending_cards, size_t rs_length) const;
 143 




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_GC_G1_G1POLICY_HPP
  26 #define SHARE_GC_G1_G1POLICY_HPP
  27 
  28 #include "gc/g1/g1CollectorState.hpp"
  29 #include "gc/g1/g1GCPhaseTimes.hpp"
  30 #include "gc/g1/g1HeapRegionAttr.hpp"
  31 #include "gc/g1/g1InitialMarkToMixedTimeTracker.hpp"
  32 #include "gc/g1/g1MMUTracker.hpp"
  33 #include "gc/g1/g1OldGenAllocationTracker.hpp"
  34 #include "gc/g1/g1RemSetTrackingPolicy.hpp"
  35 #include "gc/g1/g1Predictions.hpp"
  36 #include "gc/g1/g1YoungGenSizer.hpp"
  37 #include "gc/shared/gcCause.hpp"
  38 #include "utilities/pair.hpp"
  39 
  40 // A G1Policy makes policy decisions that determine the
  41 // characteristics of the collector.  Examples include:
  42 //   * choice of collection set.
  43 //   * when to collect.
  44 
  45 class HeapRegion;
  46 class G1CollectionSet;
  47 class G1CollectionSetCandidates;
  48 class G1CollectionSetChooser;
  49 class G1IHOPControl;
  50 class G1Analytics;
  51 class G1SurvivorRegions;
  52 class G1YoungGenSizer;
  53 class GCPolicyCounters;


  86   // The survivor rate groups below must be initialized after the predictor because they
  87   // indirectly use it through the "this" object passed to their constructor.
  88   G1SurvRateGroup* _eden_surv_rate_group;
  89   G1SurvRateGroup* _survivor_surv_rate_group;
  90 
  91   double _reserve_factor;
  92   // This will be set when the heap is expanded
  93   // for the first time during initialization.
  94   uint   _reserve_regions;
  95 
  96   G1YoungGenSizer* _young_gen_sizer;
  97 
  98   uint _free_regions_at_end_of_collection;
  99 
 100   size_t _rs_length;
 101 
 102   size_t _rs_length_prediction;
 103 
 104   size_t _pending_cards_at_gc_start;
 105 
 106   // Tracking the allocation in the old generation between
 107   // two GCs.
 108   G1OldGenAllocationTracker* _old_gen_alloc_tracker;
 109 
 110   G1InitialMarkToMixedTimeTracker _initial_mark_to_mixed;
 111 
 112   bool should_update_surv_rate_group_predictors() {
 113     return collector_state()->in_young_only_phase() && !collector_state()->mark_or_rebuild_in_progress();
 114   }
 115 
 116   double logged_cards_processing_time() const;
 117 public:
 118   const G1Predictions& predictor() const { return _predictor; }
 119   const G1Analytics* analytics()   const { return const_cast<const G1Analytics*>(_analytics); }
 120 
 121   G1RemSetTrackingPolicy* remset_tracker() { return &_remset_tracker; }
 122 
 123   G1OldGenAllocationTracker* old_gen_alloc_tracker() { return _old_gen_alloc_tracker; }

 124 
 125   void set_region_eden(HeapRegion* hr) {
 126     hr->set_eden();
 127     hr->install_surv_rate_group(_eden_surv_rate_group);
 128   }
 129 
 130   void set_region_survivor(HeapRegion* hr) {
 131     assert(hr->is_survivor(), "pre-condition");
 132     hr->install_surv_rate_group(_survivor_surv_rate_group);
 133   }
 134 
 135   void record_rs_length(size_t rs_length) {
 136     _rs_length = rs_length;
 137   }
 138 
 139   double predict_base_elapsed_time_ms(size_t num_pending_cards) const;
 140 
 141 private:
 142   double predict_base_elapsed_time_ms(size_t num_pending_cards, size_t rs_length) const;
 143 


< prev index next >