RFR: 8329331: Intrinsify Unsafe::setMemory [v7]
Sandhya Viswanathan
sviswanathan at openjdk.org
Thu Apr 11 00:33:48 UTC 2024
On Mon, 8 Apr 2024 19:11:19 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 movq to locate_operand
src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp line 2497:
> 2495: //
> 2496: address StubGenerator::generate_unsafe_setmemory(const char *name,
> 2497: address byte_fill_entry) {
Need to add UnsafeSetMemoryMark on similar lines as UnsafeCopyMemoryMark to handle page error.
src/hotspot/cpu/x86/stubGenerator_x86_64_arraycopy.cpp line 2522:
> 2520: #define rScratch3 r8
> 2521: #undef rScratch4
> 2522: #define rScratch4 r11
We could do this setup using const Register declaration instead of using #undef/#define pair.
src/hotspot/share/opto/library_call.cpp line 4950:
> 4948:
> 4949: bool LibraryCallKit::inline_unsafe_setMemory() {
> 4950: if (callee()->is_static()) return false; // caller must have the capability!
Also need to return false if StubRoutines::unsafe_setmemory() == nullptr.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18555#discussion_r1560201153
PR Review Comment: https://git.openjdk.org/jdk/pull/18555#discussion_r1560202218
PR Review Comment: https://git.openjdk.org/jdk/pull/18555#discussion_r1560194011
More information about the core-libs-dev
mailing list