[foreign-memaccess+abi] RFR: 8303757: MemorySegment::reinterpret should accept an Arena
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Mar 7 15:50:35 UTC 2023
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.
-------------
Commit messages:
- Initial push
Changes: https://git.openjdk.org/panama-foreign/pull/812/files
Webrev: https://webrevs.openjdk.org/?repo=panama-foreign&pr=812&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8303757
Stats: 75 lines in 18 files changed: 25 ins; 6 del; 44 mod
Patch: https://git.openjdk.org/panama-foreign/pull/812.diff
Fetch: git fetch https://git.openjdk.org/panama-foreign pull/812/head:pull/812
PR: https://git.openjdk.org/panama-foreign/pull/812
More information about the panama-dev
mailing list