RFR: 8357268: Use JavaNioAccess.getBufferAddress rather than DirectBuffer.address()
Per Minborg
pminborg at openjdk.org
Tue May 20 12:06:35 UTC 2025
This PR proposes to use `JavaNioAccess::getBufferAdress` rather than `DirectBuffer::address` so that `Buffer` instances backed by MemorySegment instances can be used in classes that were not covered by https://github.com/openjdk/jdk/pull/25321
In some of the cases, this is not strictly needed as the internal cache in `sun.nio.ch.Util#getTemporaryDirectBuffer` is (currently) only returning Buffers that are not backed by a `MemorySegment`. Also, we now always acquire/release buffer sessions before interacting with memory. Again, this is not always needed for temporary direct buffers but provides a consistent handling of buffers at a minimal cost.
This PR passes tier1, tier2, and tier3 tests on multiple platforms and configurations.
-------------
Commit messages:
- Remove import
- Remove comment
- Use getBufferAddress() rather than address()
Changes: https://git.openjdk.org/jdk/pull/25324/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25324&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8357268
Stats: 93 lines in 16 files changed: 32 ins; 0 del; 61 mod
Patch: https://git.openjdk.org/jdk/pull/25324.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/25324/head:pull/25324
PR: https://git.openjdk.org/jdk/pull/25324
More information about the nio-dev
mailing list