[lworld+vector] RFR: 8304310: Initial compilers and runtime handling for multifield backed vectors. [v13]

Vladimir Ivanov vlivanov at openjdk.org
Fri May 12 18:40:17 UTC 2023


On Tue, 9 May 2023 19:03:26 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> src/hotspot/share/prims/vectorSupport.cpp line 286:
>> 
>>> 284: }
>>> 285: 
>>> 286: InstanceKlass* VectorSupport::get_vector_payload_klass(BasicType elem_bt, int num_elem) {
>> 
>> Alternatively, it could be implemented as a class lookup by name. 
>> 
>> It is fine for now, but eventually I'd like to get rid of `vmSymbols::vector_VectorPayloadMF*_signature()` and `vector_VectorPayloadMF*_klass` and use only `VectorSupport.VectorPayloadMF` to mark classes which need special handling. 
>> 
>> Original implementation requires subclasses to declare 2 static fields which are used by `klass2length` and `klass2bt` queries. Since typed vector classes declare a field of primitive type, it can be used as the source of information now.
>
> I thought about it but any lookup by name may be costly. But we can refine as suggested.

If it turns out to be costly, JVM can keep a table on its side to cache lookup results.

>> src/hotspot/share/prims/vectorSupport.cpp line 403:
>> 
>>> 401:   fieldDescriptor fd;
>>> 402:   int elem_size = type2aelembytes(elem_bt);
>>> 403:   Symbol* payload_sig = VectorSupport::get_vector_payload_field_signature(elem_bt, num_elem);
>> 
>> Alternatively, you could derive that information from `payload` field. Would it also make `klass2length()` and `klass2bt()` queries (and relevant static final fields on Java side) obsolete?
>
>> Alternatively, you could derive that information from `payload` field. Would it also make `klass2length()` and `klass2bt()` queries (and relevant static final fields on Java side) obsolete?
> 
> find_field need field signature to query the fieldDescriptor.   payload is no longer a primitive array but a primitive class instance, we still need pass klass2length() and klass2bt() information to payload signature factory method.

Looking up the field by name in the trusted class is also an option.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/833#discussion_r1192675829
PR Review Comment: https://git.openjdk.org/valhalla/pull/833#discussion_r1192674420



More information about the valhalla-dev mailing list