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

Kevin Rushforth kcr at openjdk.org
Fri Jun 6 12:07:44 UTC 2025


On Tue, 3 Jun 2025 22:52:27 GMT, Nir Lisker <nlisker at openjdk.org> wrote:

> If it helps at this point, we did an initial prototype in the sandbox: https://github.com/openjdk/jfx-sandbox/tree/Marlin_FFM with several commits and reverts, so might need to go through them.

Thanks. I took a look at it, and one of the things you did could be good for a follow-up: you use a memory layout that allows accessing data in a more structured manner than as a raw array of bytes or ints. For the initial conversion, I wanted to make minimal changes to the callers of OffHeapMemory, keeping the logic identical. This way everything about the implementation of OffHeap memory is encapsulated in the OffHeapMemory class.

> What @bourgesl and I weren't sure about was which `Arena` to use. I thought `Confined` was more suitable than `Shared` because there's no multithreaded access.

I wondered about that as well. I changed it to `ofConfined()` and don't see any problems so far. I'll run a full set of CI tests and if there are no problems, leave it at that.

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

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


More information about the openjfx-dev mailing list