8198373: Remove CollectorPolicy::is/as functions
authorstefank
Thu, 22 Feb 2018 18:34:18 +0100
changeset 49043 092dc3d38bdc
parent 49042 a04a9bee2431
child 49044 b01b69c220be
8198373: Remove CollectorPolicy::is/as functions Reviewed-by: sjohanss, pliden
src/hotspot/share/gc/cms/cmsCollectorPolicy.hpp
src/hotspot/share/gc/cms/cmsHeap.cpp
src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp
src/hotspot/share/gc/shared/collectorPolicy.hpp
--- a/src/hotspot/share/gc/cms/cmsCollectorPolicy.hpp	Thu Feb 22 12:05:17 2018 -0500
+++ b/src/hotspot/share/gc/cms/cmsCollectorPolicy.hpp	Thu Feb 22 18:34:18 2018 +0100
@@ -35,8 +35,6 @@
  public:
   ConcurrentMarkSweepPolicy() {}
 
-  ConcurrentMarkSweepPolicy* as_concurrent_mark_sweep_policy() { return this; }
-
   void initialize_gc_policy_counters();
 
   virtual void initialize_size_policy(size_t init_eden_size,
--- a/src/hotspot/share/gc/cms/cmsHeap.cpp	Thu Feb 22 12:05:17 2018 -0500
+++ b/src/hotspot/share/gc/cms/cmsHeap.cpp	Thu Feb 22 18:34:18 2018 +0100
@@ -77,7 +77,6 @@
 
   // If we are running CMS, create the collector responsible
   // for collecting the CMS generations.
-  assert(collector_policy()->is_concurrent_mark_sweep_policy(), "must be CMS policy");
   if (!create_cms_collector()) {
     return JNI_ENOMEM;
   }
@@ -152,11 +151,10 @@
 bool CMSHeap::create_cms_collector() {
   assert(old_gen()->kind() == Generation::ConcurrentMarkSweep,
          "Unexpected generation kinds");
-  assert(gen_policy()->is_concurrent_mark_sweep_policy(), "Unexpected policy type");
   CMSCollector* collector =
     new CMSCollector((ConcurrentMarkSweepGeneration*) old_gen(),
                      rem_set(),
-                     gen_policy()->as_concurrent_mark_sweep_policy());
+                     (ConcurrentMarkSweepPolicy*) gen_policy());
 
   if (collector == NULL || !collector->completed_initialization()) {
     if (collector) {
--- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Thu Feb 22 12:05:17 2018 -0500
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Thu Feb 22 18:34:18 2018 +0100
@@ -1182,8 +1182,6 @@
   // this is not likely to be productive in practice because it's probably too
   // late anyway.
   CMSHeap* heap = CMSHeap::heap();
-  assert(heap->collector_policy()->is_generation_policy(),
-         "You may want to check the correctness of the following");
   if (heap->incremental_collection_will_fail(true /* consult_young */)) {
     log.print("CMSCollector: collect because incremental collection will fail ");
     return true;
--- a/src/hotspot/share/gc/shared/collectorPolicy.hpp	Thu Feb 22 12:05:17 2018 -0500
+++ b/src/hotspot/share/gc/shared/collectorPolicy.hpp	Thu Feb 22 18:34:18 2018 +0100
@@ -114,22 +114,6 @@
   // that the request in _should_clear_all_soft_refs has been fulfilled.
   virtual void cleared_all_soft_refs();
 
-  // Identification methods.
-  virtual GenCollectorPolicy*           as_generation_policy()            { return NULL; }
-  virtual MarkSweepPolicy*              as_mark_sweep_policy()            { return NULL; }
-#if INCLUDE_ALL_GCS
-  virtual ConcurrentMarkSweepPolicy*    as_concurrent_mark_sweep_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; }
-#else  // INCLUDE_ALL_GCS
-  bool is_concurrent_mark_sweep_policy() { return false; }
-#endif // INCLUDE_ALL_GCS
-
-
   virtual CardTableRS* create_rem_set(MemRegion reserved);
 
   virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
@@ -231,8 +215,6 @@
   // Create the jstat counters for the GC policy.
   virtual void initialize_gc_policy_counters() = 0;
 
-  virtual GenCollectorPolicy* as_generation_policy() { return this; }
-
   virtual void initialize_generations() { };
 
   virtual void initialize_all() {
@@ -269,8 +251,6 @@
  public:
   MarkSweepPolicy() {}
 
-  MarkSweepPolicy* as_mark_sweep_policy() { return this; }
-
   void initialize_gc_policy_counters();
 };