< prev index next >

src/hotspot/share/gc/shared/genCollectedHeap.cpp

Print this page

        

@@ -148,10 +148,14 @@
   DefNewGeneration* def_new_gen = (DefNewGeneration*)_young_gen;
 
   _gen_policy->initialize_size_policy(def_new_gen->eden()->capacity(),
                                       _old_gen->capacity(),
                                       def_new_gen->from()->capacity());
+
+  // Connect the two policies.
+  _soft_ref_gen_policy.set_size_policy(_gen_policy->size_policy());
+
   _gen_policy->initialize_gc_policy_counters();
 }
 
 void GenCollectedHeap::ref_processing_init() {
   _young_gen->ref_processor_init();

@@ -329,11 +333,11 @@
       // this time, return NULL so that an out-of-memory
       // will be thrown.  Clear gc_overhead_limit_exceeded
       // so that the overhead exceeded does not persist.
 
       const bool limit_exceeded = gen_policy()->size_policy()->gc_overhead_limit_exceeded();
-      const bool softrefs_clear = gen_policy()->all_soft_refs_clear();
+      const bool softrefs_clear = soft_ref_policy()->all_soft_refs_clear();
 
       if (limit_exceeded && softrefs_clear) {
         *gc_overhead_limit_was_exceeded = true;
         gen_policy()->size_policy()->set_gc_overhead_limit_exceeded(false);
         if (op.result() != NULL) {

@@ -520,13 +524,13 @@
   }
 
   GCIdMark gc_id_mark;
 
   const bool do_clear_all_soft_refs = clear_all_soft_refs ||
-                          collector_policy()->should_clear_all_soft_refs();
+                          soft_ref_policy()->should_clear_all_soft_refs();
 
-  ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
+  ClearedAllSoftRefs casr(do_clear_all_soft_refs, soft_ref_policy());
 
   const size_t metadata_prev_used = MetaspaceAux::used_bytes();
 
   print_heap_before_gc();
 

@@ -718,11 +722,11 @@
   if (result != NULL) {
     assert(is_in_reserved(result), "result not in heap");
     return result;
   }
 
-  assert(!gen_policy()->should_clear_all_soft_refs(),
+  assert(!soft_ref_policy()->should_clear_all_soft_refs(),
     "Flag should have been handled and cleared prior to this point");
 
   // What else?  We might try synchronous finalization later.  If the total
   // space available is large enough for the allocation, then a more
   // complete compaction phase than we've tried so far might be
< prev index next >