Program: 149885
Project: 149885
Buggy source:
/** 
 * Copy an object (and, recursively, any of its fields or elements that are references) from host jdk address space into image.
 * @param jdkObject object to be copied
 * @param allocOnly if allocOnly is true, the TIB and other reference fields are not recursively copied
 * @param overwriteAddress if !overwriteAddress.isMax(), then copy object to given address
 * @param parentObject
 * @return offset of copied object within image, in bytes(OBJECT_NOT_PRESENT --> object not copied: it's not part of bootimage)
 */
private static Address copyToBootImage(Object jdkObject,boolean allocOnly,Address overwriteAddress,Object parentObject) throws IllegalAccessException {
  try {
    BootImageMap.Entry mapEntry=BootImageMap.findOrCreateEntry(jdkObject);
    if ((!mapEntry.imageAddress.EQ(OBJECT_NOT_ALLOCATED)) && overwriteAddress.isMax())     return mapEntry.imageAddress;
    if (verbose >= 2)     depth++;
    Class jdkType=jdkObject.getClass();
    VM_Type rvmType=getRvmType(jdkType);
    if (rvmType == null) {
      if (verbose >= 2)       traverseObject(jdkObject);
      if (verbose >= 2)       depth--;
      return OBJECT_NOT_PRESENT;
    }
    if (jdkType.isArray()) {
      VM_Array rvmArrayType=rvmType.asArray();
      int arrayCount=Array.getLength(jdkObject);
      Address arrayImageAddress=(overwriteAddress.isMax()) ? bootImage.allocateArray(rvmArrayType,arrayCount) : overwriteAddress;
      mapEntry.imageAddress=arrayImageAddress;
      if (verbose >= 2) {
        if (depth == depthCutoff)         say(SPACES.substring(0,depth + 1),"String_Node_Str");
 else         if (depth < depthCutoff) {
          String tab=SPACES.substring(0,depth + 1);
          if (depth == 0 && jtocCount >= 0)           tab=tab + "String_Node_Str" + String.valueOf(jtocCount)+ "String_Node_Str";
          int arraySize=rvmArrayType.getInstanceSize(arrayCount);
          say(tab,"String_Node_Str",jdkType.getName(),"String_Node_Str",String.valueOf(arrayCount),(arraySize >= LARGE_ARRAY_SIZE) ? "String_Node_Str" : "String_Node_Str");
        }
      }
      VM_Type rvmElementType=rvmArrayType.getElementType();
      if (false && rvmElementType.equals(VM_Type.IntType)) {
        if (parentObject != null) {
          Class parentObjectType=parentObject.getClass();
          VM.sysWrite("String_Node_Str",4 * ((int[])jdkObject).length);
          VM.sysWriteln("String_Node_Str",parentObjectType.toString());
        }
 else {
          VM.sysWriteln("String_Node_Str");
        }
      }
      if (rvmElementType.isPrimitiveType()) {
        if (rvmElementType.equals(VM_Type.BooleanType)) {
          boolean[] values=(boolean[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setByte(arrayImageAddress.plus(i),values[i] ? 1 : 0);
        }
 else         if (rvmElementType.equals(VM_Type.ByteType)) {
          byte[] values=(byte[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setByte(arrayImageAddress.plus(i),values[i]);
        }
 else         if (rvmElementType.equals(VM_Type.CharType)) {
          char[] values=(char[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setHalfWord(arrayImageAddress.plus(i << LOG_BYTES_IN_CHAR),values[i]);
        }
 else         if (rvmElementType.equals(VM_Type.ShortType)) {
          short[] values=(short[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setHalfWord(arrayImageAddress.plus(i << LOG_BYTES_IN_SHORT),values[i]);
        }
 else         if (rvmElementType.equals(VM_Type.IntType)) {
          int[] values=(int[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setFullWord(arrayImageAddress.plus(i << LOG_BYTES_IN_INT),values[i]);
        }
 else         if (rvmElementType.equals(VM_Type.LongType)) {
          long[] values=(long[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setDoubleWord(arrayImageAddress.plus(i << LOG_BYTES_IN_LONG),values[i]);
        }
 else         if (rvmElementType.equals(VM_Type.FloatType)) {
          float[] values=(float[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setFullWord(arrayImageAddress.plus(i << LOG_BYTES_IN_FLOAT),Float.floatToIntBits(values[i]));
        }
 else         if (rvmElementType.equals(VM_Type.DoubleType)) {
          double[] values=(double[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setDoubleWord(arrayImageAddress.plus(i << LOG_BYTES_IN_DOUBLE),Double.doubleToLongBits(values[i]));
        }
 else         fail("String_Node_Str" + rvmArrayType);
      }
 else {
        Object[] values=(Object[])jdkObject;
        Class jdkClass=jdkObject.getClass();
        if (!allocOnly) {
          for (int i=0; i < arrayCount; ++i) {
            if (values[i] != null) {
              if (verbose >= 2)               traceContext.push(values[i].getClass().getName(),jdkClass.getName(),i);
              Address imageAddress=copyToBootImage(values[i],allocOnly,Address.max(),jdkObject);
              if (imageAddress.EQ(OBJECT_NOT_PRESENT)) {
                if (verbose >= 2)                 traceContext.traceObjectNotInBootImage();
                bootImage.setNullAddressWord(arrayImageAddress.plus(i << LOG_BYTES_IN_ADDRESS),true,false);
              }
 else {
                bootImage.setAddressWord(arrayImageAddress.plus(i << LOG_BYTES_IN_ADDRESS),imageAddress.toWord(),true);
              }
              if (verbose >= 2)               traceContext.pop();
            }
 else {
              bootImage.setNullAddressWord(arrayImageAddress.plus(i << LOG_BYTES_IN_ADDRESS),true,true);
            }
          }
        }
      }
    }
 else {
      if (rvmType == VM_Type.AddressArrayType) {
        if (verbose >= 2)         depth--;
        AddressArray addrArray=(AddressArray)jdkObject;
        Object backing=addrArray.getBacking();
        return copyMagicArrayToBootImage(backing,rvmType.asArray(),allocOnly,overwriteAddress,parentObject);
      }
      if (rvmType == VM_Type.ObjectReferenceArrayType) {
        if (verbose >= 2)         depth--;
        ObjectReferenceArray orArray=(ObjectReferenceArray)jdkObject;
        Object backing=orArray.getBacking();
        return copyMagicArrayToBootImage(backing,rvmType.asArray(),allocOnly,overwriteAddress,parentObject);
      }
      if (rvmType == VM_Type.OffsetArrayType) {
        if (verbose >= 2)         depth--;
        OffsetArray addrArray=(OffsetArray)jdkObject;
        Object backing=addrArray.getBacking();
        return copyMagicArrayToBootImage(backing,rvmType.asArray(),allocOnly,overwriteAddress,parentObject);
      }
      if (rvmType == VM_Type.WordArrayType) {
        if (verbose >= 2)         depth--;
        WordArray addrArray=(WordArray)jdkObject;
        Object backing=addrArray.getBacking();
        return copyMagicArrayToBootImage(backing,rvmType.asArray(),allocOnly,overwriteAddress,parentObject);
      }
      if (rvmType == VM_Type.ExtentArrayType) {
        if (verbose >= 2)         depth--;
        ExtentArray addrArray=(ExtentArray)jdkObject;
        Object backing=addrArray.getBacking();
        return copyMagicArrayToBootImage(backing,rvmType.asArray(),allocOnly,overwriteAddress,parentObject);
      }
      if (rvmType == VM_Type.CodeArrayType) {
        if (verbose >= 2)         depth--;
        VM_CodeArray codeArray=(VM_CodeArray)jdkObject;
        Object backing=codeArray.getBacking();
        return copyMagicArrayToBootImage(backing,rvmType.asArray(),allocOnly,overwriteAddress,parentObject);
      }
      if (rvmType.getTypeRef().isMagicType()) {
        VM.sysWriteln("String_Node_Str" + rvmType.getDescriptor().toString() + "String_Node_Str"+ parentObject.getClass().toString());
        VM.sysFail("String_Node_Str");
      }
      VM_Class rvmScalarType=rvmType.asClass();
      Address scalarImageAddress=(overwriteAddress.isMax()) ? bootImage.allocateScalar(rvmScalarType) : overwriteAddress;
      mapEntry.imageAddress=scalarImageAddress;
      if (verbose >= 2) {
        if (depth == depthCutoff)         say(SPACES.substring(0,depth + 1),"String_Node_Str");
 else         if (depth < depthCutoff) {
          String tab=SPACES.substring(0,depth + 1);
          if (depth == 0 && jtocCount >= 0)           tab=tab + "String_Node_Str" + String.valueOf(jtocCount)+ "String_Node_Str";
          int scalarSize=rvmScalarType.getInstanceSize();
          say(tab,"String_Node_Str",jdkType.getName(),"String_Node_Str",String.valueOf(scalarSize),(scalarSize >= LARGE_SCALAR_SIZE) ? "String_Node_Str" : "String_Node_Str");
        }
      }
      VM_Field[] rvmFields=rvmScalarType.getInstanceFields();
      for (int i=0, n=rvmFields.length; i < n; ++i) {
        VM_Field rvmField=rvmFields[i];
        VM_TypeReference rvmFieldType=rvmField.getType();
        Address rvmFieldAddress=scalarImageAddress.plus(rvmField.getOffset());
        String rvmFieldName=rvmField.getName().toString();
        Field jdkFieldAcc=getJdkFieldAccessor(jdkType,i,INSTANCE_FIELD);
        if (jdkFieldAcc == null) {
          if (!copyKnownClasspathInstanceField(jdkObject,rvmFieldName,rvmFieldType,rvmFieldAddress)) {
            if (verbose >= 2)             traceContext.push(rvmFieldType.toString(),jdkType.getName(),rvmFieldName);
            if (verbose >= 2)             traceContext.traceFieldNotInHostJdk();
            if (verbose >= 2)             traceContext.pop();
            if (rvmFieldType.isPrimitiveType()) {
switch (rvmField.getType().getMemoryBytes()) {
case 1:
                bootImage.setByte(rvmFieldAddress,0);
              break;
case 2:
            bootImage.setHalfWord(rvmFieldAddress,0);
          break;
case 4:
        bootImage.setFullWord(rvmFieldAddress,0);
      break;
case 8:
    bootImage.setDoubleWord(rvmFieldAddress,0L);
  break;
default :
fail("String_Node_Str" + rvmFieldType);
break;
}
}
 else {
bootImage.setNullAddressWord(rvmFieldAddress,true,false);
}
}
continue;
}
if (rvmFieldType.isPrimitiveType()) {
if (rvmFieldType.isBooleanType()) {
bootImage.setByte(rvmFieldAddress,jdkFieldAcc.getBoolean(jdkObject) ? 1 : 0);
}
 else if (rvmFieldType.isByteType()) {
bootImage.setByte(rvmFieldAddress,jdkFieldAcc.getByte(jdkObject));
}
 else if (rvmFieldType.isCharType()) {
bootImage.setHalfWord(rvmFieldAddress,jdkFieldAcc.getChar(jdkObject));
}
 else if (rvmFieldType.isShortType()) {
bootImage.setHalfWord(rvmFieldAddress,jdkFieldAcc.getShort(jdkObject));
}
 else if (rvmFieldType.isIntType()) {
try {
bootImage.setFullWord(rvmFieldAddress,jdkFieldAcc.getInt(jdkObject));
}
 catch (IllegalArgumentException ex) {
System.out.println("String_Node_Str" + rvmScalarType + "String_Node_Str"+ rvmField);
throw ex;
}
}
 else if (rvmFieldType.isLongType()) {
bootImage.setDoubleWord(rvmFieldAddress,jdkFieldAcc.getLong(jdkObject));
}
 else if (rvmFieldType.isFloatType()) {
float f=jdkFieldAcc.getFloat(jdkObject);
bootImage.setFullWord(rvmFieldAddress,Float.floatToIntBits(f));
}
 else if (rvmFieldType.isDoubleType()) {
double d=jdkFieldAcc.getDouble(jdkObject);
bootImage.setDoubleWord(rvmFieldAddress,Double.doubleToLongBits(d));
}
 else if (rvmFieldType.equals(VM_TypeReference.Address) || rvmFieldType.equals(VM_TypeReference.Word) || rvmFieldType.equals(VM_TypeReference.Extent)|| rvmFieldType.equals(VM_TypeReference.Offset)) {
Object o=jdkFieldAcc.get(jdkObject);
String msg="String_Node_Str" + rvmField.toString();
boolean warn=rvmFieldType.equals(VM_TypeReference.Address);
bootImage.setAddressWord(rvmFieldAddress,getWordValue(o,msg,warn),false);
}
 else {
fail("String_Node_Str" + rvmFieldType);
}
}
 else {
Object value=jdkFieldAcc.get(jdkObject);
if (!allocOnly) {
if (value != null) {
Class jdkClass=jdkFieldAcc.getDeclaringClass();
if (verbose >= 2) traceContext.push(value.getClass().getName(),jdkClass.getName(),jdkFieldAcc.getName());
Address imageAddress=copyToBootImage(value,allocOnly,Address.max(),jdkObject);
if (imageAddress.EQ(OBJECT_NOT_PRESENT)) {
if (verbose >= 2) traceContext.traceObjectNotInBootImage();
bootImage.setNullAddressWord(rvmFieldAddress,true,false);
}
 else bootImage.setAddressWord(rvmFieldAddress,imageAddress.toWord(),!rvmField.isFinal());
if (verbose >= 2) traceContext.pop();
}
 else {
bootImage.setNullAddressWord(rvmFieldAddress,true,true);
}
}
}
}
}
if (!allocOnly) {
if (verbose >= 2) traceContext.push("String_Node_Str",jdkObject.getClass().getName(),"String_Node_Str");
Address tibImageAddress=copyToBootImage(rvmType.getTypeInformationBlock(),allocOnly,Address.max(),jdkObject);
if (verbose >= 2) traceContext.pop();
if (tibImageAddress.EQ(OBJECT_NOT_ALLOCATED)) {
fail("String_Node_Str" + jdkObject);
}
VM_ObjectModel.setTIB(bootImage,mapEntry.imageAddress,tibImageAddress,rvmType);
}
if (verbose >= 2) depth--;
return mapEntry.imageAddress;
}
 catch (Error e) {
e=new Error(e.getMessage() + "String_Node_Str" + jdkObject+ (jdkObject != null ? "String_Node_Str" + jdkObject.getClass() : "String_Node_Str")+ "String_Node_Str"+ parentObject+ (parentObject != null ? "String_Node_Str" + parentObject.getClass() : "String_Node_Str"),e.getCause() != null ? e.getCause() : e);
throw e;
}
}

Fixed version (ground truth):
/** 
 * Copy an object (and, recursively, any of its fields or elements that are references) from host jdk address space into image.
 * @param jdkObject object to be copied
 * @param allocOnly if allocOnly is true, the TIB and other reference fields are not recursively copied
 * @param overwriteAddress if !overwriteAddress.isMax(), then copy object to given address
 * @param parentObject
 * @return offset of copied object within image, in bytes(OBJECT_NOT_PRESENT --> object not copied: it's not part of bootimage)
 */
private static Address copyToBootImage(Object jdkObject,boolean allocOnly,Address overwriteAddress,Object parentObject) throws IllegalAccessException {
  try {
    BootImageMap.Entry mapEntry=BootImageMap.findOrCreateEntry(jdkObject);
    if ((!mapEntry.imageAddress.EQ(OBJECT_NOT_ALLOCATED)) && overwriteAddress.isMax())     return mapEntry.imageAddress;
    if (verbose >= 2)     depth++;
    Class jdkType=jdkObject.getClass();
    VM_Type rvmType=getRvmType(jdkType);
    if (rvmType == null) {
      if (verbose >= 2)       traverseObject(jdkObject);
      if (verbose >= 2)       depth--;
      return OBJECT_NOT_PRESENT;
    }
    if (jdkType.isArray()) {
      VM_Array rvmArrayType=rvmType.asArray();
      int arrayCount=Array.getLength(jdkObject);
      Address arrayImageAddress=(overwriteAddress.isMax()) ? bootImage.allocateArray(rvmArrayType,arrayCount) : overwriteAddress;
      mapEntry.imageAddress=arrayImageAddress;
      if (verbose >= 2) {
        if (depth == depthCutoff)         say(SPACES.substring(0,depth + 1),"String_Node_Str");
 else         if (depth < depthCutoff) {
          String tab=SPACES.substring(0,depth + 1);
          if (depth == 0 && jtocCount >= 0)           tab=tab + "String_Node_Str" + String.valueOf(jtocCount)+ "String_Node_Str";
          int arraySize=rvmArrayType.getInstanceSize(arrayCount);
          say(tab,"String_Node_Str",jdkType.getName(),"String_Node_Str",String.valueOf(arrayCount),(arraySize >= LARGE_ARRAY_SIZE) ? "String_Node_Str" : "String_Node_Str");
        }
      }
      VM_Type rvmElementType=rvmArrayType.getElementType();
      if (false && rvmElementType.equals(VM_Type.IntType)) {
        if (parentObject != null) {
          Class parentObjectType=parentObject.getClass();
          VM.sysWrite("String_Node_Str",4 * ((int[])jdkObject).length);
          VM.sysWriteln("String_Node_Str",parentObjectType.toString());
        }
 else {
          VM.sysWriteln("String_Node_Str");
        }
      }
      if (rvmElementType.isPrimitiveType()) {
        if (rvmElementType.equals(VM_Type.BooleanType)) {
          boolean[] values=(boolean[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setByte(arrayImageAddress.plus(i),values[i] ? 1 : 0);
        }
 else         if (rvmElementType.equals(VM_Type.ByteType)) {
          byte[] values=(byte[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setByte(arrayImageAddress.plus(i),values[i]);
        }
 else         if (rvmElementType.equals(VM_Type.CharType)) {
          char[] values=(char[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setHalfWord(arrayImageAddress.plus(i << LOG_BYTES_IN_CHAR),values[i]);
        }
 else         if (rvmElementType.equals(VM_Type.ShortType)) {
          short[] values=(short[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setHalfWord(arrayImageAddress.plus(i << LOG_BYTES_IN_SHORT),values[i]);
        }
 else         if (rvmElementType.equals(VM_Type.IntType)) {
          int[] values=(int[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setFullWord(arrayImageAddress.plus(i << LOG_BYTES_IN_INT),values[i]);
        }
 else         if (rvmElementType.equals(VM_Type.LongType)) {
          long[] values=(long[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setDoubleWord(arrayImageAddress.plus(i << LOG_BYTES_IN_LONG),values[i]);
        }
 else         if (rvmElementType.equals(VM_Type.FloatType)) {
          float[] values=(float[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setFullWord(arrayImageAddress.plus(i << LOG_BYTES_IN_FLOAT),Float.floatToIntBits(values[i]));
        }
 else         if (rvmElementType.equals(VM_Type.DoubleType)) {
          double[] values=(double[])jdkObject;
          for (int i=0; i < arrayCount; ++i)           bootImage.setDoubleWord(arrayImageAddress.plus(i << LOG_BYTES_IN_DOUBLE),Double.doubleToLongBits(values[i]));
        }
 else {
          fail("String_Node_Str" + rvmArrayType);
        }
      }
 else {
        Object[] values=(Object[])jdkObject;
        Class jdkClass=jdkObject.getClass();
        if (!allocOnly) {
          for (int i=0; i < arrayCount; ++i) {
            if (values[i] != null) {
              if (verbose >= 2)               traceContext.push(values[i].getClass().getName(),jdkClass.getName(),i);
              Address imageAddress=copyToBootImage(values[i],allocOnly,Address.max(),jdkObject);
              if (imageAddress.EQ(OBJECT_NOT_PRESENT)) {
                if (verbose >= 2)                 traceContext.traceObjectNotInBootImage();
                bootImage.setNullAddressWord(arrayImageAddress.plus(i << LOG_BYTES_IN_ADDRESS),true,false);
              }
 else {
                bootImage.setAddressWord(arrayImageAddress.plus(i << LOG_BYTES_IN_ADDRESS),imageAddress.toWord(),true);
              }
              if (verbose >= 2)               traceContext.pop();
            }
 else {
              bootImage.setNullAddressWord(arrayImageAddress.plus(i << LOG_BYTES_IN_ADDRESS),true,true);
            }
          }
        }
      }
    }
 else {
      if (rvmType == VM_Type.AddressArrayType) {
        if (verbose >= 2)         depth--;
        AddressArray addrArray=(AddressArray)jdkObject;
        Object backing=addrArray.getBacking();
        return copyMagicArrayToBootImage(backing,rvmType.asArray(),allocOnly,overwriteAddress,parentObject);
      }
      if (rvmType == VM_Type.ObjectReferenceArrayType) {
        if (verbose >= 2)         depth--;
        ObjectReferenceArray orArray=(ObjectReferenceArray)jdkObject;
        Object backing=orArray.getBacking();
        return copyMagicArrayToBootImage(backing,rvmType.asArray(),allocOnly,overwriteAddress,parentObject);
      }
      if (rvmType == VM_Type.OffsetArrayType) {
        if (verbose >= 2)         depth--;
        OffsetArray addrArray=(OffsetArray)jdkObject;
        Object backing=addrArray.getBacking();
        return copyMagicArrayToBootImage(backing,rvmType.asArray(),allocOnly,overwriteAddress,parentObject);
      }
      if (rvmType == VM_Type.WordArrayType) {
        if (verbose >= 2)         depth--;
        WordArray addrArray=(WordArray)jdkObject;
        Object backing=addrArray.getBacking();
        return copyMagicArrayToBootImage(backing,rvmType.asArray(),allocOnly,overwriteAddress,parentObject);
      }
      if (rvmType == VM_Type.ExtentArrayType) {
        if (verbose >= 2)         depth--;
        ExtentArray addrArray=(ExtentArray)jdkObject;
        Object backing=addrArray.getBacking();
        return copyMagicArrayToBootImage(backing,rvmType.asArray(),allocOnly,overwriteAddress,parentObject);
      }
      if (rvmType == VM_Type.CodeArrayType) {
        if (verbose >= 2)         depth--;
        VM_CodeArray codeArray=(VM_CodeArray)jdkObject;
        Object backing=codeArray.getBacking();
        return copyMagicArrayToBootImage(backing,rvmType.asArray(),allocOnly,overwriteAddress,parentObject);
      }
      if (rvmType.getTypeRef().isMagicType()) {
        VM.sysWriteln("String_Node_Str" + rvmType.getDescriptor().toString() + "String_Node_Str"+ parentObject.getClass().toString());
        VM.sysFail("String_Node_Str");
      }
      VM_Class rvmScalarType=rvmType.asClass();
      Address scalarImageAddress=(overwriteAddress.isMax()) ? bootImage.allocateScalar(rvmScalarType) : overwriteAddress;
      mapEntry.imageAddress=scalarImageAddress;
      if (verbose >= 2) {
        if (depth == depthCutoff)         say(SPACES.substring(0,depth + 1),"String_Node_Str");
 else         if (depth < depthCutoff) {
          String tab=SPACES.substring(0,depth + 1);
          if (depth == 0 && jtocCount >= 0)           tab=tab + "String_Node_Str" + String.valueOf(jtocCount)+ "String_Node_Str";
          int scalarSize=rvmScalarType.getInstanceSize();
          say(tab,"String_Node_Str",jdkType.getName(),"String_Node_Str",String.valueOf(scalarSize),(scalarSize >= LARGE_SCALAR_SIZE) ? "String_Node_Str" : "String_Node_Str");
        }
      }
      VM_Field[] rvmFields=rvmScalarType.getInstanceFields();
      for (int i=0, n=rvmFields.length; i < n; ++i) {
        VM_Field rvmField=rvmFields[i];
        VM_TypeReference rvmFieldType=rvmField.getType();
        Address rvmFieldAddress=scalarImageAddress.plus(rvmField.getOffset());
        String rvmFieldName=rvmField.getName().toString();
        Field jdkFieldAcc=getJdkFieldAccessor(jdkType,i,INSTANCE_FIELD);
        if (jdkFieldAcc == null) {
          if (!copyKnownClasspathInstanceField(jdkObject,rvmFieldName,rvmFieldType,rvmFieldAddress)) {
            if (verbose >= 2)             traceContext.push(rvmFieldType.toString(),jdkType.getName(),rvmFieldName);
            if (verbose >= 2)             traceContext.traceFieldNotInHostJdk();
            if (verbose >= 2)             traceContext.pop();
            if (rvmFieldType.isPrimitiveType()) {
switch (rvmField.getType().getMemoryBytes()) {
case 1:
                bootImage.setByte(rvmFieldAddress,0);
              break;
case 2:
            bootImage.setHalfWord(rvmFieldAddress,0);
          break;
case 4:
        bootImage.setFullWord(rvmFieldAddress,0);
      break;
case 8:
    bootImage.setDoubleWord(rvmFieldAddress,0L);
  break;
default :
fail("String_Node_Str" + rvmFieldType);
break;
}
}
 else {
bootImage.setNullAddressWord(rvmFieldAddress,true,false);
}
}
continue;
}
if (rvmFieldType.isPrimitiveType()) {
if (rvmFieldType.isBooleanType()) {
bootImage.setByte(rvmFieldAddress,jdkFieldAcc.getBoolean(jdkObject) ? 1 : 0);
}
 else if (rvmFieldType.isByteType()) {
bootImage.setByte(rvmFieldAddress,jdkFieldAcc.getByte(jdkObject));
}
 else if (rvmFieldType.isCharType()) {
bootImage.setHalfWord(rvmFieldAddress,jdkFieldAcc.getChar(jdkObject));
}
 else if (rvmFieldType.isShortType()) {
bootImage.setHalfWord(rvmFieldAddress,jdkFieldAcc.getShort(jdkObject));
}
 else if (rvmFieldType.isIntType()) {
try {
bootImage.setFullWord(rvmFieldAddress,jdkFieldAcc.getInt(jdkObject));
}
 catch (IllegalArgumentException ex) {
System.out.println("String_Node_Str" + rvmScalarType + "String_Node_Str"+ rvmField);
throw ex;
}
}
 else if (rvmFieldType.isLongType()) {
bootImage.setDoubleWord(rvmFieldAddress,jdkFieldAcc.getLong(jdkObject));
}
 else if (rvmFieldType.isFloatType()) {
float f=jdkFieldAcc.getFloat(jdkObject);
bootImage.setFullWord(rvmFieldAddress,Float.floatToIntBits(f));
}
 else if (rvmFieldType.isDoubleType()) {
double d=jdkFieldAcc.getDouble(jdkObject);
bootImage.setDoubleWord(rvmFieldAddress,Double.doubleToLongBits(d));
}
 else if (rvmFieldType.equals(VM_TypeReference.Address) || rvmFieldType.equals(VM_TypeReference.Word) || rvmFieldType.equals(VM_TypeReference.Extent)|| rvmFieldType.equals(VM_TypeReference.Offset)) {
Object o=jdkFieldAcc.get(jdkObject);
String msg="String_Node_Str" + rvmField.toString();
boolean warn=rvmFieldType.equals(VM_TypeReference.Address);
bootImage.setAddressWord(rvmFieldAddress,getWordValue(o,msg,warn),false);
}
 else {
fail("String_Node_Str" + rvmFieldType);
}
}
 else {
Object value=jdkFieldAcc.get(jdkObject);
if (!allocOnly) {
if (value != null) {
Class jdkClass=jdkFieldAcc.getDeclaringClass();
if (verbose >= 2) traceContext.push(value.getClass().getName(),jdkClass.getName(),jdkFieldAcc.getName());
Address imageAddress=copyToBootImage(value,allocOnly,Address.max(),jdkObject);
if (imageAddress.EQ(OBJECT_NOT_PRESENT)) {
if (verbose >= 2) traceContext.traceObjectNotInBootImage();
bootImage.setNullAddressWord(rvmFieldAddress,true,false);
}
 else bootImage.setAddressWord(rvmFieldAddress,imageAddress.toWord(),!rvmField.isFinal());
if (verbose >= 2) traceContext.pop();
}
 else {
bootImage.setNullAddressWord(rvmFieldAddress,true,true);
}
}
}
}
}
if (!allocOnly) {
if (verbose >= 2) traceContext.push("String_Node_Str",jdkObject.getClass().getName(),"String_Node_Str");
Address tibImageAddress=copyToBootImage(rvmType.getTypeInformationBlock(),allocOnly,Address.max(),jdkObject);
if (verbose >= 2) traceContext.pop();
if (tibImageAddress.EQ(OBJECT_NOT_ALLOCATED)) {
fail("String_Node_Str" + jdkObject);
}
VM_ObjectModel.setTIB(bootImage,mapEntry.imageAddress,tibImageAddress,rvmType);
}
if (verbose >= 2) depth--;
return mapEntry.imageAddress;
}
 catch (Error e) {
e=new Error(e.getMessage() + "String_Node_Str" + jdkObject+ (jdkObject != null ? "String_Node_Str" + jdkObject.getClass() : "String_Node_Str")+ "String_Node_Str"+ parentObject+ (parentObject != null ? "String_Node_Str" + parentObject.getClass() : "String_Node_Str"),e.getCause() != null ? e.getCause() : e);
throw e;
}
}