RFR: 8329331: Intrinsify Unsafe::setMemory [v13]

Sandhya Viswanathan sviswanathan at openjdk.org
Fri Apr 12 00:28:50 UTC 2024


On Fri, 12 Apr 2024 00:07:56 GMT, Scott Gibbons <sgibbons at openjdk.org> wrote:

>> This code makes an intrinsic stub for `Unsafe::setMemory` for x86_64.  See [this PR](https://github.com/openjdk/jdk/pull/16760) for discussion around this change.
>> 
>> Overall, making this an intrinsic improves overall performance of `Unsafe::setMemory` by up to 4x for all buffer sizes.
>> 
>> Tested with tier-1 (and full CI).  I've added a table of the before and after numbers for the JMH I ran (`MemorySegmentZeroUnsafe`).
>> 
>> [setMemoryBM.txt](https://github.com/openjdk/jdk/files/14808974/setMemoryBM.txt)
>
> Scott Gibbons has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Addressing yet more review comments

src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp line 2504:

> 2502:     Label L_exit, L_fillQuadwords, L_fillDwords, L_fillBytes;
> 2503: 
> 2504:     setup_arg_regs(3);

A comment stating the placement of dest, size, and byteVal after call to setup_arg_regs() would be very helpful.

src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp line 2521:

> 2519:       const Register byteVal = rdx;
> 2520: 
> 2521:       // Propagate byte to full Register

The comment refers to lines 2524-2526, please move it down.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18555#discussion_r1561873770
PR Review Comment: https://git.openjdk.org/jdk/pull/18555#discussion_r1561871872


More information about the core-libs-dev mailing list