RFR: 8339113: AccessFlags can be u2 in metadata [v9]
Serguei Spitsyn
sspitsyn at openjdk.org
Thu Jan 2 23:36:41 UTC 2025
On Thu, 2 Jan 2025 13:20:20 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> Please review this change that makes AccessFlags and modifier_flags u2 types and removes the last remnants of Hotspot adding internal access flags. This change moves AccessFlags and modifier_flags in Klass to alignment gaps saving 16 bytes. From pahole: so it's a bit better.
>>
>> before:
>>
>> /* size: 216, cachelines: 4, members: 25, static members: 17 */
>> /* sum members: 194, holes: 3, sum holes: 18 */
>>
>>
>> after:
>>
>> /* size: 200, cachelines: 4, members: 25, static members: 17 */
>> /* sum members: 188, holes: 4, sum holes: 12 */
>>
>>
>> We may eventually move the modifiers to java.lang.Class but that's WIP.
>>
>> Tested with tier1-7 on oracle platforms. Did test builds on other platforms (please try these changes ppc/arm32 and s390). Also requires minor Graal changes.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>
> Happy New Year
src/hotspot/share/prims/jvmtiRedefineClasses.cpp line 1151:
> 1149: // methods match, be sure modifiers do too
> 1150: old_flags = k_old_method->access_flags().as_unsigned_short();
> 1151: new_flags = k_new_method->access_flags().as_unsigned_short();
Nit: I'd suggest to use `as_method_flags()` and `as_class_flags()` at lines 1008-1009 to make it consistent with the lines 1043-1044. Good example is `jvmtiClassFileReconstituter.cpp`. Also, it would make sense to expend this rule to some other files, e.g.:
`methodHandles.cpp`, `jvmtiEnv.cpp`, `jvm.cpp`, instanceClass.cpp`, `fieldInfo.inline.hpp`, `fieldInfo.cpp
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22246#discussion_r1901371957
More information about the serviceability-dev
mailing list