Program: 150273
Project: 150273
Buggy source:
private static int copyMagicArrayToBootImage(Object jdkObject,VM_Array rvmArrayType,boolean allocOnly,int overwriteOffset,Object parentObject) throws IllegalAccessException {
  BootImageMap.Entry mapEntry=BootImageMap.findOrCreateEntry(jdkObject);
  if (mapEntry.imageOffset != OBJECT_NOT_ALLOCATED && overwriteOffset == -1)   return mapEntry.imageOffset;
  if (verbose >= 2)   depth++;
  int arrayCount=Array.getLength(jdkObject);
  int arrayImageOffset=(overwriteOffset == -1) ? bootImage.allocateArray(rvmArrayType,arrayCount) : overwriteOffset;
  mapEntry.imageOffset=arrayImageOffset;
  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",rvmArrayType.toString(),"String_Node_Str",String.valueOf(arrayCount),(arraySize >= LARGE_ARRAY_SIZE) ? "String_Node_Str" : "String_Node_Str");
    }
  }
  VM_Type rvmElementType=rvmArrayType.getElementType();
  if (rvmElementType.equals(VM_Type.CodeType)) {
    if (VM.BuildForIA32) {
      byte values[]=(byte[])jdkObject;
      for (int i=0; i < arrayCount; ++i)       bootImage.setByte(arrayImageOffset + i,values[i]);
    }
 else {
      int values[]=(int[])jdkObject;
      for (int i=0; i < arrayCount; ++i)       bootImage.setFullWord(arrayImageOffset + (i << LOG_BYTES_IN_INT),values[i]);
    }
  }
 else   if (rvmElementType.equals(VM_Type.AddressType)) {
    VM_Address values[]=(VM_Address[])jdkObject;
    for (int i=0; i < arrayCount; i++) {
      VM_Address addr=values[i];
      String msg="String_Node_Str";
      bootImage.setAddressWord(arrayImageOffset + (i << LOG_BYTES_IN_ADDRESS),getAddressValue(addr,msg,true));
    }
  }
 else   if (rvmElementType.equals(VM_Type.WordType)) {
    VM_Word values[]=(VM_Word[])jdkObject;
    for (int i=0; i < arrayCount; i++) {
      String msg="String_Node_Str";
      VM_Address addr=values[i].toAddress();
      bootImage.setAddressWord(arrayImageOffset + (i << LOG_BYTES_IN_ADDRESS),getAddressValue(addr,msg,true));
    }
  }
 else   if (rvmElementType.equals(VM_Type.OffsetType)) {
    VM_Offset values[]=(VM_Offset[])jdkObject;
    for (int i=0; i < arrayCount; i++) {
      String msg="String_Node_Str" + i;
      VM_Address addr=values[i].toWord().toAddress();
      bootImage.setAddressWord(arrayImageOffset + (i << LOG_BYTES_IN_ADDRESS),getAddressValue(addr,msg,true));
    }
  }
 else   if (rvmElementType.equals(VM_Type.ExtentType)) {
    VM_Extent values[]=(VM_Extent[])jdkObject;
    for (int i=0; i < arrayCount; i++) {
      String msg="String_Node_Str";
      VM_Address addr=values[i].toWord().toAddress();
      bootImage.setAddressWord(arrayImageOffset + (i << LOG_BYTES_IN_ADDRESS),getAddressValue(addr,msg,true));
    }
  }
 else {
    fail("String_Node_Str" + rvmArrayType);
  }
  if (!allocOnly) {
    if (verbose >= 2)     traceContext.push("String_Node_Str",jdkObject.getClass().getName(),"String_Node_Str");
    int tibImageOffset=copyToBootImage(rvmArrayType.getTypeInformationBlock(),allocOnly,-1,jdkObject);
    if (verbose >= 2)     traceContext.pop();
    if (tibImageOffset == OBJECT_NOT_ALLOCATED)     fail("String_Node_Str" + jdkObject);
    int tibAddress=bootImageAddress + tibImageOffset;
    VM_ObjectModel.setTIB(bootImage,mapEntry.imageOffset,VM_Address.fromIntZeroExtend(tibAddress),rvmArrayType);
  }
  if (verbose >= 2)   depth--;
  return mapEntry.imageOffset;
}

