[foreign-memaccess] Integrated: JDK-8249753: Add restricted factory to access everything segment
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Mon Jul 20 12:06:51 UTC 2020
On Mon, 20 Jul 2020 11:12:21 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This patch adds another restricted factory, namely `MemorySegment::ofRestrictedNative()`. The new factory takes no
> arguments and return a segment that has the following characteristics:
> * its base address is `MemoryAddress::NULL`
> * its size is `Long.MAX_VALUE`
> * it is non-closeable
> * it is not confined
>
> Note that this is not *exactly* the _everything_ segment, since, at least in principle, addressable space goes up to `2
> ^ 64 - 1` while `Long::MAX_VALUE` is "only" `2^63 -1`. In other words, there is a possibility for some addresses to
> show up as *negative* long values, which will then be rejeced during dereference. That said, for all intent and
> purposes, the segment returned by the new factory is a close enough approximation to the everything segment; we'd
> prefer to start with that and expand later (with some concrete use cases) rather than adding a new kind of memory
> segment which might not be needed.
This pull request has now been integrated.
Changeset: 0c76b501
Author: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.java.net/panama-foreign/commit/0c76b501
Stats: 45 lines in 3 files changed: 0 ins; 45 del; 0 mod
8249753: Add restricted factory to access everything segment
Reviewed-by: jvernee
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/249
More information about the panama-dev
mailing list