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

Jatin Bhateja jbhateja at openjdk.org
Fri Apr 19 13:38:01 UTC 2024


On Tue, 16 Apr 2024 00:04:15 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:
> 
>   Add enter() and leave(); remove Windows-specific register stuff

Hi @asgibbons Please add a new test / extend an existing test for SIGBUS violation testing test/hotspot/jtreg/runtime/Unsafe/InternalErrorTest.java

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

> 2609:     // Propagate byte to full Register
> 2610:     __ movzbl(rScratch1, byteVal);
> 2611:     __ mov64(wide_value, 0x0101010101010101);

Long constant should be suffixed by ULL.

test/micro/org/openjdk/bench/java/lang/foreign/MemorySegmentZeroUnsafe.java line 1:

> 1: package org.openjdk.bench.java.lang.foreign;

Copyright header missing.

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

PR Review: https://git.openjdk.org/jdk/pull/18555#pullrequestreview-2011247585
PR Review Comment: https://git.openjdk.org/jdk/pull/18555#discussion_r1572370327
PR Review Comment: https://git.openjdk.org/jdk/pull/18555#discussion_r1572267154


More information about the core-libs-dev mailing list