8139772: Cleanups in Generation related code
authorjwilhelm
Mon, 19 Oct 2015 15:03:58 +0200
changeset 33580 c2d95df2c54e
parent 33579 01ade4446d96
child 33582 7192a8870c59
child 33585 3121a0276778
child 33589 7cbd1b2c139b
8139772: Cleanups in Generation related code Reviewed-by: tbenson, mgerdin
hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp
hotspot/src/share/vm/gc/serial/defNewGeneration.cpp
hotspot/src/share/vm/gc/serial/tenuredGeneration.hpp
hotspot/src/share/vm/gc/shared/cardGeneration.cpp
hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp
hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp
hotspot/src/share/vm/gc/shared/generation.cpp
hotspot/src/share/vm/gc/shared/generation.hpp
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.hpp	Mon Oct 19 15:03:58 2015 +0200
@@ -1121,12 +1121,6 @@
   // over-rides
   MemRegion used_region_at_save_marks() const;
 
-  // Does a "full" (forced) collection invoked on this generation collect
-  // the young generation as well?
-  virtual bool full_collects_young_generation() const {
-    return !ScavengeBeforeFullGC;
-  }
-
   // Adjust quantities in the generation affected by
   // the compaction.
   void reset_after_compaction();
--- a/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp	Mon Oct 19 15:03:58 2015 +0200
@@ -383,7 +383,7 @@
 
   size_t old_size = gch->old_gen()->capacity();
   size_t new_size_before = _virtual_space.committed_size();
-  size_t min_new_size = spec()->init_size();
+  size_t min_new_size = initial_size();
   size_t max_new_size = reserved().byte_size();
   assert(min_new_size <= new_size_before &&
          new_size_before <= max_new_size,
--- a/hotspot/src/share/vm/gc/serial/tenuredGeneration.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/gc/serial/tenuredGeneration.hpp	Mon Oct 19 15:03:58 2015 +0200
@@ -66,13 +66,6 @@
   const char* name() const { return "tenured generation"; }
   const char* short_name() const { return "Tenured"; }
 
-  // Does a "full" (forced) collection invoked on this generation collect
-  // the young generation as well? Note that this is a hack to allow the
-  // collection of the young gen first if the flag is set.
-  virtual bool full_collects_young_generation() const {
-    return !ScavengeBeforeFullGC;
-  }
-
   size_t unsafe_max_alloc_nogc() const;
   size_t contiguous_available() const;
 
--- a/hotspot/src/share/vm/gc/shared/cardGeneration.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/gc/shared/cardGeneration.cpp	Mon Oct 19 15:03:58 2015 +0200
@@ -208,8 +208,7 @@
   const double min_tmp = used_after_gc / maximum_used_percentage;
   size_t minimum_desired_capacity = (size_t)MIN2(min_tmp, double(max_uintx));
   // Don't shrink less than the initial generation size
-  minimum_desired_capacity = MAX2(minimum_desired_capacity,
-                                  spec()->init_size());
+  minimum_desired_capacity = MAX2(minimum_desired_capacity, initial_size());
   assert(used_after_gc <= minimum_desired_capacity, "sanity check");
 
   if (PrintGC && Verbose) {
@@ -262,8 +261,7 @@
     const double minimum_used_percentage = 1.0 - maximum_free_percentage;
     const double max_tmp = used_after_gc / minimum_used_percentage;
     size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx));
-    maximum_desired_capacity = MAX2(maximum_desired_capacity,
-                                    spec()->init_size());
+    maximum_desired_capacity = MAX2(maximum_desired_capacity, initial_size());
     if (PrintGC && Verbose) {
       gclog_or_tty->print_cr("  "
                              "  maximum_free_percentage: %6.2f"
@@ -299,20 +297,20 @@
       }
       if (PrintGC && Verbose) {
         gclog_or_tty->print_cr("  "
-                      "  shrinking:"
-                      "  initSize: %.1fK"
-                      "  maximum_desired_capacity: %.1fK",
-                      spec()->init_size() / (double) K,
-                      maximum_desired_capacity / (double) K);
+                               "  shrinking:"
+                               "  initSize: %.1fK"
+                               "  maximum_desired_capacity: %.1fK",
+                               initial_size() / (double) K,
+                               maximum_desired_capacity / (double) K);
         gclog_or_tty->print_cr("  "
-                      "  shrink_bytes: %.1fK"
-                      "  current_shrink_factor: " SIZE_FORMAT
-                      "  new shrink factor: " SIZE_FORMAT
-                      "  _min_heap_delta_bytes: %.1fK",
-                      shrink_bytes / (double) K,
-                      current_shrink_factor,
-                      _shrink_factor,
-                      _min_heap_delta_bytes / (double) K);
+                               "  shrink_bytes: %.1fK"
+                               "  current_shrink_factor: " SIZE_FORMAT
+                               "  new shrink factor: " SIZE_FORMAT
+                               "  _min_heap_delta_bytes: %.1fK",
+                               shrink_bytes / (double) K,
+                               current_shrink_factor,
+                               _shrink_factor,
+                               _min_heap_delta_bytes / (double) K);
       }
     }
   }
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Mon Oct 19 15:03:58 2015 +0200
@@ -460,10 +460,9 @@
 
     bool prepared_for_verification = false;
     bool collected_old = false;
