src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java
changeset 53513 8c035b34248d
parent 50929 ef57cfcd22ff
child 53637 4366a1e4a021
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java	Fri Jan 25 14:28:43 2019 -0800
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java	Sat Jan 26 10:34:29 2019 +0900
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -130,6 +130,7 @@
   private static Type intxType;
   private static Type uintxType;
   private static Type sizetType;
+  private static Type uint64tType;
   private static CIntegerType boolType;
   private Boolean sharingEnabled;
   private Boolean compressedOopsEnabled;
@@ -231,6 +232,50 @@
         return addr.getCIntegerAt(0, sizetType.getSize(), true);
      }
 
+     public boolean isCcstr() {
+        return type.equals("ccstr");
+     }
+
+     public String getCcstr() {
+        if (Assert.ASSERTS_ENABLED) {
+           Assert.that(isCcstr(), "not a ccstr flag!");
+        }
+        return CStringUtilities.getString(addr.getAddressAt(0));
+     }
+
+     public boolean isCcstrlist() {
+        return type.equals("ccstrlist");
+     }
+
+     public String getCcstrlist() {
+        if (Assert.ASSERTS_ENABLED) {
+           Assert.that(isCcstrlist(), "not a ccstrlist flag!");
+        }
+        return CStringUtilities.getString(addr.getAddressAt(0));
+     }
+
+     public boolean isDouble() {
+        return type.equals("double");
+     }
+
+     public double getDouble() {
+        if (Assert.ASSERTS_ENABLED) {
+           Assert.that(isDouble(), "not a double flag!");
+        }
+        return addr.getJDoubleAt(0);
+     }
+
+     public boolean isUint64t() {
+        return type.equals("uint64_t");
+     }
+
+     public long getUint64t() {
+        if (Assert.ASSERTS_ENABLED) {
+           Assert.that(isUint64t(), "not an uint64_t flag!");
+        }
+        return addr.getCIntegerAt(0, uint64tType.getSize(), true);
+     }
+
      public String getValue() {
         if (isBool()) {
            return Boolean.toString(getBool());
@@ -241,11 +286,27 @@
         } else if (isIntx()) {
            return Long.toString(getIntx());
         } else if (isUIntx()) {
-           return Long.toString(getUIntx());
+           return Long.toUnsignedString(getUIntx());
         } else if (isSizet()) {
-            return Long.toString(getSizet());
+           return Long.toUnsignedString(getSizet());
+        } else if (isCcstr()) {
+           var str = getCcstr();
+           if (str != null) {
+               str = "\"" + str + "\"";
+           }
+           return str;
+        } else if (isCcstrlist()) {
+           var str = getCcstrlist();
+           if (str != null) {
+               str = "\"" + str + "\"";
+           }
+           return str;
+        } else if (isDouble()) {
+           return Double.toString(getDouble());
+        } else if (isUint64t()) {
+           return Long.toUnsignedString(getUint64t());
         } else {
-           return null;
+           throw new WrongTypeException("Unknown type: " + type + " (" + name + ")");
         }
      }
   };
@@ -383,6 +444,7 @@
     intxType = db.lookupType("intx");
     uintxType = db.lookupType("uintx");
     sizetType = db.lookupType("size_t");
+    uint64tType = db.lookupType("uint64_t");
     boolType = (CIntegerType) db.lookupType("bool");
 
     minObjAlignmentInBytes = getObjectAlignmentInBytes();