コード例 #1
0
 public void iterateFields(OopVisitor visitor, boolean doVMFields) {
   super.iterateFields(visitor, doVMFields);
   TypeArrayKlass klass = (TypeArrayKlass) getKlass();
   int length = (int) getLength();
   int type = (int) klass.getElementType();
   for (int index = 0; index < length; index++) {
     FieldIdentifier id = new IndexableFieldIdentifier(index);
     switch (type) {
       case TypeArrayKlass.T_BOOLEAN:
         {
           long offset =
               baseOffsetInBytes(BasicType.T_BOOLEAN) + index * getHeap().getBooleanSize();
           visitor.doBoolean(new BooleanField(id, offset, false), false);
           break;
         }
       case TypeArrayKlass.T_CHAR:
         {
           long offset = baseOffsetInBytes(BasicType.T_CHAR) + index * getHeap().getCharSize();
           visitor.doChar(new CharField(id, offset, false), false);
           break;
         }
       case TypeArrayKlass.T_FLOAT:
         {
           long offset = baseOffsetInBytes(BasicType.T_FLOAT) + index * getHeap().getFloatSize();
           visitor.doFloat(new FloatField(id, offset, false), false);
           break;
         }
       case TypeArrayKlass.T_DOUBLE:
         {
           long offset = baseOffsetInBytes(BasicType.T_DOUBLE) + index * getHeap().getDoubleSize();
           visitor.doDouble(new DoubleField(id, offset, false), false);
           break;
         }
       case TypeArrayKlass.T_BYTE:
         {
           long offset = baseOffsetInBytes(BasicType.T_BYTE) + index * getHeap().getByteSize();
           visitor.doByte(new ByteField(id, offset, false), false);
           break;
         }
       case TypeArrayKlass.T_SHORT:
         {
           long offset = baseOffsetInBytes(BasicType.T_SHORT) + index * getHeap().getShortSize();
           visitor.doShort(new ShortField(id, offset, false), false);
           break;
         }
       case TypeArrayKlass.T_INT:
         {
           long offset = baseOffsetInBytes(BasicType.T_INT) + index * getHeap().getIntSize();
           visitor.doInt(new IntField(id, offset, false), false);
           break;
         }
       case TypeArrayKlass.T_LONG:
         {
           long offset = baseOffsetInBytes(BasicType.T_LONG) + index * getHeap().getLongSize();
           visitor.doLong(new LongField(id, offset, false), false);
           break;
         }
     }
   }
 }
コード例 #2
0
 public void printValueOn(PrintStream tty) {
   TypeArrayKlass klass = (TypeArrayKlass) getKlass();
   tty.print(klass.getTypeName());
 }