[foreign-memaccess+abi] RFR: Make Addressable sealed again

Maurizio Cimadamore mcimadamore at openjdk.java.net
Tue Sep 28 18:18:27 UTC 2021


Following the API refresh, I realized that making `Addressable` non-sealed was perhaps a step too far, at least for the time being. It forces a `scope()` accessor on the interface, which in turns pollutes the `MemoryAddress` interface (since a memory address has no scope).
While the API, as currently defined is sound, I'd prefer to make things tighter for now, as I realized that the need to define custom `Addressable` is perhaps limited. For instance, one place I thought they would have been useful was to model structs - but thinking more, a struct is probably backed by a segment anyway - and the segment is addressable. So, assuming the struct exposes a segment accessor, we still have ways to pass it around w/o necessarily having it implement the `Addressable` interface directly.

In the implementation we do have a new internal `Scoped` interface, which is used to keep all by-reference parameters alive by the linker. Basically, this interface re-adds the scope accessor which has been removed from the public API.

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

Commit messages:
 - Add missing copyright
 - Tweak Addressable to become sealed

Changes: https://git.openjdk.java.net/panama-foreign/pull/586/files
 Webrev: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=586&range=00
  Stats: 85 lines in 13 files changed: 39 ins; 29 del; 17 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/586.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/586/head:pull/586

PR: https://git.openjdk.java.net/panama-foreign/pull/586


More information about the panama-dev mailing list