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

Sandhya Viswanathan sviswanathan at openjdk.org
Mon Apr 15 22:35:02 UTC 2024


On Mon, 15 Apr 2024 18:43:24 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:
> 
>   Fix memory mark after sync to upstream

These are my last set of comments. Rest looks good to me.

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

> 2586:   StubCodeMark mark(this, "StubRoutines", name);
> 2587:   address start = __ pc();
> 2588: 

We are missing the __ enter() here?

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

> 2678:     __ BIND(L_fillBytes);
> 2679:     {
> 2680:       const Register byteVal = rdx;

This could be removed.

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

> 2684:       __ movq(rdx, rsi);
> 2685:       restore_arg_regs();
> 2686: #endif

This is stubGenerator_x86_64.cpp 64bit specific, so WIN32 portion could be removed?

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

PR Review: https://git.openjdk.org/jdk/pull/18555#pullrequestreview-1998540097
PR Review Comment: https://git.openjdk.org/jdk/pull/18555#discussion_r1566504104
PR Review Comment: https://git.openjdk.org/jdk/pull/18555#discussion_r1566498612
PR Review Comment: https://git.openjdk.org/jdk/pull/18555#discussion_r1566498342


More information about the core-libs-dev mailing list