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

Paul Sandoz psandoz at openjdk.java.net
Wed Mar 11 21:39:54 UTC 2020


On Wed, 11 Mar 2020 13:25:54 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> 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`).

Suggest adding a `hasAccessModes` which does the obvious thing but can make code more readable.

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

Marked as reviewed by psandoz (Committer).

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


More information about the panama-dev mailing list