src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Symbol.java
changeset 51179 516acf6956a2
parent 50929 ef57cfcd22ff
child 51531 948c62200f8c
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Symbol.java	Fri Jul 20 11:55:05 2018 -0700
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Symbol.java	Fri Jul 20 14:52:11 2018 -0400
@@ -45,17 +45,11 @@
 
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
     Type type  = db.lookupType("Symbol");
-    length     = type.getCIntegerField("_length");
+    lengthAndRefcount = type.getCIntegerField("_length_and_refcount");
     baseOffset = type.getField("_body").getOffset();
     idHash = type.getCIntegerField("_identity_hash");
   }
 
-  // Format:
-  //   [header]
-  //   [klass ]
-  //   [length] byte size of uft8 string
-  //   ..body..
-
   public static Symbol create(Address addr) {
     if (addr == null) {
       return null;
@@ -72,10 +66,13 @@
   private static long baseOffset; // tells where the array part starts
 
   // Fields
-  private static CIntegerField length;
+  private static CIntegerField lengthAndRefcount;
 
   // Accessors for declared fields
-  public long   getLength() { return          length.getValue(this.addr); }
+  public long getLength() {
+    long i = lengthAndRefcount.getValue(this.addr);
+    return (i >> 16) & 0xffff;
+  }
 
   public byte getByteAt(long index) {
     return addr.getJByteAt(baseOffset + index);