Fixed version (ground truth):
private static int copyMagicArrayToBootImage(Object jdkObject,VM_Array rvmArrayType,boolean allocOnly,int overwriteOffset,Object parentObject) throws IllegalAccessException {
  BootImageMap.Entry mapEntry=BootImageMap.findOrCreateEntry(jdkObject);
  if (mapEntry.imageOffset != OBJECT_NOT_ALLOCATED && overwriteOffset == -1)   return mapEntry.imageOffset;
  if (verbose >= 2)   depth++;
  int arrayCount=Array.getLength(jdkObject);
  int arrayImageOffset=(overwriteOffset == -1) ? bootImage.allocateArray(rvmArrayType,arrayCount) : overwriteOffset;
  mapEntry.imageOffset=arrayImageOffset;
  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",rvmArrayType.toString(),"String_Node_Str",String.valueOf(arrayCount),(arraySize >= LARGE_ARRAY_SIZE) ? "String_Node_Str" : "String_Node_Str");
    }
  }
  VM_Type rvmElementType=rvmArrayType.getElementType();
  if (rvmElementType.equals(VM_Type.CodeType)) {
    if (VM.BuildForIA32) {
      byte values[]=(byte[])jdkObject;
      for (int i=0; i < arrayCount; ++i)       bootImage.setByte(arrayImageOffset + i,values[i]);
    }
 else {
      int values[]=(int[])jdkObject;
      for (int i=0; i < arrayCount; ++i)       bootImage.setFullWord(arrayImageOffset + (i << LOG_BYTES_IN_INT),values[i]);
    }
  }
 else   if (rvmElementType.equals(VM_Type.AddressType)) {
    VM_Address values[]=(VM_Address[])jdkObject;
    for (int i=0; i < arrayCount; i++) {
      VM_Address addr=values[i];
      String msg="String_Node_Str";
      bootImage.setAddressWord(arrayImageOffset + (i << LOG_BYTES_IN_ADDRESS),getAddressValue(addr,msg,true));
    }
  }
 else   if (rvmElementType.equals(VM_Type.WordType)) {
    VM_Word values[]=(VM_Word[])jdkObject;
    for (int i=0; i < arrayCount; i++) {
      String msg="String_Node_Str";
      VM_Word addr=values[i];
      bootImage.setAddressWord(arrayImageOffset + (i << LOG_BYTES_IN_ADDRESS),getAddressValue(addr,msg,false));
    }
  }
 else   if (rvmElementType.equals(VM_Type.OffsetType)) {
    VM_Offset values[]=(VM_Offset[])jdkObject;
    for (int i=0; i < arrayCount; i++) {
      String msg="String_Node_Str" + i;
      VM_Offset addr=values[i];
      bootImage.setAddressWord(arrayImageOffset + (i << LOG_BYTES_IN_ADDRESS),getAddressValue(addr,msg,false));
    }
  }
 else   if (rvmElementType.equals(VM_Type.ExtentType)) {
    VM_Extent values[]=(VM_Extent[])jdkObject;
    for (int i=0; i < arrayCount; i++) {
      String msg="String_Node_Str";
      VM_Extent addr=values[i];
      bootImage.setAddressWord(arrayImageOffset + (i << LOG_BYTES_IN_ADDRESS),getAddressValue(addr,msg,false));
    }
  }
 else {
    fail("String_Node_Str" + rvmArrayType);
  }
  if (!allocOnly) {
    if (verbose >= 2)     traceContext.push("String_Node_Str",jdkObject.getClass().getName(),"String_Node_Str");
    int tibImageOffset=copyToBootImage(rvmArrayType.getTypeInformationBlock(),allocOnly,-1,jdkObject);
    if (verbose >= 2)     traceContext.pop();
    if (tibImageOffset == OBJECT_NOT_ALLOCATED)     fail("String_Node_Str" + jdkObject);
    int tibAddress=bootImageAddress + tibImageOffset;
    VM_ObjectModel.setTIB(bootImage,mapEntry.imageOffset,VM_Address.fromIntZeroExtend(tibAddress),rvmArrayType);
  }
  if (verbose >= 2)   depth--;
  return mapEntry.imageOffset;
}