< prev index next >

src/share/vm/gc/shared/collectorPolicy.cpp

Print this page
rev 13243 : 8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap
Reviewed-by: pliden, mgerdin

@@ -49,11 +49,10 @@
     _space_alignment(0),
     _heap_alignment(0),
     _initial_heap_byte_size(InitialHeapSize),
     _max_heap_byte_size(MaxHeapSize),
     _min_heap_byte_size(Arguments::min_heap_size()),
-    _size_policy(NULL),
     _should_clear_all_soft_refs(false),
     _all_soft_refs_clear(false)
 {}
 
 #ifdef ASSERT

@@ -155,16 +154,10 @@
 CardTableRS* CollectorPolicy::create_rem_set(MemRegion whole_heap) {
   return new CardTableRS(whole_heap);
 }
 
 void CollectorPolicy::cleared_all_soft_refs() {
-  // If near gc overhear limit, continue to clear SoftRefs.  SoftRefs may
-  // have been cleared in the last collection but if the gc overhear
-  // limit continues to be near, SoftRefs should still be cleared.
-  if (size_policy() != NULL) {
-    _should_clear_all_soft_refs = size_policy()->gc_overhead_limit_near();
-  }
   _all_soft_refs_clear = true;
 }
 
 size_t CollectorPolicy::compute_heap_alignment() {
   // The card marking array and the offset arrays for old generations are

@@ -193,11 +186,12 @@
     _min_old_size(0),
     _initial_old_size(0),
     _max_old_size(0),
     _gen_alignment(0),
     _young_gen_spec(NULL),
-    _old_gen_spec(NULL)
+    _old_gen_spec(NULL),
+    _size_policy(NULL)
 {}
 
 size_t GenCollectorPolicy::scale_by_NewRatio_aligned(size_t base_size) {
   return align_down_bounded(base_size / (NewRatio + 1), _gen_alignment);
 }

@@ -218,10 +212,21 @@
                                         init_survivor_size,
                                         max_gc_pause_sec,
                                         GCTimeRatio);
 }
 
+void GenCollectorPolicy::cleared_all_soft_refs() {
+  // If near gc overhear limit, continue to clear SoftRefs.  SoftRefs may
+  // have been cleared in the last collection but if the gc overhear
+  // limit continues to be near, SoftRefs should still be cleared.
+  if (size_policy() != NULL) {
+    _should_clear_all_soft_refs = size_policy()->gc_overhead_limit_near();
+  }
+
+  CollectorPolicy::cleared_all_soft_refs();
+}
+
 size_t GenCollectorPolicy::young_gen_size_lower_bound() {
   // The young generation must be aligned and have room for eden + two survivors
   return align_up(3 * _space_alignment, _gen_alignment);
 }
 
< prev index next >