// Creates new field from index in fields TypeArray
 private Field newField(int index) {
   TypeArray fields = getFields();
   short signatureIndex = fields.getShortAt(index + SIGNATURE_INDEX_OFFSET);
   FieldType type = new FieldType((Symbol) getConstants().getObjAt(signatureIndex));
   if (type.isOop()) {
     if (VM.getVM().isCompressedOopsEnabled()) {
       return new NarrowOopField(this, index);
     } else {
       return new OopField(this, index);
     }
   }
   if (type.isByte()) {
     return new ByteField(this, index);
   }
   if (type.isChar()) {
     return new CharField(this, index);
   }
   if (type.isDouble()) {
     return new DoubleField(this, index);
   }
   if (type.isFloat()) {
     return new FloatField(this, index);
   }
   if (type.isInt()) {
     return new IntField(this, index);
   }
   if (type.isLong()) {
     return new LongField(this, index);
   }
   if (type.isShort()) {
     return new ShortField(this, index);
   }
   if (type.isBoolean()) {
     return new BooleanField(this, index);
   }
   throw new RuntimeException("Illegal field type at index " + index);
 }
 private void visitField(OopVisitor visitor, FieldType type, int index) {
   Field f = newField(index);
   if (type.isOop()) {
     visitor.doOop((OopField) f, false);
     return;
   }
   if (type.isByte()) {
     visitor.doByte((ByteField) f, false);
     return;
   }
   if (type.isChar()) {
     visitor.doChar((CharField) f, false);
     return;
   }
   if (type.isDouble()) {
     visitor.doDouble((DoubleField) f, false);
     return;
   }
   if (type.isFloat()) {
     visitor.doFloat((FloatField) f, false);
     return;
   }
   if (type.isInt()) {
     visitor.doInt((IntField) f, false);
     return;
   }
   if (type.isLong()) {
     visitor.doLong((LongField) f, false);
     return;
   }
   if (type.isShort()) {
     visitor.doShort((ShortField) f, false);
     return;
   }
   if (type.isBoolean()) {
     visitor.doBoolean((BooleanField) f, false);
     return;
   }
 }