[foreign-memaccess] RFR: 8246052: MemorySegment::mapFromPath should take an offset

Maurizio Cimadamore mcimadamore at openjdk.java.net
Thu May 28 13:44:03 UTC 2020

This patch adds a mapping offset to MemorySegment::mapFromPath. This usability enhancement has been requested many
times, and it would be nice to add it to the API, to make it more similar to FileChannel::map, and to allow for more
efficient memory usage when dealing with mapped files.

I also added more  tests on mapped segments, to check for edge cases; and also to verify that mapping from offset
actually works.


Commit messages:
 - Add offset parameter to MemorySegment::mapFromPath

Changes: https://git.openjdk.java.net/panama-foreign/pull/187/files
 Webrev: https://webrevs.openjdk.java.net/panama-foreign/187/webrev.00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8246052
  Stats: 82 lines in 3 files changed: 59 ins; 0 del; 23 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/187.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/187/head:pull/187

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

More information about the panama-dev mailing list