[foreign-memaccess+abi] RFR: 8303757: MemorySegment::reinterpret should accept an Arena [v2]
Jorn Vernee
jvernee at openjdk.org
Tue Mar 7 18:07:31 UTC 2023
The message from this sender included one or more files
which could not be scanned for virus detection; do not
open these files unless you are certain of the sender's intent.
----------------------------------------------------------------------
On Tue, 7 Mar 2023 17:52:09 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> This patch tweaks the signature of `MemorySegment::reinterpret` to accept `Arena` instead of just `MemorySegment.Scope`. After some more thinking, I realized that the current scope-accepting methods imply that there is an action at a distance: passing an arena scope to `MemorySegment::reinterpret` not only results in new temporal bounds (which is ok, since `Scope` is about that), but also sets confinement constraints too (which is surprising, as a `Scope` doesn't have a notion of confinement).
>>
>> For this reason, I've dialled back the signature to take an `Arena`. This makes the API more consistent (now "of course" the confinement properties of the returned segment will be specified by the provided arena). It also removes a bit of verbosity at the use site, as doing `arena.scope()` is no longer required.
>
> Maurizio Cimadamore has updated the pull request incrementally with two additional commits since the last revision:
>
> - Update src/java.base/share/classes/java/lang/foreign/MemorySegment.java
>
> Co-authored-by: Jorn Vernee <JornVernee at users.noreply.github.com>
> - Update src/java.base/share/classes/java/lang/foreign/MemorySegment.java
>
> Co-authored-by: Jorn Vernee <JornVernee at users.noreply.github.com>
Marked as reviewed by jvernee (Committer).
-------------
PR: https://git.openjdk.org/panama-foreign/pull/812
More information about the panama-dev
mailing list