On Tue, 29 Oct 2024 14:51:33 GMT, Per Minborg <pminb...@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` src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 546: > 544: } > 545: final UnmapperProxy unmapper = NIO_ACCESS.unmapper(b); > 546: return unmapper == null I would feel more at ease if the creation of segments went through SegmentFactories (this is not a new issue in this PR) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21764#discussion_r1823195381 PR Review Comment: https://git.openjdk.org/jdk/pull/21764#discussion_r1823193123