[foreign-memaccess+abi] RFR: 8303667: Drop MemoryLayout::valueLayout factory
Jorn Vernee
jvernee at openjdk.org
Mon Mar 6 15:03:43 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).
Marked as reviewed by jvernee (Committer).
-------------
PR: https://git.openjdk.org/panama-foreign/pull/810
More information about the panama-dev
mailing list