RFR: 8345687: Improve the implementation of SegmentFactories::allocateSegment [v6]
Maurizio Cimadamore
mcimadamore at openjdk.org
Wed Mar 12 11:19:05 UTC 2025
On Fri, 7 Mar 2025 17:38:13 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> Hi,
>>
>> This patch improves the performance of a typical `Arena::allocate` in several ways:
>>
>> - Delay the creation of the NativeMemorySegmentImpl. This avoids the merge of the instance with the one obtained from the call in the uncommon path, increasing the chance the object being scalar replaced.
>> - Split the allocation of over-aligned memory to a slow-path method.
>> - Align the memory to 8 bytes, allowing faster zeroing.
>> - Use a dedicated method to zero the just-allocated native memory, reduce code size and make it more straightforward.
>> - Make `VM.pageAlignDirectMemory` a `Boolean` instead of a `boolean` so that `false` value can be constant folded.
>>
>> Please take a look and leave your reviews, thanks a lot.
>
> Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains nine additional commits since the last revision:
>
> - Merge branch 'master' into segmentallocate
> - revert changes to CallocArena
> - Merge branch 'master' into segmentallocate
> - copyright
> - Merge branch 'master' into segmentallocate
> - wrong init
> - move segment instance creation to SegmentFactories
> - address review
> - improve the implementation of SegmentFactories::allocateSegment
Looks good - just left a minor (optional) stylistic comment
test/micro/org/openjdk/bench/java/lang/foreign/AllocTest.java line 26:
> 24: package org.openjdk.bench.java.lang.foreign;
> 25:
> 26: import java.lang.foreign.*;
I believe it would be better to leave the imports alone -- as all the other benchmarks also use the "more explicit" style.
-------------
Marked as reviewed by mcimadamore (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/22610#pullrequestreview-2678029020
PR Review Comment: https://git.openjdk.org/jdk/pull/22610#discussion_r1991245773
More information about the core-libs-dev
mailing list