Second JNI extension for flattened arrays
david.simms at oracle.com
Tue Jan 7 15:20:01 UTC 2020
Yeah the fieldID makes more sense, maybe
"GetFieldOffsetInFlattenedLayout()" might want to follow suit (in
another change sometime)...
On 19/12/19 4:48 pm, Frederic Parain wrote:
> 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:
>> 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.
>>> Comments are welcome.
>>> Thank you,
More information about the valhalla-dev