RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer
Per Minborg
pminborg at openjdk.org
Thu Oct 31 07:15:32 UTC 2024
On Wed, 30 Oct 2024 18:36:37 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> This PR proposes to improve `MemorySegment::ofBuffer` making it more amenable to inlining and generally improving performance.
>>
>> Testing successfully on tier1-3
>
> src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 541:
>
>> 539:
>> 540: @ForceInline
>> 541: private static AbstractMemorySegmentImpl arrayFreeSegment(Buffer b, long offset, long length) {
>
> the names `arrayFreeSegment` and `arrayBackedSegments` seem a bit confusing. I'd suggest `ofDirectBuffer` and `ofHeapBuffer`
I called them that initially but there is a subtle difference; there are heap buffers that are not backed by an array. The name arrayFreeSegment could better be arrayLessSegment.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21764#discussion_r1823903044
More information about the core-libs-dev
mailing list