RFR: 8310159: Bulk copy with Unsafe::arrayCopy is slower compared to memcpy [v4]

Steve Dohrmann duke at openjdk.org
Thu Nov 16 21:37:34 UTC 2023


On Mon, 13 Nov 2023 08:36:44 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>> Steve Dohrmann has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   - fix whitespace error
>
> I submitted some quick testing and I'm seeing the following failure with multiple tests:
> 
> 
> # A fatal error has been detected by the Java Runtime Environment:
> #
> #  Internal Error (/workspace/open/src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp:1201), pid=24136, tid=24139
> #  assert(MaxVectorSize == 64) failed: vector length != 64
> #
> # JRE version:  (22.0) (fastdebug build )
> # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-internal-2023-11-13-0750559.tobias.hartmann.jdk2, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
> # Problematic frame:
> # V  [libjvm.so+0x16c00e6]  StubGenerator::copy64_masked_avx(Register, Register, XMMRegister, KRegister, Register, Register, Register, int, int, bool)+0x366
> 
> Stack: [0x00007f0b5e919000,0x00007f0b5ea1a000],  sp=0x00007f0b5ea17150,  free space=1016k
> Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
> V  [libjvm.so+0x16c00e6]  StubGenerator::copy64_masked_avx(Register, Register, XMMRegister, KRegister, Register, Register, Register, int, int, bool)+0x366  (stubGenerator_x86_64_arraycopy.cpp:1201)
> V  [libjvm.so+0x16c0ecd]  StubGenerator::arraycopy_avx3_special_cases_256(XMMRegister, KRegister, Register, Register, Register, int, Register, Register, Label&, Label&)+0x19d  (stubGenerator_x86_64_arraycopy.cpp:1055)
> V  [libjvm.so+0x16c16c1]  StubGenerator::arraycopy_avx3_large(Register, Register, Register, Register, Register, Register, Register, XMMRegister, XMMRegister, XMMRegister, XMMRegister, int)+0x3f1  (stubGenerator_x86_64_arraycopy.cpp:790)
> V  [libjvm.so+0x16c22f0]  StubGenerator::generate_disjoint_copy_avx3_masked(unsigned char**, char const*, int, bool, bool, bool)+0xa90  (stubGenerator_x86_64_arraycopy.cpp:728)
> V  [libjvm.so+0x16c4b85]  StubGenerator::generate_disjoint_byte_copy(bool, unsigned char**, char const*)+0x965  (stubGenerator_x86_64_arraycopy.cpp:1277)
> V  [libjvm.so+0x16cb309]  StubGenerator::generate_arraycopy_stubs()+0x29  (stubGenerator_x86_64_arraycopy.cpp:88)
> V  [libjvm.so+0x16a1089]  StubGenerator::generate_final_stubs()+0xb9  (stubGenerator_x86_64.cpp:4051)
> V  [libjvm.so+0x16a22a5]  StubGenerator_generate(CodeBuffer*, StubCodeGenerator::StubsKind)+0x105  (stubGenerator_x86_64.cpp:4296)
> V  [libjvm.so+0x16f349e]  initialize_stubs(StubCodeGenerator::StubsKind, int, int, char const*, char const*, char const*)+0x13e  (stubRoutines.cpp:241)
> V  [libjvm.so+0x16f500d]  final_stubs_init()+0x3d  (stubRoutines.cpp:288)
> V  [libjvm.so+0xe30c59]...

@TobiHartmann I updated the PR with a fix for the assert you saw.  The large copy code generation / use is now predicated on MaxVectorSize = 64.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/16575#issuecomment-1815351213


More information about the hotspot-compiler-dev mailing list