[foreign-memaccess] RFR: 8254343: Revisit API for supporting mapped memory segments (second option)

Paul Sandoz psandoz at openjdk.java.net
Mon Oct 12 16:18:14 UTC 2020


On Mon, 12 Oct 2020 12:33:39 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> This patch contains an alternate approach to support mapped memory segment operations,
> effectively addressing the issues described in PR/377.
> 
> Here, support for mapped segments is reduced to bare minimum in the public API; a mapped segment is a segment whose
> file descriptor is set.
> A separate helper class `MappedMemorySegments` exposes the same routines which are now provided by
> `MappedMemorySegment`.

I like this approach, very minimal on `MemorySegment`. Since `MappedByteBuffer` has such operations on mapped memory
it's somewhat of a forced move to provide something specific for `MemorySegment`, rather than asking developers to
transition to a `ByteBuffer`. We could enhance the documentation on`MappedMemorySegments` when the Foreign Linker API
has sedimented, to refer to more platform-specific use cases.

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

PR: https://git.openjdk.java.net/panama-foreign/pull/378


More information about the panama-dev mailing list