< prev index next >

src/share/vm/gc/g1/g1CollectorPolicy.cpp

Print this page




 110 
 111   _recent_prev_end_times_for_all_gcs_sec(
 112                                 new TruncatedSeq(NumPrevPausesForHeuristics)),
 113 
 114   _recent_avg_pause_time_ratio(0.0),
 115   _rs_lengths_prediction(0),
 116   _max_survivor_regions(0),
 117 
 118   _eden_cset_region_length(0),
 119   _survivor_cset_region_length(0),
 120   _old_cset_region_length(0),
 121 
 122   _collection_set(NULL),
 123   _collection_set_bytes_used_before(0),
 124 
 125   // Incremental CSet attributes
 126   _inc_cset_build_state(Inactive),
 127   _inc_cset_head(NULL),
 128   _inc_cset_tail(NULL),
 129   _inc_cset_bytes_used_before(0),
 130   _inc_cset_max_finger(NULL),
 131   _inc_cset_recorded_rs_lengths(0),
 132   _inc_cset_recorded_rs_lengths_diffs(0),
 133   _inc_cset_predicted_elapsed_time_ms(0.0),
 134   _inc_cset_predicted_elapsed_time_ms_diffs(0.0),
 135 
 136   // add here any more surv rate groups
 137   _recorded_survivor_regions(0),
 138   _recorded_survivor_head(NULL),
 139   _recorded_survivor_tail(NULL),
 140   _survivors_age_table(true),
 141 
 142   _gc_overhead_perc(0.0),
 143 
 144   _bytes_allocated_in_old_since_last_gc(0),
 145   _ihop_control(NULL),
 146   _initial_mark_to_mixed() {
 147 
 148   // SurvRateGroups below must be initialized after the predictor because they
 149   // indirectly use it through this object passed to their constructor.
 150   _short_lived_surv_rate_group =


1762   assert(hr->is_old(), "the region should be old");
1763 
1764   assert(!hr->in_collection_set(), "should not already be in the CSet");
1765   _g1->register_old_region_with_cset(hr);
1766   hr->set_next_in_collection_set(_collection_set);
1767   _collection_set = hr;
1768   _collection_set_bytes_used_before += hr->used();
1769   size_t rs_length = hr->rem_set()->occupied();
1770   _recorded_rs_lengths += rs_length;
1771   _old_cset_region_length += 1;
1772 }
1773 
1774 // Initialize the per-collection-set information
1775 void G1CollectorPolicy::start_incremental_cset_building() {
1776   assert(_inc_cset_build_state == Inactive, "Precondition");
1777 
1778   _inc_cset_head = NULL;
1779   _inc_cset_tail = NULL;
1780   _inc_cset_bytes_used_before = 0;
1781 
1782   _inc_cset_max_finger = 0;
1783   _inc_cset_recorded_rs_lengths = 0;
1784   _inc_cset_recorded_rs_lengths_diffs = 0;
1785   _inc_cset_predicted_elapsed_time_ms = 0.0;
1786   _inc_cset_predicted_elapsed_time_ms_diffs = 0.0;
1787   _inc_cset_build_state = Active;
1788 }
1789 
1790 void G1CollectorPolicy::finalize_incremental_cset_building() {
1791   assert(_inc_cset_build_state == Active, "Precondition");
1792   assert(SafepointSynchronize::is_at_safepoint(), "should be at a safepoint");
1793 
1794   // The two "main" fields, _inc_cset_recorded_rs_lengths and
1795   // _inc_cset_predicted_elapsed_time_ms, are updated by the thread
1796   // that adds a new region to the CSet. Further updates by the
1797   // concurrent refinement thread that samples the young RSet lengths
1798   // are accumulated in the *_diffs fields. Here we add the diffs to
1799   // the "main" fields.
1800 
1801   if (_inc_cset_recorded_rs_lengths_diffs >= 0) {
1802     _inc_cset_recorded_rs_lengths += _inc_cset_recorded_rs_lengths_diffs;


1873   _inc_cset_predicted_elapsed_time_ms_diffs += elapsed_ms_diff;
1874 
1875   hr->set_recorded_rs_length(new_rs_length);
1876   hr->set_predicted_elapsed_time_ms(new_region_elapsed_time_ms);
1877 }
1878 
1879 void G1CollectorPolicy::add_region_to_incremental_cset_common(HeapRegion* hr) {
1880   assert(hr->is_young(), "invariant");
1881   assert(hr->young_index_in_cset() > -1, "should have already been set");
1882   assert(_inc_cset_build_state == Active, "Precondition");
1883 
1884   // We need to clear and set the cached recorded/cached collection set
1885   // information in the heap region here (before the region gets added
1886   // to the collection set). An individual heap region's cached values
1887   // are calculated, aggregated with the policy collection set info,
1888   // and cached in the heap region here (initially) and (subsequently)
1889   // by the Young List sampling code.
1890 
1891   size_t rs_length = hr->rem_set()->occupied();
1892   add_to_incremental_cset_info(hr, rs_length);
1893 
1894   HeapWord* hr_end = hr->end();
1895   _inc_cset_max_finger = MAX2(_inc_cset_max_finger, hr_end);
1896 
1897   assert(!hr->in_collection_set(), "invariant");
1898   _g1->register_young_region_with_cset(hr);
1899   assert(hr->next_in_collection_set() == NULL, "invariant");
1900 }
1901 
1902 // Add the region at the RHS of the incremental cset
1903 void G1CollectorPolicy::add_region_to_incremental_cset_rhs(HeapRegion* hr) {
1904   // We should only ever be appending survivors at the end of a pause
1905   assert(hr->is_survivor(), "Logic");
1906 
1907   // Do the 'common' stuff
1908   add_region_to_incremental_cset_common(hr);
1909 
1910   // Now add the region at the right hand side
1911   if (_inc_cset_tail == NULL) {
1912     assert(_inc_cset_head == NULL, "invariant");
1913     _inc_cset_head = hr;
1914   } else {
1915     _inc_cset_tail->set_next_in_collection_set(hr);




 110 
 111   _recent_prev_end_times_for_all_gcs_sec(
 112                                 new TruncatedSeq(NumPrevPausesForHeuristics)),
 113 
 114   _recent_avg_pause_time_ratio(0.0),
 115   _rs_lengths_prediction(0),
 116   _max_survivor_regions(0),
 117 
 118   _eden_cset_region_length(0),
 119   _survivor_cset_region_length(0),
 120   _old_cset_region_length(0),
 121 
 122   _collection_set(NULL),
 123   _collection_set_bytes_used_before(0),
 124 
 125   // Incremental CSet attributes
 126   _inc_cset_build_state(Inactive),
 127   _inc_cset_head(NULL),
 128   _inc_cset_tail(NULL),
 129   _inc_cset_bytes_used_before(0),

 130   _inc_cset_recorded_rs_lengths(0),
 131   _inc_cset_recorded_rs_lengths_diffs(0),
 132   _inc_cset_predicted_elapsed_time_ms(0.0),
 133   _inc_cset_predicted_elapsed_time_ms_diffs(0.0),
 134 
 135   // add here any more surv rate groups
 136   _recorded_survivor_regions(0),
 137   _recorded_survivor_head(NULL),
 138   _recorded_survivor_tail(NULL),
 139   _survivors_age_table(true),
 140 
 141   _gc_overhead_perc(0.0),
 142 
 143   _bytes_allocated_in_old_since_last_gc(0),
 144   _ihop_control(NULL),
 145   _initial_mark_to_mixed() {
 146 
 147   // SurvRateGroups below must be initialized after the predictor because they
 148   // indirectly use it through this object passed to their constructor.
 149   _short_lived_surv_rate_group =


1761   assert(hr->is_old(), "the region should be old");
1762 
1763   assert(!hr->in_collection_set(), "should not already be in the CSet");
1764   _g1->register_old_region_with_cset(hr);
1765   hr->set_next_in_collection_set(_collection_set);
1766   _collection_set = hr;
1767   _collection_set_bytes_used_before += hr->used();
1768   size_t rs_length = hr->rem_set()->occupied();
1769   _recorded_rs_lengths += rs_length;
1770   _old_cset_region_length += 1;
1771 }
1772 
1773 // Initialize the per-collection-set information
1774 void G1CollectorPolicy::start_incremental_cset_building() {
1775   assert(_inc_cset_build_state == Inactive, "Precondition");
1776 
1777   _inc_cset_head = NULL;
1778   _inc_cset_tail = NULL;
1779   _inc_cset_bytes_used_before = 0;
1780 

1781   _inc_cset_recorded_rs_lengths = 0;
1782   _inc_cset_recorded_rs_lengths_diffs = 0;
1783   _inc_cset_predicted_elapsed_time_ms = 0.0;
1784   _inc_cset_predicted_elapsed_time_ms_diffs = 0.0;
1785   _inc_cset_build_state = Active;
1786 }
1787 
1788 void G1CollectorPolicy::finalize_incremental_cset_building() {
1789   assert(_inc_cset_build_state == Active, "Precondition");
1790   assert(SafepointSynchronize::is_at_safepoint(), "should be at a safepoint");
1791 
1792   // The two "main" fields, _inc_cset_recorded_rs_lengths and
1793   // _inc_cset_predicted_elapsed_time_ms, are updated by the thread
1794   // that adds a new region to the CSet. Further updates by the
1795   // concurrent refinement thread that samples the young RSet lengths
1796   // are accumulated in the *_diffs fields. Here we add the diffs to
1797   // the "main" fields.
1798 
1799   if (_inc_cset_recorded_rs_lengths_diffs >= 0) {
1800     _inc_cset_recorded_rs_lengths += _inc_cset_recorded_rs_lengths_diffs;


1871   _inc_cset_predicted_elapsed_time_ms_diffs += elapsed_ms_diff;
1872 
1873   hr->set_recorded_rs_length(new_rs_length);
1874   hr->set_predicted_elapsed_time_ms(new_region_elapsed_time_ms);
1875 }
1876 
1877 void G1CollectorPolicy::add_region_to_incremental_cset_common(HeapRegion* hr) {
1878   assert(hr->is_young(), "invariant");
1879   assert(hr->young_index_in_cset() > -1, "should have already been set");
1880   assert(_inc_cset_build_state == Active, "Precondition");
1881 
1882   // We need to clear and set the cached recorded/cached collection set
1883   // information in the heap region here (before the region gets added
1884   // to the collection set). An individual heap region's cached values
1885   // are calculated, aggregated with the policy collection set info,
1886   // and cached in the heap region here (initially) and (subsequently)
1887   // by the Young List sampling code.
1888 
1889   size_t rs_length = hr->rem_set()->occupied();
1890   add_to_incremental_cset_info(hr, rs_length);



1891 
1892   assert(!hr->in_collection_set(), "invariant");
1893   _g1->register_young_region_with_cset(hr);
1894   assert(hr->next_in_collection_set() == NULL, "invariant");
1895 }
1896 
1897 // Add the region at the RHS of the incremental cset
1898 void G1CollectorPolicy::add_region_to_incremental_cset_rhs(HeapRegion* hr) {
1899   // We should only ever be appending survivors at the end of a pause
1900   assert(hr->is_survivor(), "Logic");
1901 
1902   // Do the 'common' stuff
1903   add_region_to_incremental_cset_common(hr);
1904 
1905   // Now add the region at the right hand side
1906   if (_inc_cset_tail == NULL) {
1907     assert(_inc_cset_head == NULL, "invariant");
1908     _inc_cset_head = hr;
1909   } else {
1910     _inc_cset_tail->set_next_in_collection_set(hr);


< prev index next >