RFR: 8334137: Marlin: replace sun.misc.Unsafe memory access methods with FFM
Nir Lisker
nlisker at openjdk.org
Wed Jun 11 13:41:36 UTC 2025
On Wed, 11 Jun 2025 05:40:22 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> > 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.
>
> Using memory from the Global arena can actually be _faster_ as we do not have to perform any liveness checks for such segments. So, I think this is a good move. Also, the memory does not have to be acquired/released if the address is conveyed to native code (as the segment's scope never closes).
In this case, you'll need to change [`free()`](https://github.com/kevinrushforth/jfx/blob/2dd7a35d2eec16b04de1f4cb7aeba31be5d98a55/modules/javafx.graphics/src/main/java/com/sun/marlin/OffHeapArray.java#L126) to remove the closure of the arena, but I think that then you'll have to manually clear the memory segments it allocates. This requires non-trivial modifications with `MarlinUtils`'s cleaner. When @bourgesl and I discussed these changes, we were unsure what the correct arena for this situation is.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1814#issuecomment-2962763793
More information about the openjfx-dev
mailing list