Second JNI extension for flattened arrays

David Simms david.simms at
Thu Dec 19 12:58:55 UTC 2019

Wow, nice work Frederic, some nice additions to the public API. Perhaps 
of use for core libraries wishing to make some optimizations with inline 

Obviously Panama is on it's own track, and for now we are living in 
isolation from it...may revisit the need for the API, closer to the time 
when it becomes apparent what features will be available

Code Review: clean, no comments, push it

/Mr. Simms

On 2019-12-17 17:37, Frederic Parain wrote:
> Here’s a second JNI extension for flattened arrays.
> The first extension (JDK-8234761) was designed to provide fast native access
> to flattened arrays of pure primitives inline types.
> This second extension has a different goal: it aims at providing easy access
> to any kind of flattened array.
> One pain point of flattened arrays is that even if a code needs a single
> field from a flattened value stored in an array, it usually has to get
> the whole element first, and then get the field from the element. With
> flattened fields, this process can include several more steps to get the
> flattened field before being able to get one field from this flattened field.
> This proposal of a new JNI extension tries to avoid this burden by defining
> the notion of sub-element and sub-element selector.
> A sub-element represents either a whole element of a flattened array, or a
> field stored in an element of a flattened array. A sub-element can be at
> any level of nesting: if the array element includes flattened fields which
> themselves include flattened field, any field of any of these flattened
> fields is a sub-element. Any kind of field is a sub-element: primitive
> fields, reference fields, or flattened fields.
> The new JNI APIs provide a way to create sub-element selectors, Java objects
> designating a particular sub-element of a flattened array. They also provide
> methods to directly read or write sub-elements without having to go through
> all steps of nesting.
> Webrev:
> Comments are welcome.
> Thank you,
> Fred

More information about the valhalla-dev mailing list