8160197: [JVMCI] AllocatableValue.toString overrides are missing reference information
authornever
Thu, 23 Jun 2016 10:22:36 -0700
changeset 39449 792094902fc8
parent 39448 7ba3b2a8e48e
child 39450 78e99b030d5f
child 40022 3eb9922d1a5b
8160197: [JVMCI] AllocatableValue.toString overrides are missing reference information Reviewed-by: kvn
hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Value.java
hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ValueKind.java
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Value.java	Thu Jun 23 15:41:33 2016 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/Value.java	Thu Jun 23 10:22:36 2016 -0700
@@ -65,7 +65,7 @@
      * {@link #toString()} implementation of subclasses.
      */
     protected final String getKindSuffix() {
-        return "|" + getPlatformKind().getTypeChar();
+        return "|" + valueKind.getKindSuffix();
     }
 
     public final ValueKind<?> getValueKind() {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ValueKind.java	Thu Jun 23 15:41:33 2016 +0000
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ValueKind.java	Thu Jun 23 10:22:36 2016 -0700
@@ -60,6 +60,11 @@
         public IllegalValueKind changeType(PlatformKind newPlatformKind) {
             return this;
         }
+
+        @Override
+        public String toString() {
+            return "ILLEGAL";
+        }
     }
 
     /**
@@ -82,4 +87,13 @@
      * override this to preserve the additional information added by the compiler.
      */
     public abstract K changeType(PlatformKind newPlatformKind);
+
+    /**
+     * Returns a String representation of the kind, which will be included at the end of
+     * {@link Value#toString()} implementation. Defaults to {@link #toString()} but can be
+     * overridden to provide something more specific.
+     */
+    public String getKindSuffix() {
+        return toString();
+    }
 }