< prev index next >

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

Print this page




  53     intSize        = VM.getVM().getObjectHeap().getIntSize();
  54   }
  55 
  56   public ConstantPoolCache(Address addr) {
  57     super(addr);
  58   }
  59 
  60   public boolean isConstantPoolCache() { return true; }
  61 
  62   private static MetadataField constants;
  63 
  64   private static long baseOffset;
  65   private static long elementSize;
  66   private static CIntField length;
  67   private static long intSize;
  68 
  69 
  70   public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
  71 
  72   public long getSize() {
  73     return Oop.alignObjectSize(baseOffset + getLength() * elementSize);
  74   }
  75 
  76   public ConstantPoolCacheEntry getEntryAt(int i) {
  77     if (i < 0 || i >= getLength()) throw new IndexOutOfBoundsException(i + " " + getLength());
  78     return new ConstantPoolCacheEntry(this, i);
  79   }
  80 
  81   public int getIntAt(int entry, int fld) {
  82     //alignObjectSize ?
  83     long offset = baseOffset + /*alignObjectSize*/entry * elementSize + fld * intSize;
  84     return (int) getAddress().getCIntegerAt(offset, intSize, true );
  85   }
  86 
  87 
  88   public void printValueOn(PrintStream tty) {
  89     tty.print("ConstantPoolCache for " + getConstants().getPoolHolder().getName().asString() + " address = " + getAddress() + " offset = " + baseOffset);
  90   }
  91 
  92   public int getLength() {
  93     return (int) length.getValue(getAddress());
  94   }
  95 
  96   public void iterateFields(MetadataVisitor visitor) {
  97     super.iterateFields(visitor);
  98     visitor.doMetadata(constants, true);
  99       for (int i = 0; i < getLength(); i++) {
 100         ConstantPoolCacheEntry entry = getEntryAt(i);
 101         entry.iterateFields(visitor);
 102       }
 103     }


  53     intSize        = VM.getVM().getObjectHeap().getIntSize();
  54   }
  55 
  56   public ConstantPoolCache(Address addr) {
  57     super(addr);
  58   }
  59 
  60   public boolean isConstantPoolCache() { return true; }
  61 
  62   private static MetadataField constants;
  63 
  64   private static long baseOffset;
  65   private static long elementSize;
  66   private static CIntField length;
  67   private static long intSize;
  68 
  69 
  70   public ConstantPool getConstants() { return (ConstantPool) constants.getValue(this); }
  71 
  72   public long getSize() {
  73     return alignSize(baseOffset + getLength() * elementSize);
  74   }
  75 
  76   public ConstantPoolCacheEntry getEntryAt(int i) {
  77     if (i < 0 || i >= getLength()) throw new IndexOutOfBoundsException(i + " " + getLength());
  78     return new ConstantPoolCacheEntry(this, i);
  79   }
  80 
  81   public int getIntAt(int entry, int fld) {
  82     long offset = baseOffset + entry * elementSize + fld * intSize;

  83     return (int) getAddress().getCIntegerAt(offset, intSize, true );
  84   }
  85 
  86 
  87   public void printValueOn(PrintStream tty) {
  88     tty.print("ConstantPoolCache for " + getConstants().getPoolHolder().getName().asString() + " address = " + getAddress() + " offset = " + baseOffset);
  89   }
  90 
  91   public int getLength() {
  92     return (int) length.getValue(getAddress());
  93   }
  94 
  95   public void iterateFields(MetadataVisitor visitor) {
  96     super.iterateFields(visitor);
  97     visitor.doMetadata(constants, true);
  98       for (int i = 0; i < getLength(); i++) {
  99         ConstantPoolCacheEntry entry = getEntryAt(i);
 100         entry.iterateFields(visitor);
 101       }
 102     }
< prev index next >