[foreign-memaccess+abi] RFR: 8301801: Implement arena-centric API

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Feb 7 14:56:35 UTC 2023


This patch implements the API proposal described here:

https://cr.openjdk.java.net/~mcimadamore/panama/scoped_arenas.html

The main changes are:

* Static factories `MemorySegment::allocateNative` are gone;
* The static factory `SegmentAllocator::nativeAllocator` is also gone;
* `SegmentScope` moved as nested class in `MemorySegment` (e.g. `MemorySegment.Scope`);
* Tweak methods accepting `SegmentScope` to accept `Arena` instead;
* Simplify `Arena` API, by removing predicates (`isCloseable`/`isAccessibleBy`) and by dropping `whileAlive`;
* Change arena factories to use `of` prefix instead of `open` - and rename `auto()` to `ofAuto()`.

 The API changes are rather straightforward, but they lead to several shallow test and microbenchmark changes, so the number of affected file is quite big (mostly because of the rename `openConfined` -> `ofConfined`).

A javadoc of the proposed changes is available here:

http://cr.openjdk.java.net/~mcimadamore/panama/scoped_arena_interface_lump_predicates/

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

Commit messages:
 - Fix typo
 - Clarify javadoc for Arena::close
 - Fix linker javadoc
 - Initial push

Changes: https://git.openjdk.org/panama-foreign/pull/781/files
 Webrev: https://webrevs.openjdk.org/?repo=panama-foreign&pr=781&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8301801
  Stats: 2284 lines in 131 files changed: 549 ins; 688 del; 1047 mod
  Patch: https://git.openjdk.org/panama-foreign/pull/781.diff
  Fetch: git fetch https://git.openjdk.org/panama-foreign pull/781/head:pull/781

PR: https://git.openjdk.org/panama-foreign/pull/781


More information about the panama-dev mailing list