RFR: 8334137: Marlin: replace sun.misc.Unsafe memory access methods with FFM

Kevin Rushforth kcr at openjdk.org
Tue Jun 10 17:53:39 UTC 2025


On Tue, 10 Jun 2025 16:13:10 GMT, Laurent Bourgès <lbourges at openjdk.org> wrote:

> These alpha masks are constant (static), so reused in marlin java2d where multiple threads & rendering contexts can work in parallel. With FFM, the global arena could be used, but the current patch is good enough as javafx uses only 1 thread to perform rendering. I hope using the shared arena does not hurt performance in this case (1 thread).

By deferring the creation to the first time a MaskMarlinAlphaConsumer object is constructed, I was able to continue using the confined arena, so there is no use of a shared arena in Marlin for JavaFX.

I had also thought about the global arena, since the alpha objects are global (static) objects that are never released. That might be a better choice, and is probably what you will need to do anyway for Java2D. If there is no performance penalty for accessing data from a memory segment created using the global arena, then we could switch to that for JavaFX as well.

@minborg Do you have any advice regarding this?

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

PR Comment: https://git.openjdk.org/jfx/pull/1814#issuecomment-2960144994


More information about the openjfx-dev mailing list