< prev index next >

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

Print this page
rev 11040 : 8150393: Maintain the set of survivor regions in an array between GCs
Reviewed-by:

@@ -39,10 +39,11 @@
 #include "gc/shared/gcPolicyCounters.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/java.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "utilities/debug.hpp"
+#include "utilities/growableArray.hpp"
 #include "utilities/pair.hpp"
 
 G1DefaultPolicy::G1DefaultPolicy() :
   _predictor(G1ConfidencePercent / 100.0),
   _analytics(new G1Analytics(&_predictor)),

@@ -356,14 +357,16 @@
   return base_min_length + min_young_length;
 }
 
 double G1DefaultPolicy::predict_survivor_regions_evac_time() const {
   double survivor_regions_evac_time = 0.0;
-  for (HeapRegion * r = _g1->young_list()->first_survivor_region();
-       r != NULL && r != _g1->young_list()->last_survivor_region()->get_next_young_region();
-       r = r->get_next_young_region()) {
-    survivor_regions_evac_time += predict_region_elapsed_time_ms(r, collector_state()->gcs_are_young());
+  const GrowableArray<HeapRegion*>* survivor_regions = _g1->young_list()->survivor_regions();
+
+  for (GrowableArrayIterator<HeapRegion*> it = survivor_regions->begin();
+       it != survivor_regions->end();
+       ++it) {
+    survivor_regions_evac_time += predict_region_elapsed_time_ms(*it, collector_state()->gcs_are_young());
   }
   return survivor_regions_evac_time;
 }
 
 void G1DefaultPolicy::revise_young_list_target_length_if_necessary(size_t rs_lengths) {
< prev index next >