diff agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPoolCache.java @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents a61af66fc99e
children d1605aabd0a1
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPoolCache.java	Fri Apr 11 09:56:35 2008 -0400
+++ b/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) {