8154452: Deferred cleanups after split of G1CollectorPolicy code
authormgerdin
Thu, 21 Apr 2016 10:19:00 +0200
changeset 38011 74a6871d896b
parent 38010 51fe205359f8
child 38012 69916710bfed
8154452: Deferred cleanups after split of G1CollectorPolicy code Reviewed-by: ehelin, sjohanss
hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp
hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp
hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp
hotspot/src/share/vm/gc/g1/heapRegion.cpp
hotspot/src/share/vm/gc/shared/collectedHeap.cpp
hotspot/src/share/vm/gc/shared/collectedHeap.hpp
hotspot/src/share/vm/gc/shared/collectorPolicy.hpp
hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Thu Apr 21 10:18:50 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Thu Apr 21 10:19:00 2016 +0200
@@ -2058,7 +2058,6 @@
 }
 
 void G1CollectedHeap::post_initialize() {
-  CollectedHeap::post_initialize();
   ref_processing_init();
 }
 
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp	Thu Apr 21 10:18:50 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.cpp	Thu Apr 21 10:19:00 2016 +0200
@@ -92,14 +92,3 @@
   size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size();
   _heap_alignment = MAX3(card_table_alignment, _space_alignment, page_size);
 }
-
-void G1CollectorPolicy::initialize_flags() {
-  if (G1HeapRegionSize != HeapRegion::GrainBytes) {
-    FLAG_SET_ERGO(size_t, G1HeapRegionSize, HeapRegion::GrainBytes);
-  }
-
-  guarantee(SurvivorRatio >= 1, "Range checking for SurvivorRatio should guarantee that value is >= 1");
-
-  CollectorPolicy::initialize_flags();
-}
-
--- a/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp	Thu Apr 21 10:18:50 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CollectorPolicy.hpp	Thu Apr 21 10:19:00 2016 +0200
@@ -35,15 +35,9 @@
 class G1CollectorPolicy: public CollectorPolicy {
 protected:
   void initialize_alignments();
-  void initialize_flags();
 
 public:
   G1CollectorPolicy();
-
-  G1CollectorPolicy* as_g1_policy() { return this; }
-
-  void post_heap_initialize() {} // Nothing needed.
-
 };
 
 #endif // SHARE_VM_GC_G1_G1COLLECTORPOLICY_HPP
--- a/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Thu Apr 21 10:18:50 2016 +0200
+++ b/hotspot/src/share/vm/gc/g1/heapRegion.cpp	Thu Apr 21 10:19:00 2016 +0200
@@ -153,6 +153,10 @@
 
   guarantee(CardsPerRegion == 0, "we should only set it once");
   CardsPerRegion = GrainBytes >> CardTableModRefBS::card_shift;
+
+  if (G1HeapRegionSize != GrainBytes) {
+    FLAG_SET_ERGO(size_t, G1HeapRegionSize, GrainBytes);
+  }
 }
 
 void HeapRegion::reset_after_compaction() {
--- a/hotspot/src/share/vm/gc/shared/collectedHeap.cpp	Thu Apr 21 10:18:50 2016 +0200
+++ b/hotspot/src/share/vm/gc/shared/collectedHeap.cpp	Thu Apr 21 10:19:00 2016 +0200
@@ -510,10 +510,6 @@
   fill_with_object_impl(start, words, zap);
 }
 
-void CollectedHeap::post_initialize() {
-  collector_policy()->post_heap_initialize();
-}
-
 HeapWord* CollectedHeap::allocate_new_tlab(size_t size) {
   guarantee(false, "thread-local allocation buffers not supported");
   return NULL;
--- a/hotspot/src/share/vm/gc/shared/collectedHeap.hpp	Thu Apr 21 10:18:50 2016 +0200
+++ b/hotspot/src/share/vm/gc/shared/collectedHeap.hpp	Thu Apr 21 10:19:00 2016 +0200
@@ -209,7 +209,7 @@
   // In many heaps, there will be a need to perform some initialization activities
   // after the Universe is fully formed, but before general heap allocation is allowed.
   // This is the correct place to place such initialization methods.
-  virtual void post_initialize();
+  virtual void post_initialize() = 0;
 
   // Stop any onging concurrent work and prepare for exit.
   virtual void stop() {}
--- a/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp	Thu Apr 21 10:18:50 2016 +0200
+++ b/hotspot/src/share/vm/gc/shared/collectorPolicy.hpp	Thu Apr 21 10:19:00 2016 +0200
@@ -127,17 +127,14 @@
   virtual MarkSweepPolicy*              as_mark_sweep_policy()            { return NULL; }
 #if INCLUDE_ALL_GCS
   virtual ConcurrentMarkSweepPolicy*    as_concurrent_mark_sweep_policy() { return NULL; }
-  virtual G1CollectorPolicy*            as_g1_policy()                    { return NULL; }
 #endif // INCLUDE_ALL_GCS
   // Note that these are not virtual.
   bool is_generation_policy()            { return as_generation_policy() != NULL; }
   bool is_mark_sweep_policy()            { return as_mark_sweep_policy() != NULL; }
 #if INCLUDE_ALL_GCS
   bool is_concurrent_mark_sweep_policy() { return as_concurrent_mark_sweep_policy() != NULL; }
-  bool is_g1_policy()                    { return as_g1_policy() != NULL; }
 #else  // INCLUDE_ALL_GCS
   bool is_concurrent_mark_sweep_policy() { return false; }
-  bool is_g1_policy()                    { return false; }
 #endif // INCLUDE_ALL_GCS
 
 
@@ -146,10 +143,6 @@
   MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
                                                size_t size,
                                                Metaspace::MetadataType mdtype);
-
-  // Do any updates required to global flags that are due to heap initialization
-  // changes
-  virtual void post_heap_initialize() = 0;
 };
 
 class ClearedAllSoftRefs : public StackObj {
@@ -263,10 +256,6 @@
   virtual void initialize_size_policy(size_t init_eden_size,
                                       size_t init_promo_size,
                                       size_t init_survivor_size);
-
-  virtual void post_heap_initialize() {
-    assert(_max_young_size == MaxNewSize, "Should be taken care of by initialize_size_info");
-  }
 };
 
 class MarkSweepPolicy : public GenCollectorPolicy {
--- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Thu Apr 21 10:18:50 2016 +0200
+++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp	Thu Apr 21 10:19:00 2016 +0200
@@ -179,7 +179,6 @@
 }
 
 void GenCollectedHeap::post_initialize() {
-  CollectedHeap::post_initialize();
   ref_processing_init();
   assert((_young_gen->kind() == Generation::DefNew) ||
          (_young_gen->kind() == Generation::ParNew),