RFR: 8337237: Use FFM instead of Unsafe for Java 2D RenderBuffer class

Phil Race prr at openjdk.org
Thu Jul 25 22:58:58 UTC 2024


Migrate from using Unsafe to FFM's MemorySegment API for allocating and setting native memory.
This code is used by Metal, OpenGL and D3D, so I manually tested SwingSet2 and J2Demo as well as running all the usual tests.
I also did some micro-benchmarking on the performance of Unsafe vs MemorySegment.
The performance of either is more than sufficient for us .. ie they could be 10x slower and we wouldn't even notice.
But they are in the same ballpark, and if one or the other is clearly faster it is the new FFM code.

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

Commit messages:
 - 8337237

Changes: https://git.openjdk.org/jdk/pull/20339/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20339&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8337237
  Stats: 67 lines in 1 file changed: 4 ins; 4 del; 59 mod
  Patch: https://git.openjdk.org/jdk/pull/20339.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20339/head:pull/20339

PR: https://git.openjdk.org/jdk/pull/20339


More information about the client-libs-dev mailing list