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

Maurizio Cimadamore mcimadamore at openjdk.java.net
Wed Sep 29 16:30:17 UTC 2021


On Tue, 28 Sep 2021 18:11:56 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: ab61f068
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.java.net/panama-foreign/commit/ab61f0688fe856dd2cb76735eb057170d55ba49c
Stats:     85 lines in 13 files changed: 39 ins; 29 del; 17 mod

Make Addressable sealed again

Reviewed-by: jvernee

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

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


More information about the panama-dev mailing list