[foreign-memaccess] RFR: 8240874: Add finer-grained access control for memory segments

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Mar 11 13:30:45 UTC 2020


This patch adds a finer-grained access control for memory segments; instead of the ad-hoc `MemorySegment::asReadOnly`,
we now support a more complete `MemorySegment::withAccessModes`, where access modes is an int mask.

Supported access modes are `READ`, `WRITE`, `CLOSE` and `ACQUIRE`, which gives much more freedom to clients when it
comes to create restricted views (I've added a new section on that in the MemorySegment toplevel javadoc).

I also did some minor changes, mostly to get rid of confinement restrictions where such restrictions were not needed
(e.g. `MemorySegment::asSlice`).

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

Commit messages:
 - JDK-8240874: Replace MemorySegment::asReadOnly() with more fine-grained access control.

Changes: https://git.openjdk.java.net/panama-foreign/pull/45/files
 Webrev: https://webrevs.openjdk.java.net/panama-foreign/45/webrev.00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8240874
  Stats: 249 lines in 7 files changed: 185 ins; 28 del; 36 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/45.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/45/head:pull/45

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


More information about the panama-dev mailing list