Second JNI extension for flattened arrays

Frederic Parain frederic.parain at oracle.com
Thu Dec 19 15:48:24 UTC 2019


Thank you David.

Unfortunately, I had a private discussion with John yesterday,
and there’s a minor change in the API: the GetSubElementSelector
now takes a jfieldID in argument instead of a name/signature pair.
Changes are limited to GetSubElementSelector and tests using it.

New webrev:

http://cr.openjdk.java.net/~fparain/jniflattenedarraysubelement/webrev.01/index.html

Regards,

Fred


> On Dec 19, 2019, at 07:58, David Simms <david.simms at oracle.com> wrote:
> 
> 
> Wow, nice work Frederic, some nice additions to the public API. Perhaps of use for core libraries wishing to make some optimizations with inline classes.
> 
> 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:
>> http://cr.openjdk.java.net/~fparain/jniflattenedarraysubelement/webrev.00/index.html
>> 
>> Comments are welcome.
>> 
>> Thank you,
>> 
>> Fred
>> 



More information about the valhalla-dev mailing list