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

Vladimir Kozlov kvn at openjdk.org
Fri Apr 19 18:28:01 UTC 2024


On Fri, 19 Apr 2024 16:25:28 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:
> 
>   Address review comments; update copyright years

General comment/suggestion before I dive into review.
Can we do renaming `UnsafeCopyMemory*` -> `UnsafeMemory*` in follow up RFE. This change hides the real change.

src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 8336:

> 8334:     // Initialize table for copy memory (arraycopy) check.
> 8335:     if (UnsafeMemoryAccess::_table == nullptr) {
> 8336:       UnsafeMemoryAccess::create_table(18);

Needs comment explaining 18 number

src/hotspot/share/utilities/copy.hpp line 303:

> 301:   inline static void shared_disjoint_words_atomic(const HeapWord* from,
> 302:                                                   HeapWord* to, size_t count) {
> 303: 

I don't think this justify to change the file.

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

Changes requested by kvn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18555#pullrequestreview-2012077574
PR Review Comment: https://git.openjdk.org/jdk/pull/18555#discussion_r1572750449
PR Review Comment: https://git.openjdk.org/jdk/pull/18555#discussion_r1572746349


More information about the core-libs-dev mailing list