RFR: 8345678: compute_modifiers should not be in create_mirror
Coleen Phillimore
coleenp at openjdk.org
Mon Dec 9 13:05:42 UTC 2024
On Mon, 9 Dec 2024 04:22:54 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> This moves the modifier_flag computation to when InstanceKlass, ObjArrayKlass and TypeArrayKlass are created.
>>
>> Tested with jck:vm and tier1-4.
>
> src/hotspot/share/classfile/javaClasses.cpp line 1119:
>
>> 1117: // to support Class.getModifiers(). Instance classes recalculate
>> 1118: // the cached flags after the class file is parsed, but before the
>> 1119: // class is put into the system dictionary.
>
> Is this comment already out-of-date? I'm trying to see where the flags are recomputed after parsing.
I thought the comment was referring to this code below that recalculates the modifier flags. Don't know why system dictionary was called out though.
> src/hotspot/share/oops/typeArrayKlass.hpp line 76:
>
>> 74: void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS);
>> 75:
>> 76: // jvm support
>
> "jvm support" for what? I'm not even sure why we need `compute_modifier_flags` for array types when they have a fixed value. Can't we just hardwire them and only call `compute_modifier_flags` for instanceKlasses?
ObjArrayKlass computes the modifier flags based on the bottom_klass, and there is a place that calls compute_modifier_flags in an assert that requires the virtual function, albeit for an assert, otherwise I would have made it not a virtual function.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22618#discussion_r1875946187
PR Review Comment: https://git.openjdk.org/jdk/pull/22618#discussion_r1875948835
More information about the serviceability-dev
mailing list