< prev index next >

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

Print this page
rev 10311 : 8151178 Move the collection set out of the G1 collector policy
Reviewed-by:
rev 10312 : imported patch remove-cset-from-name


   7  * published by the Free Software Foundation.
   8  *
   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 #include "precompiled.hpp"
  26 #include "gc/g1/g1CollectedHeap.hpp"

  27 #include "gc/g1/g1CollectorPolicy.hpp"
  28 #include "gc/g1/heapRegion.hpp"
  29 #include "gc/g1/heapRegion.inline.hpp"
  30 #include "gc/g1/heapRegionRemSet.hpp"
  31 #include "gc/g1/youngList.hpp"
  32 #include "logging/log.hpp"
  33 #include "utilities/ostream.hpp"
  34 
  35 YoungList::YoungList(G1CollectedHeap* g1h) :
  36     _g1h(g1h), _head(NULL), _length(0),
  37     _survivor_head(NULL), _survivor_tail(NULL), _survivor_length(0) {
  38   guarantee(check_list_empty(), "just making sure...");
  39 }
  40 
  41 void YoungList::push_region(HeapRegion *hr) {
  42   assert(!hr->is_young(), "should not already be young");
  43   assert(hr->get_next_young_region() == NULL, "cause it should!");
  44 
  45   hr->set_next_young_region(_head);
  46   _head = hr;


 136 }
 137 
 138 void
 139 YoungList::reset_auxilary_lists() {
 140   guarantee( is_empty(), "young list should be empty" );
 141   assert(check_list_well_formed(), "young list should be well formed");
 142 
 143   // Add survivor regions to SurvRateGroup.
 144   _g1h->g1_policy()->note_start_adding_survivor_regions();
 145   _g1h->g1_policy()->finished_recalculating_age_indexes(true /* is_survivors */);
 146 
 147   int young_index_in_cset = 0;
 148   for (HeapRegion* curr = _survivor_head;
 149        curr != NULL;
 150        curr = curr->get_next_young_region()) {
 151     _g1h->g1_policy()->set_region_survivor(curr, young_index_in_cset);
 152 
 153     // The region is a non-empty survivor so let's add it to
 154     // the incremental collection set for the next evacuation
 155     // pause.
 156     _g1h->g1_policy()->add_region_to_incremental_cset_rhs(curr);
 157     young_index_in_cset += 1;
 158   }
 159   assert((uint) young_index_in_cset == _survivor_length, "post-condition");
 160   _g1h->g1_policy()->note_stop_adding_survivor_regions();
 161 
 162   _head   = _survivor_head;
 163   _length = _survivor_length;
 164   if (_survivor_head != NULL) {
 165     assert(_survivor_tail != NULL, "cause it shouldn't be");
 166     assert(_survivor_length > 0, "invariant");
 167     _survivor_tail->set_next_young_region(NULL);
 168   }
 169 
 170   // Don't clear the survivor list handles until the start of
 171   // the next evacuation pause - we need it in order to re-tag
 172   // the survivor regions from this evacuation pause as 'young'
 173   // at the start of the next.
 174 
 175   _g1h->g1_policy()->finished_recalculating_age_indexes(false /* is_survivors */);
 176 




   7  * published by the Free Software Foundation.
   8  *
   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 #include "precompiled.hpp"
  26 #include "gc/g1/g1CollectedHeap.hpp"
  27 #include "gc/g1/g1CollectionSet.hpp"
  28 #include "gc/g1/g1CollectorPolicy.hpp"
  29 #include "gc/g1/heapRegion.hpp"
  30 #include "gc/g1/heapRegion.inline.hpp"
  31 #include "gc/g1/heapRegionRemSet.hpp"
  32 #include "gc/g1/youngList.hpp"
  33 #include "logging/log.hpp"
  34 #include "utilities/ostream.hpp"
  35 
  36 YoungList::YoungList(G1CollectedHeap* g1h) :
  37     _g1h(g1h), _head(NULL), _length(0),
  38     _survivor_head(NULL), _survivor_tail(NULL), _survivor_length(0) {
  39   guarantee(check_list_empty(), "just making sure...");
  40 }
  41 
  42 void YoungList::push_region(HeapRegion *hr) {
  43   assert(!hr->is_young(), "should not already be young");
  44   assert(hr->get_next_young_region() == NULL, "cause it should!");
  45 
  46   hr->set_next_young_region(_head);
  47   _head = hr;


 137 }
 138 
 139 void
 140 YoungList::reset_auxilary_lists() {
 141   guarantee( is_empty(), "young list should be empty" );
 142   assert(check_list_well_formed(), "young list should be well formed");
 143 
 144   // Add survivor regions to SurvRateGroup.
 145   _g1h->g1_policy()->note_start_adding_survivor_regions();
 146   _g1h->g1_policy()->finished_recalculating_age_indexes(true /* is_survivors */);
 147 
 148   int young_index_in_cset = 0;
 149   for (HeapRegion* curr = _survivor_head;
 150        curr != NULL;
 151        curr = curr->get_next_young_region()) {
 152     _g1h->g1_policy()->set_region_survivor(curr, young_index_in_cset);
 153 
 154     // The region is a non-empty survivor so let's add it to
 155     // the incremental collection set for the next evacuation
 156     // pause.
 157     _g1h->collection_set()->add_survivor_regions(curr);
 158     young_index_in_cset += 1;
 159   }
 160   assert((uint) young_index_in_cset == _survivor_length, "post-condition");
 161   _g1h->g1_policy()->note_stop_adding_survivor_regions();
 162 
 163   _head   = _survivor_head;
 164   _length = _survivor_length;
 165   if (_survivor_head != NULL) {
 166     assert(_survivor_tail != NULL, "cause it shouldn't be");
 167     assert(_survivor_length > 0, "invariant");
 168     _survivor_tail->set_next_young_region(NULL);
 169   }
 170 
 171   // Don't clear the survivor list handles until the start of
 172   // the next evacuation pause - we need it in order to re-tag
 173   // the survivor regions from this evacuation pause as 'young'
 174   // at the start of the next.
 175 
 176   _g1h->g1_policy()->finished_recalculating_age_indexes(false /* is_survivors */);
 177 


< prev index next >