[foreign-memaccess+abi] RFR: 8265760: Memory segments/addresses should have an isNative predicate
Paul Sandoz
psandoz at openjdk.java.net
Fri Apr 23 15:44:43 UTC 2021
On Thu, 22 Apr 2021 13:12:56 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This patch adds an `isNative` predicate to both `MemorySegment` and `MemoryAddress`. Note that, for segments, `isMapped` implies `isNative`.
>
> It also moves all the methods from `MappedMemorySegments` back into `MemorySegment` (these methods will still throw if invoked on a segment that is not a mapped segment).
>
> Some javadoc tweaking occurred here - MemorySegment now has a new section fully dedicated to mapped segments (note that now mapped segments are presented as a special class of native segments).
>
> Also, in MemoryAddress, the concept of "native memory address" is introduced to talk about off-heap addresses, which simplifies some of the javadoc.
>
> This way, the resulting API is tighter, and using mapped segments is slightly more direct.
Marked as reviewed by psandoz (Committer).
src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemorySegment.java line 94:
> 92: * <p>
> 93: * Clients requiring sophisticated, low-level control over mapped memory segments, should consider writing
> 94: * custom mapped memory segment factories; using JNI, e.g. on Linux, it is possible to call {@code mmap}
Can we replace the reference to JNI with the linker API?
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/514
More information about the panama-dev
mailing list