RFR: 8343188: Investigate ways to simplify MemorySegment::ofBuffer

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Oct 30 18:46:12 UTC 2024


On Tue, 29 Oct 2024 14:51:33 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

It would be great if we could find a benchmark where inlining doesn't happen and that causes escape analysis issue. @Spasi do you have anything on that front?

src/java.base/share/classes/java/nio/X-Buffer.java.template line 2329:

> 2327:     @Override
> 2328:     int scaleFactor() {
> 2329: #if[byte]

I believe this can be simplified with `$1_Fulltype.BYTES` ?

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

PR Review: https://git.openjdk.org/jdk/pull/21764#pullrequestreview-2405965169
PR Review Comment: https://git.openjdk.org/jdk/pull/21764#discussion_r1823201904


More information about the core-libs-dev mailing list