RFR: 8334137: Marlin: replace sun.misc.Unsafe memory access methods with FFM [v6]
Kevin Rushforth
kcr at openjdk.org
Mon Jun 9 22:59:36 UTC 2025
On Mon, 9 Jun 2025 22:24:08 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
> the `MaskMarlinAlphaConsumer` field in `RendererContext` is created/resized in DMarlinRasterizer:102
>
> perhaps we could refactor this code to hide the public field and ensure the single threaded access?
That would get into the sort of changes I'd prefer not to make, at least not as part of the initial Unsafe --> FFM conversion, although Laurent could comment on that.
Other possibilities include: using thread-local storage for the ALPHA_MAP_XXX off heap arrays (in practice, they are only used from the Quantum renderer thread, so there would only ever be one copy) or dispensing with off-heap arrays entirely for the ALPHA_MAP, and using plain Java arrays. Given how these static arrays are used, I'm not sure using off-heap memory is really buying much in terms of performance (as opposed to the dynamic edges array, which is the primary use of off-heap memory).
Really, though, the simplest thing to do for now is to use shared (rather than confined) access for these two arrays and file a follow-up to optimize it if needed.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1814#issuecomment-2957225458
More information about the openjfx-dev
mailing list