RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer [v5]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Oct 31 17:22:33 UTC 2024


On Thu, 31 Oct 2024 14:04:01 GMT, Per Minborg <pminborg 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
>
> Per Minborg 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 12 additional commits since the last revision:
> 
>  - Update comments
>  - Merge branch 'master' into optimize-ms-ofbuffer
>  - Rename method
>  - Rename method
>  - Fix issue in scaleFactor()
>  - Update from comments and add benchmark
>  - Remove switch rake and move factories to Buffer impls
>  - Clean up generated code
>  - Revert changes
>  - Remove unused imports
>  - ... and 2 more: https://git.openjdk.org/jdk/compare/e41f9074...e6b03e8b

src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 526:

> 524:         final Object base = NIO_ACCESS.getBufferBase(b);
> 525:         return (base == null)
> 526:                 ? nativeSegment(b, offset, length)

why not calling the other "heapSegment" ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21764#discussion_r1824870220


More information about the core-libs-dev mailing list