New arraycopy stubs code introduced in 6498658 changes and
in additional fix 6547163 crashes in few cases.
Based on the bug report I modified the test program I added
for 6547163 so that it tests arraycopy stubs for different array
sizes ranged from 8 bytes to 80 bytes with 1 byte step.
It found 3 failed cases including the reported one:
1. After 6547163 fix for sparc aligned arraycopy stubs code will
call copy_16_bytes_forward_with_shift() when arrays are misaligned
by 4 bytes in 32-bits VM. But this method works only when length
>= 16 bytes. There is the comment before the method call:
// The compare above (count >= 23) guarantes 'count' >= 16 bytes.
But for aligned arrays the compare is ('count' >= 12).
It causes 'count' became negative after the method call.
The loop which copy an array's tail decrements and compares
'count' with 0:
__ brx(Assembler::notZero, false, Assembler::pt, L_copy_byte_loop);
It will copy past an array until SEGV when 'count' is negative.
2. The sparc stubs for conjoint_byte_copy and conjoint_short_copy
incorrectly assumes that end of arrays are also aligned
when arrays itself are aligned. It cases SIGBUS when ldx/stx
instruction is executed on not aligned address of array's end.
3. Small (<4 bytes) arracopy is not executed for aligned conjoint
copy on x86 (32-bits VM) since the code is incorrectly
guarded by the !aligned check.