RFR: JDK-8318563: GetClassFields should not use random access to field [v2]

Hannes Greule hgreule at openjdk.org
Wed Jan 10 10:18:22 UTC 2024


On Wed, 10 Jan 2024 05:28:39 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> src/hotspot/share/prims/jvmtiEnv.cpp line 2910:
>> 
>>> 2908:     result_list[i] = jfieldIDWorkaround::to_jfieldID(
>>> 2909:           ik, flds.offset(),
>>> 2910:           flds.access_flags().is_static());
>> 
>> I think the indent here should be 4, not 6.
>
> You said in the description that the order was reversed, but I don't see where that is getting fixed. It seems it was partially fixed by [JDK-8317692](https://bugs.openjdk.org/browse/JDK-8317692), but it is only preserving the class hierarchy order, but not the order of fields within each class. If that's all you are attempting to do, then please make it clear in the description.

FieldStream from reflectionUtils iterates fields in reverse order, so reversing again was previously needed here. JavaFieldStream from fieldStreams (and the new FilteredJavaFieldStream) iterate in the order the fields actually occur, so this double-reversing isn't needed anymore.

It's a bit confusing to have FilteredJavaFieldStream in reflectionUtils; eventually it would probably make sense to move the FilteredFieldsMap and FilteredjavaFieldStream into fieldStreams instead?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17094#discussion_r1447163822


More information about the hotspot-dev mailing list