< prev index next >

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ConstantPoolCache.java

Print this page

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -49,10 +49,12 @@
     baseOffset     = type.getSize();
     Type elType    = db.lookupType("ConstantPoolCacheEntry");
     elementSize    = elType.getSize();
     length         = new CIntField(type.getCIntegerField("_length"), 0);
     intSize        = VM.getVM().getObjectHeap().getIntSize();
+    resolvedReferences = type.getAddressField("_resolved_references");
+    referenceMap   = type.getAddressField("_reference_map");
   }
 
   public ConstantPoolCache(Address addr) {
     super(addr);
   }

@@ -63,11 +65,12 @@
 
   private static long baseOffset;
   private static long elementSize;
   private static CIntField length;
   private static long intSize;
-
+  private static AddressField  resolvedReferences;
+  private static AddressField  referenceMap;
 
   public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
 
   public long getSize() {
     return alignSize(baseOffset + getLength() * elementSize);

@@ -98,6 +101,20 @@
       for (int i = 0; i < getLength(); i++) {
         ConstantPoolCacheEntry entry = getEntryAt(i);
         entry.iterateFields(visitor);
       }
     }
+
+  public Oop getResolvedReferences() {
+    Address handle = resolvedReferences.getValue(getAddress());
+    if (handle != null) {
+      // Load through the handle
+      OopHandle refs = handle.getOopHandleAt(0);
+      return VM.getVM().getObjectHeap().newOop(refs);
+    }
+    return null;
+  }
+
+  public U2Array referenceMap() {
+    return new U2Array(referenceMap.getValue(getAddress()));
+  }
 };
< prev index next >