On Tue, 17 Oct 2023 22:53:30 GMT, Phil Race <p...@openjdk.org> wrote:

>  I'm unclear why it is "better". It seems more obscure to me.

Ok. I think it's better because it doesn't require creating a maximum size 
sequence layout in order to then make a var handle out of, which is a bit of a 
hack IMO. One that was required in the previous version of the API.

This kind of use-case, where the size of the sequence is not known statically, 
is one of the reasons why we added the extra base offset parameter to the var 
handles.

Another way of writing this would be to use the base var handle, with its extra 
leading offset parameter, and then pass e.g. `i * PositionLayout.byteSize()` as 
the offset at every call site (where `i` is the array index). The two extra 
combination steps essentially create a var handle with that behavior baked in.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15476#discussion_r1363114533

Reply via email to