--- old/src/hotspot/share/gc/g1/g1Policy.hpp 2019-03-13 14:03:12.000325895 +0100 +++ new/src/hotspot/share/gc/g1/g1Policy.hpp 2019-03-13 14:03:11.789320165 +0100 @@ -44,6 +44,7 @@ class HeapRegion; class G1CollectionSet; +class G1CollectionSetCandidates; class G1CollectionSetChooser; class G1IHOPControl; class G1Analytics; @@ -344,7 +345,24 @@ bool next_gc_should_be_mixed(const char* true_action_str, const char* false_action_str) const; - uint finalize_collection_set(double target_pause_time_ms, G1SurvivorRegions* survivor); + // Select and return the number of initial and optional old gen regions from + // the given collection set candidates and the remaining time. Num_expensive_regions + // returns the number of regions taken within the initial region count because of + // the minimum old gen region requirement. + void select_old_collection_set_regions(G1CollectionSetCandidates* candidates, + double time_remaining_ms, + uint& num_expensive_regions, + uint& num_initial_regions, + uint& num_optional_regions); + + // Select the number of optional regions from the given collection set candidates, + // the remaining time and the maximum number of these regions and return in + // num_optional_regions. + void select_optional_collection_set_regions(G1CollectionSetCandidates* candidates, + uint const max_optional_regions, + double time_remaining_ms, + uint& num_optional_regions); + private: // Set the state to start a concurrent marking cycle and clear // _initiate_conc_mark_if_possible because it has now been @@ -403,11 +421,13 @@ AgeTable _survivors_age_table; size_t desired_survivor_size(uint max_regions) const; -public: + // Fraction used when predicting how many optional regions to include in // the CSet. This fraction of the available time is used for optional regions, // the rest is used to add old regions to the normal CSet. double optional_prediction_fraction() { return 0.2; } + +public: // Fraction used when evacuating the optional regions. This fraction of the // remaining time is used to choose what regions to include in the evacuation. double optional_evacuation_fraction() { return 0.75; }