[foreign-memaccess+abi] RFR: 8303757: MemorySegment::reinterpret should accept an Arena [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Mar 7 17:52:09 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.

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>

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

Changes:
  - all: https://git.openjdk.org/panama-foreign/pull/812/files
  - new: https://git.openjdk.org/panama-foreign/pull/812/files/d70ea30c..66a791f6

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=panama-foreign&pr=812&range=01
 - incr: https://webrevs.openjdk.org/?repo=panama-foreign&pr=812&range=00-01

  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 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