.getReferenceSize();
final Offset lengthOffset = Offset
.fromIntSignExtend(VmArray.LENGTH_OFFSET * slotSize);
final int dataOffset = VmArray.DATA_OFFSET * slotSize;
final Address srcAddr = ObjectReference.fromObject(src).toAddress();
final Address dstAddr = ObjectReference.fromObject(dst).toAddress();
final int srcLen = srcAddr.loadInt(lengthOffset);
final int dstLen = dstAddr.loadInt(lengthOffset);
// Calc end index (if overflow, then will be < 0 )
final int srcEnd = srcPos + length;
final int dstEnd = dstPos + length;
if ((srcEnd > srcLen) || (srcEnd < 0)) {
throw new IndexOutOfBoundsException("srcPos+length > src.length ("
+ srcPos + '+' + length + " > " + srcLen + ')');
}
if ((dstEnd > dstLen) || (dstEnd < 0)) {
throw new IndexOutOfBoundsException("dstPos+length > dst.length");
}
final int elemsize;
final boolean isObjectArray;
switch (src_type) {
case 'Z':
// Boolean
case 'B':
// Byte
elemsize = 1;
isObjectArray = false;
break;
case 'C':
// Character
case 'S':
// Short
elemsize = 2;
isObjectArray = false;
break;
case 'I':
// Integer
case 'F':
// Float
elemsize = 4;
isObjectArray = false;
break;
case 'L':
// Object
elemsize = slotSize;
isObjectArray = true;
break;
case 'J':
// Long
case 'D':
// Double
elemsize = 8;
isObjectArray = false;
break;
default:
// Unsafe.debug("uat:");
// Unsafe.debug(src_type);
// Unsafe.debug(src_name);
throw new ArrayStoreException("Unknown array type");
}
final Address srcPtr = srcAddr.add(dataOffset + (srcPos * elemsize));
final Address dstPtr = dstAddr.add(dataOffset + (dstPos * elemsize));
final Extent size = Extent.fromIntZeroExtend(length * elemsize);
if (isObjectArray) {
Class dst_comp_class = dst_class.getComponentType();