RFR: 8337237: Use FFM instead of Unsafe for Java 2D RenderBuffer class
Per Minborg
pminborg at openjdk.org
Fri Jul 26 06:58:30 UTC 2024
On Thu, 25 Jul 2024 22:53:36 GMT, Phil Race <prr at openjdk.org> wrote:
> 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.
Most put operations require that the item is properly aligned now that the FFM API is used in conjunction with the aligned `ValueLayout` instances like `JAVA_LONG`. `Unsafe` did not impose this restriction. Is this the intended behavior?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20339#issuecomment-2252097394
More information about the client-libs-dev
mailing list