[foreign-memaccess+abi] Integrated: 8303667: Drop MemoryLayout::valueLayout factory

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Mar 7 10:19:00 UTC 2023


On Mon, 6 Mar 2023 14:45:28 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> We have been thinking more about how the layout API might be affected by Valhalla specialized types. With Valhalla, it might be possible to, eventually, get rid of hand-specialized classes such as `ValueLayout.OfInt` and friends, and replace them either with `ValueLayout<int>`, or some `ScalarLayout<int>` (where `ScalarLayout<X> extends ValueLayout`). This would allow us to, also eventually, only provide _one_ accessor for all value/scalar layouts in `MemorySegment`.
> 
> Under this migration scenario, having a toplevel factory such as `MemoryLayout::valueLayout`, whose semantics is strictly defined in terms of the hand-specialzied classes doesn't seem a great idea.
> 
> Since this factory is only used rarely (mostly in tests - we could not find any usage in existing GitHub projects targeting the FFM API), it would be better to remove it, to avoid having to deal with pesky migration issues later. 
> 
> Of course, if you are aware of cases we missed where the factory is used in the wild, please let us know. (Although, in general, it is not too difficult to re-iimplement a similar method using the `ValueLayout` constants - `jextract` will need to do this, for instance).

This pull request has now been integrated.

Changeset: 3e5ec05c
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.org/panama-foreign/commit/3e5ec05c0e263e06ff0d36f8ddb1374dea18c0c6
Stats:     149 lines in 7 files changed: 51 ins; 95 del; 3 mod

8303667: Drop MemoryLayout::valueLayout factory

Reviewed-by: jvernee

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

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


More information about the panama-dev mailing list