8199918: Shorten names of CollectedHeap::Name members
authorpliden
Wed, 28 Mar 2018 11:38:47 +0200
changeset 49628 88478047bc8f
parent 49627 32bdc65633a6
child 49629 b786280276dc
8199918: Shorten names of CollectedHeap::Name members Reviewed-by: shade, eosterlund
src/hotspot/cpu/sparc/macroAssembler_sparc.cpp
src/hotspot/share/gc/cms/cmsHeap.cpp
src/hotspot/share/gc/cms/cmsHeap.hpp
src/hotspot/share/gc/g1/g1CollectedHeap.cpp
src/hotspot/share/gc/g1/g1CollectedHeap.hpp
src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp
src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp
src/hotspot/share/gc/serial/serialHeap.hpp
src/hotspot/share/gc/shared/collectedHeap.hpp
src/hotspot/share/gc/shared/genCollectedHeap.cpp
src/hotspot/share/runtime/vmStructs.cpp
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CMSHeap.java
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/SerialHeap.java
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeapName.java
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java
test/hotspot/jtreg/serviceability/sa/TestIntConstant.java
--- a/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Wed Mar 28 11:38:47 2018 +0200
@@ -3708,7 +3708,7 @@
 // Called from init_globals() after universe_init() and before interpreter_init()
 void g1_barrier_stubs_init() {
   CollectedHeap* heap = Universe::heap();
-  if (heap->kind() == CollectedHeap::G1CollectedHeap) {
+  if (heap->kind() == CollectedHeap::G1) {
     // Only needed for G1
     if (dirty_card_log_enqueue == 0) {
       G1BarrierSet* bs =
--- a/src/hotspot/share/gc/cms/cmsHeap.cpp	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/hotspot/share/gc/cms/cmsHeap.cpp	Wed Mar 28 11:38:47 2018 +0200
@@ -132,7 +132,7 @@
 CMSHeap* CMSHeap::heap() {
   CollectedHeap* heap = Universe::heap();
   assert(heap != NULL, "Uninitialized access to CMSHeap::heap()");
-  assert(heap->kind() == CollectedHeap::CMSHeap, "Not a CMSHeap");
+  assert(heap->kind() == CollectedHeap::CMS, "Invalid name");
   return (CMSHeap*) heap;
 }
 
--- a/src/hotspot/share/gc/cms/cmsHeap.hpp	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/hotspot/share/gc/cms/cmsHeap.hpp	Wed Mar 28 11:38:47 2018 +0200
@@ -57,7 +57,7 @@
   static CMSHeap* heap();
 
   virtual Name kind() const {
-    return CollectedHeap::CMSHeap;
+    return CollectedHeap::CMS;
   }
 
   virtual const char* name() const {
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Mar 28 11:38:47 2018 +0200
@@ -2486,7 +2486,7 @@
 G1CollectedHeap* G1CollectedHeap::heap() {
   CollectedHeap* heap = Universe::heap();
   assert(heap != NULL, "Uninitialized access to G1CollectedHeap::heap()");
-  assert(heap->kind() == CollectedHeap::G1CollectedHeap, "Not a G1CollectedHeap");
+  assert(heap->kind() == CollectedHeap::G1, "Invalid name");
   return (G1CollectedHeap*)heap;
 }
 
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Wed Mar 28 11:38:47 2018 +0200
@@ -958,7 +958,7 @@
   void ref_processing_init();
 
   virtual Name kind() const {
-    return CollectedHeap::G1CollectedHeap;
+    return CollectedHeap::G1;
   }
 
   virtual const char* name() const {
--- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp	Wed Mar 28 11:38:47 2018 +0200
@@ -622,7 +622,7 @@
 ParallelScavengeHeap* ParallelScavengeHeap::heap() {
   CollectedHeap* heap = Universe::heap();
   assert(heap != NULL, "Uninitialized access to ParallelScavengeHeap::heap()");
-  assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Not a ParallelScavengeHeap");
+  assert(heap->kind() == CollectedHeap::Parallel, "Invalid name");
   return (ParallelScavengeHeap*)heap;
 }
 
--- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp	Wed Mar 28 11:38:47 2018 +0200
@@ -102,7 +102,7 @@
   };
 
   virtual Name kind() const {
-    return CollectedHeap::ParallelScavengeHeap;
+    return CollectedHeap::Parallel;
   }
 
   virtual const char* name() const {
--- a/src/hotspot/share/gc/serial/serialHeap.hpp	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/hotspot/share/gc/serial/serialHeap.hpp	Wed Mar 28 11:38:47 2018 +0200
@@ -47,7 +47,7 @@
   SerialHeap(GenCollectorPolicy* policy);
 
   virtual Name kind() const {
-    return CollectedHeap::SerialHeap;
+    return CollectedHeap::Serial;
   }
 
   virtual const char* name() const {
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Wed Mar 28 11:38:47 2018 +0200
@@ -187,10 +187,10 @@
 
  public:
   enum Name {
-    SerialHeap,
-    ParallelScavengeHeap,
-    G1CollectedHeap,
-    CMSHeap
+    Serial,
+    Parallel,
+    CMS,
+    G1
   };
 
   static inline size_t filler_array_max_size() {
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Wed Mar 28 11:38:47 2018 +0200
@@ -1232,8 +1232,8 @@
 GenCollectedHeap* GenCollectedHeap::heap() {
   CollectedHeap* heap = Universe::heap();
   assert(heap != NULL, "Uninitialized access to GenCollectedHeap::heap()");
-  assert(heap->kind() == CollectedHeap::SerialHeap ||
-         heap->kind() == CollectedHeap::CMSHeap, "Not a GenCollectedHeap");
+  assert(heap->kind() == CollectedHeap::Serial ||
+         heap->kind() == CollectedHeap::CMS, "Invalid name");
   return (GenCollectedHeap*) heap;
 }
 
--- a/src/hotspot/share/runtime/vmStructs.cpp	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/hotspot/share/runtime/vmStructs.cpp	Wed Mar 28 11:38:47 2018 +0200
@@ -2261,10 +2261,10 @@
                                                                           \
   declare_constant(G1CardTable::g1_young_gen)                             \
                                                                           \
-  declare_constant(CollectedHeap::SerialHeap)                             \
-  declare_constant(CollectedHeap::CMSHeap)                                \
-  declare_constant(CollectedHeap::ParallelScavengeHeap)                   \
-  declare_constant(CollectedHeap::G1CollectedHeap)                        \
+  declare_constant(CollectedHeap::Serial)                                 \
+  declare_constant(CollectedHeap::Parallel)                               \
+  declare_constant(CollectedHeap::CMS)                                    \
+  declare_constant(CollectedHeap::G1)                                     \
                                                                           \
   /* constants from Generation::Name enum */                              \
                                                                           \
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CMSHeap.java	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CMSHeap.java	Wed Mar 28 11:38:47 2018 +0200
@@ -35,6 +35,6 @@
   }
 
   public CollectedHeapName kind() {
-    return CollectedHeapName.CMS_HEAP;
+    return CollectedHeapName.CMS;
   }
 }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java	Wed Mar 28 11:38:47 2018 +0200
@@ -125,7 +125,7 @@
     }
 
     public CollectedHeapName kind() {
-        return CollectedHeapName.G1_COLLECTED_HEAP;
+        return CollectedHeapName.G1;
     }
 
     @Override
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java	Wed Mar 28 11:38:47 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,7 +85,7 @@
    }
 
    public CollectedHeapName kind() {
-      return CollectedHeapName.PARALLEL_SCAVENGE_HEAP;
+      return CollectedHeapName.PARALLEL;
    }
 
    public void printOn(PrintStream tty) {
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/SerialHeap.java	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/serial/SerialHeap.java	Wed Mar 28 11:38:47 2018 +0200
@@ -35,6 +35,6 @@
   }
 
   public CollectedHeapName kind() {
-    return CollectedHeapName.SERIAL_HEAP;
+    return CollectedHeapName.SERIAL;
   }
 }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeapName.java	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeapName.java	Wed Mar 28 11:38:47 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,11 +31,10 @@
 
   private CollectedHeapName(String name) { this.name = name; }
 
-  public static final CollectedHeapName GEN_COLLECTED_HEAP = new CollectedHeapName("GenCollectedHeap");
-  public static final CollectedHeapName CMS_HEAP = new CollectedHeapName("CMSHeap");
-  public static final CollectedHeapName SERIAL_HEAP = new CollectedHeapName("SerialHeap");
-  public static final CollectedHeapName G1_COLLECTED_HEAP = new CollectedHeapName("G1CollectedHeap");
-  public static final CollectedHeapName PARALLEL_SCAVENGE_HEAP = new CollectedHeapName("ParallelScavengeHeap");
+  public static final CollectedHeapName SERIAL = new CollectedHeapName("Serial");
+  public static final CollectedHeapName PARALLEL = new CollectedHeapName("Parallel");
+  public static final CollectedHeapName CMS = new CollectedHeapName("CMS");
+  public static final CollectedHeapName G1 = new CollectedHeapName("G1");
 
   public String toString() {
     return name;
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java	Wed Mar 28 11:27:35 2018 +0200
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java	Wed Mar 28 11:38:47 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
 import sun.jvm.hotspot.types.*;
 import sun.jvm.hotspot.utilities.*;
 
-public class GenCollectedHeap extends CollectedHeap {
+abstract public class GenCollectedHeap extends CollectedHeap {
   private static AddressField youngGenField;
   private static AddressField oldGenField;
 
@@ -134,10 +134,6 @@
     }
   }
 
-  public CollectedHeapName kind() {
-    return CollectedHeapName.GEN_COLLECTED_HEAP;
-  }
-
   public void printOn(PrintStream tty) {
     for (int i = 0; i < nGens(); i++) {
       tty.print("Gen " + i + ": ");
--- a/test/hotspot/jtreg/serviceability/sa/TestIntConstant.java	Wed Mar 28 11:27:35 2018 +0200
+++ b/test/hotspot/jtreg/serviceability/sa/TestIntConstant.java	Wed Mar 28 11:38:47 2018 +0200
@@ -110,7 +110,7 @@
             // with names and the values derived from enums and #define preprocessor
             // macros in hotspot.
             String[] defaultOutputStrings =
-                {"CollectedHeap::G1CollectedHeap 2",
+                {"CollectedHeap::G1 3",
                  "RUNNABLE 2",
                  "Deoptimization::Reason_class_check 4",
                  "InstanceKlass::_misc_is_anonymous 32",