RFR: 8339113: AccessFlags can be u2 in metadata [v13]
Dean Long
dlong at openjdk.org
Tue Jan 7 21:02:19 UTC 2025
On Tue, 7 Jan 2025 02:36:36 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:
>
> Make more AccessFlags fetches more specific and remove an assert and remove this->s.
src/hotspot/share/classfile/vmIntrinsics.cpp line 39:
> 37:
> 38: // These are flag-matching functions:
> 39: inline bool match_F_R(u2 flags) {
I wish more code could be size-agnostic. So instead of using `u2` here, there could be a typedef in accessFlags.hpp that we could use that hides the size. However, it's not a big deal, because it seems unlikely this type will change much in the future without a JVM spec change. I'm tempted to suggesting using AccessFlags here, but it's a class. Since this is an end-point "consumer" of the type that doesn't store it or pass it along, we could even use something like `uint` here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22246#discussion_r1906033152
More information about the serviceability-dev
mailing list