[foreign-memaccess] RFR 8223768: Rethink relationship between Sequence vs. Group layouts
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Mon May 13 12:16:38 UTC 2019
Btw, this patch is bases on the one for 8223712 (which I cannot push as
hg server is down ATM).
Maurizio
On 13/05/2019 13:14, Maurizio Cimadamore wrote:
> Hi,
> as discussed previously, the relationship between sequences and groups
> is a bit shaky, as there are sequences that cannot be expressed as
> groups (sequences whose size is unbound).
>
> This patch models groups and sequences independently:
>
> * they all have a (minimal) common supertype called Compound (which
> supports only a Stream<Layout> elements() method)
>
> * Group implements Iterable, always has a size, and you can access
> elements by index
>
> * Sequence doesn't implement Iterable, has an optional size, and has
> an accessor to retrieve the element layout (there's only one of them,
> regardless of the size)
>
> I think this is much saner.
>
> Webrev:
>
> http://cr.openjdk.java.net/~mcimadamore/panama/8223768/
>
> P.S.
> of course Compound should be renamed to CompoundLayout in a later
> webrev (as for all other layout names).
>
> P.P.S.
> in a separate patch I'll explore generalizing this method:
>
> LayoutPath::groupElement(long index)
>
> with this:
>
> LayoutPath::compoundElement(long index)
>
> Since now we should be able to implement indexed access on both group
> and sequences.
>
> Maurizio
>
>
More information about the panama-dev
mailing list