< prev index next >

hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp

Print this page
rev 6911 : 8065305: Make it possible to extend the G1CollectorPolicy
Summary: Added a G1CollectorPolicyExt where it is possible to extend the class.
Reviewed-by: sjohanss, tschatzl


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
  27 
  28 #include "gc_implementation/g1/collectionSetChooser.hpp"

  29 #include "gc_implementation/g1/g1MMUTracker.hpp"
  30 #include "memory/collectorPolicy.hpp"
  31 
  32 // A G1CollectorPolicy makes policy decisions that determine the
  33 // characteristics of the collector.  Examples include:
  34 //   * choice of collection set.
  35 //   * when to collect.
  36 
  37 class HeapRegion;
  38 class CollectionSetChooser;
  39 class G1GCPhaseTimes;
  40 
  41 // TraceGen0Time collects data on _both_ young and mixed evacuation pauses
  42 // (the latter may contain non-young regions - i.e. regions that are
  43 // technically in Gen1) while TraceGen1Time collects data about full GCs.
  44 class TraceGen0TimeData : public CHeapObj<mtGC> {
  45  private:
  46   unsigned  _young_pause_num;
  47   unsigned  _mixed_pause_num;
  48 


 786   bool during_initial_mark_pause()      { return _during_initial_mark_pause;  }
 787   void set_during_initial_mark_pause()  { _during_initial_mark_pause = true;  }
 788   void clear_during_initial_mark_pause(){ _during_initial_mark_pause = false; }
 789 
 790   // This sets the initiate_conc_mark_if_possible() flag to start a
 791   // new cycle, as long as we are not already in one. It's best if it
 792   // is called during a safepoint when the test whether a cycle is in
 793   // progress or not is stable.
 794   bool force_initial_mark_if_outside_cycle(GCCause::Cause gc_cause);
 795 
 796   // This is called at the very beginning of an evacuation pause (it
 797   // has to be the first thing that the pause does). If
 798   // initiate_conc_mark_if_possible() is true, and the concurrent
 799   // marking thread has completed its work during the previous cycle,
 800   // it will set during_initial_mark_pause() to so that the pause does
 801   // the initial-mark work and start a marking cycle.
 802   void decide_on_conc_mark_initiation();
 803 
 804   // If an expansion would be appropriate, because recent GC overhead had
 805   // exceeded the desired limit, return an amount to expand by.
 806   size_t expansion_amount();
 807 
 808   // Print tracing information.
 809   void print_tracing_info() const;
 810 
 811   // Print stats on young survival ratio
 812   void print_yg_surv_rate_info() const;
 813 
 814   void finished_recalculating_age_indexes(bool is_survivors) {
 815     if (is_survivors) {
 816       _survivor_surv_rate_group->finished_recalculating_age_indexes();
 817     } else {
 818       _short_lived_surv_rate_group->finished_recalculating_age_indexes();
 819     }
 820     // do that for any other surv rate groups
 821   }
 822 
 823   size_t young_list_target_length() const { return _young_list_target_length; }
 824 
 825   bool is_young_list_full() {
 826     uint young_list_length = _g1->young_list()->length();
 827     uint young_list_target_length = _young_list_target_length;
 828     return young_list_length >= young_list_target_length;
 829   }
 830 
 831   bool can_expand_young_list() {
 832     uint young_list_length = _g1->young_list()->length();
 833     uint young_list_max_length = _young_list_max_length;
 834     return young_list_length < young_list_max_length;
 835   }
 836 
 837   uint young_list_max_length() {
 838     return _young_list_max_length;
 839   }
 840 
 841   bool gcs_are_young() {
 842     return _gcs_are_young;
 843   }
 844   void set_gcs_are_young(bool gcs_are_young) {
 845     _gcs_are_young = gcs_are_young;
 846   }
 847 
 848   bool adaptive_young_list_length() {
 849     return _young_gen_sizer->adaptive_young_list_length();
 850   }
 851 
 852 private:
 853   //
 854   // Survivor regions policy.
 855   //




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
  27 
  28 #include "gc_implementation/g1/collectionSetChooser.hpp"
  29 #include "gc_implementation/g1/g1Allocator.hpp"
  30 #include "gc_implementation/g1/g1MMUTracker.hpp"
  31 #include "memory/collectorPolicy.hpp"
  32 
  33 // A G1CollectorPolicy makes policy decisions that determine the
  34 // characteristics of the collector.  Examples include:
  35 //   * choice of collection set.
  36 //   * when to collect.
  37 
  38 class HeapRegion;
  39 class CollectionSetChooser;
  40 class G1GCPhaseTimes;
  41 
  42 // TraceGen0Time collects data on _both_ young and mixed evacuation pauses
  43 // (the latter may contain non-young regions - i.e. regions that are
  44 // technically in Gen1) while TraceGen1Time collects data about full GCs.
  45 class TraceGen0TimeData : public CHeapObj<mtGC> {
  46  private:
  47   unsigned  _young_pause_num;
  48   unsigned  _mixed_pause_num;
  49 


 787   bool during_initial_mark_pause()      { return _during_initial_mark_pause;  }
 788   void set_during_initial_mark_pause()  { _during_initial_mark_pause = true;  }
 789   void clear_during_initial_mark_pause(){ _during_initial_mark_pause = false; }
 790 
 791   // This sets the initiate_conc_mark_if_possible() flag to start a
 792   // new cycle, as long as we are not already in one. It's best if it
 793   // is called during a safepoint when the test whether a cycle is in
 794   // progress or not is stable.
 795   bool force_initial_mark_if_outside_cycle(GCCause::Cause gc_cause);
 796 
 797   // This is called at the very beginning of an evacuation pause (it
 798   // has to be the first thing that the pause does). If
 799   // initiate_conc_mark_if_possible() is true, and the concurrent
 800   // marking thread has completed its work during the previous cycle,
 801   // it will set during_initial_mark_pause() to so that the pause does
 802   // the initial-mark work and start a marking cycle.
 803   void decide_on_conc_mark_initiation();
 804 
 805   // If an expansion would be appropriate, because recent GC overhead had
 806   // exceeded the desired limit, return an amount to expand by.
 807   virtual size_t expansion_amount();
 808 
 809   // Print tracing information.
 810   void print_tracing_info() const;
 811 
 812   // Print stats on young survival ratio
 813   void print_yg_surv_rate_info() const;
 814 
 815   void finished_recalculating_age_indexes(bool is_survivors) {
 816     if (is_survivors) {
 817       _survivor_surv_rate_group->finished_recalculating_age_indexes();
 818     } else {
 819       _short_lived_surv_rate_group->finished_recalculating_age_indexes();
 820     }
 821     // do that for any other surv rate groups
 822   }
 823 
 824   size_t young_list_target_length() const { return _young_list_target_length; }
 825 
 826   bool is_young_list_full();




 827 
 828   bool can_expand_young_list();




 829 
 830   uint young_list_max_length() {
 831     return _young_list_max_length;
 832   }
 833 
 834   bool gcs_are_young() {
 835     return _gcs_are_young;
 836   }
 837   void set_gcs_are_young(bool gcs_are_young) {
 838     _gcs_are_young = gcs_are_young;
 839   }
 840 
 841   bool adaptive_young_list_length() {
 842     return _young_gen_sizer->adaptive_young_list_length();
 843   }
 844 
 845 private:
 846   //
 847   // Survivor regions policy.
 848   //


< prev index next >