-    bool old_collects_young = complete &&
-                              _old_gen->full_collects_young_generation();
-    if (!old_collects_young &&
-        _young_gen->should_collect(full, size, is_tlab)) {
+    bool old_collects_young = complete && !ScavengeBeforeFullGC;
+
+    if (!old_collects_young && _young_gen->should_collect(full, size, is_tlab)) {
       if (run_verification && VerifyGCLevel <= 0 && VerifyBeforeGC) {
         prepare_for_verify();
         prepared_for_verification = true;
@@ -1107,10 +1106,6 @@
   _young_gen->prepare_for_compaction(&cp);
 }
 
-GCStats* GenCollectedHeap::gc_stats(Generation* gen) const {
-  return gen->gc_stats();
-}
-
 void GenCollectedHeap::verify(bool silent, VerifyOption option /* ignored */) {
   if (!silent) {
     gclog_or_tty->print("%s", _old_gen->name());
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.hpp	Mon Oct 19 15:03:58 2015 +0200
@@ -126,8 +126,6 @@
 
   WorkGang* workers() const { return _workers; }
 
-  GCStats* gc_stats(Generation* generation) const;
-
   // Returns JNI_OK on success
   virtual jint initialize();
 
--- a/hotspot/src/share/vm/gc/shared/generation.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/gc/shared/generation.cpp	Mon Oct 19 15:03:58 2015 +0200
@@ -58,12 +58,12 @@
           (HeapWord*)_virtual_space.high_boundary());
 }
 
-GenerationSpec* Generation::spec() {
+size_t Generation::initial_size() {
   GenCollectedHeap* gch = GenCollectedHeap::heap();
   if (gch->is_young_gen(this)) {
-    return gch->gen_policy()->young_gen_spec();
+    return gch->gen_policy()->young_gen_spec()->init_size();
   }
-  return gch->gen_policy()->old_gen_spec();
+  return gch->gen_policy()->old_gen_spec()->init_size();
 }
 
 size_t Generation::max_capacity() const {
--- a/hotspot/src/share/vm/gc/shared/generation.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/gc/shared/generation.hpp	Mon Oct 19 15:03:58 2015 +0200
@@ -141,14 +141,14 @@
   }
 
   virtual Generation::Name kind() { return Generation::Other; }
-  GenerationSpec* spec();
 
   // This properly belongs in the collector, but for now this
   // will do.
   virtual bool refs_discovery_is_atomic() const { return true;  }
   virtual bool refs_discovery_is_mt()     const { return false; }
 
-  // Space enquiries (results in bytes)
+  // Space inquiries (results in bytes)
+  size_t initial_size();
   virtual size_t capacity() const = 0;  // The maximum number of object bytes the
                                         // generation can currently hold.
   virtual size_t used() const = 0;      // The number of used bytes in the gen.
@@ -309,10 +309,6 @@
   // do nothing.
   virtual void par_oop_since_save_marks_iterate_done(int thread_num) {}
 
-  // This generation will collect all younger generations
-  // during a full collection.
-  virtual bool full_collects_young_generation() const { return false; }
-
   // This generation does in-place marking, meaning that mark words
   // are mutated during the marking phase and presumably reinitialized
   // to a canonical value after the GC. This is currently used by the
@@ -403,7 +399,7 @@
   // that was most recently collected. This allows the generation to
   // decide what statistics are valid to collect. For example, the
   // generation can decide to gather the amount of promoted data if
-  // the collection of the younger generations has completed.
+  // the collection of the young generation has completed.
   GCStats* gc_stats() const { return _gc_stats; }
   virtual void update_gc_stats(Generation* current_generation, bool full) {}