hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPoolKlass.java
changeset 360 21d113ecbf6a
parent 1 489c9b5090e2
child 670 ddf3e9583f2f
equal deleted inserted replaced
357:f4edb0d9f109 360:21d113ecbf6a
    30 import sun.jvm.hotspot.runtime.*;
    30 import sun.jvm.hotspot.runtime.*;
    31 import sun.jvm.hotspot.types.*;
    31 import sun.jvm.hotspot.types.*;
    32 
    32 
    33 // A ConstantPoolKlass is the klass of a ConstantPool
    33 // A ConstantPoolKlass is the klass of a ConstantPool
    34 
    34 
    35 public class ConstantPoolKlass extends ArrayKlass {
    35 public class ConstantPoolKlass extends Klass {
    36   static {
    36   static {
    37     VM.registerVMInitializedObserver(new Observer() {
    37     VM.registerVMInitializedObserver(new Observer() {
    38         public void update(Observable o, Object data) {
    38         public void update(Observable o, Object data) {
    39           initialize(VM.getVM().getTypeDataBase());
    39           initialize(VM.getVM().getTypeDataBase());
    40         }
    40         }
    41       });
    41       });
    42   }
    42   }
    43 
    43 
    44   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
    44   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
    45     Type type  = db.lookupType("constantPoolKlass");
    45     Type type  = db.lookupType("constantPoolKlass");
       
    46     headerSize = type.getSize() + Oop.getHeaderSize();
    46   }
    47   }
    47 
    48 
    48   ConstantPoolKlass(OopHandle handle, ObjectHeap heap) {
    49   ConstantPoolKlass(OopHandle handle, ObjectHeap heap) {
    49     super(handle, heap);
    50     super(handle, heap);
    50   }
    51   }
    51 
    52 
       
    53   public long getObjectSize() { return alignObjectSize(headerSize); }
       
    54 
    52   public void printValueOn(PrintStream tty) {
    55   public void printValueOn(PrintStream tty) {
    53     tty.print("ConstantPoolKlass");
    56     tty.print("ConstantPoolKlass");
    54   }
    57   }
    55 };
    58 
       
    59   private static long headerSize;
       
    60 }
       
    61