RFR: 8357268: Use JavaNioAccess.getBufferAddress rather than DirectBuffer.address() [v2]

Per Minborg pminborg at openjdk.org
Tue May 20 12:49:06 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.

Per Minborg has updated the pull request incrementally with one additional commit since the last revision:

  Revoke changes in classes that is always using DirectBuffer

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25324/files
  - new: https://git.openjdk.org/jdk/pull/25324/files/6e733a18..9c5a3573

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25324&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25324&range=00-01

  Stats: 25 lines in 5 files changed: 0 ins; 16 del; 9 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 net-dev mailing list