hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPoolCache.java
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 670 ddf3e9583f2f
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPoolCache.java	Fri Apr 11 09:56:35 2008 -0400
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPoolCache.java	Sun Apr 13 17:43:42 2008 -0400
@@ -31,10 +31,10 @@
 import sun.jvm.hotspot.types.*;
 import sun.jvm.hotspot.utilities.*;
 
-// A ConstantPool is an array containing class constants
-// as described in the class file
-
-public class ConstantPoolCache extends Array {
+//  ConstantPoolCache : A constant pool cache (constantPoolCacheOopDesc).
+//  See cpCacheOop.hpp for details about this class.
+//
+public class ConstantPoolCache extends Oop {
   static {
     VM.registerVMInitializedObserver(new Observer() {
         public void update(Observable o, Object data) {
@@ -47,9 +47,9 @@
     Type type      = db.lookupType("constantPoolCacheOopDesc");
     constants      = new OopField(type.getOopField("_constant_pool"), 0);
     baseOffset     = type.getSize();
-
     Type elType    = db.lookupType("ConstantPoolCacheEntry");
     elementSize    = elType.getSize();
+    length         = new CIntField(type.getCIntegerField("_length"), 0);
   }
 
   ConstantPoolCache(OopHandle handle, ObjectHeap heap) {
@@ -62,6 +62,8 @@
 
   private static long baseOffset;
   private static long elementSize;
+  private static CIntField length;
+
 
   public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
 
@@ -87,6 +89,10 @@
     tty.print("ConstantPoolCache for " + getConstants().getPoolHolder().getName().asString());
   }
 
+  public int getLength() {
+    return (int) length.getValue(this);
+  }
+
   public void iterateFields(OopVisitor visitor, boolean doVMFields) {
     super.iterateFields(visitor, doVMFields);
     if (doVMFields) {