RFR: 8364187: Make getClassAccessFlagsRaw non-native [v4]

Coleen Phillimore coleenp at openjdk.org
Wed Jul 30 16:57:56 UTC 2025


On Wed, 30 Jul 2025 12:21:14 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update src/java.base/share/classes/jdk/internal/reflect/Reflection.java
>>   
>>   Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com>
>
> src/hotspot/share/opto/memnode.cpp line 1986:
> 
>> 1984:     // (Folds up the 2nd indirection in Reflection.getClassAccessFlags(aClassConstant).)
>> 1985:     assert(Opcode() == Op_LoadUS, "must load an unsigned short from _access_flags");
>> 1986:     return TypeInt::make(klass->access_flags());
> 
> I think this optimization should stay because the `_getSuperclass` intrinsic still emits a load from `Klass::access_flags_offset()` that could potentially be optimized here, see:
> https://github.com/openjdk/jdk/blob/ed70910b0f3e1b19d915ec13ac3434407d01bc5d/src/hotspot/share/opto/library_call.cpp#L4081-L4088
> ->
> https://github.com/openjdk/jdk/blob/ed70910b0f3e1b19d915ec13ac3434407d01bc5d/src/hotspot/share/opto/library_call.cpp#L3970-L3973
> 
> You can still remove the lines referencing `Reflection.getClassAccessFlags`.

Thank you, right, the code still references Klass::_access_flags.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26517#discussion_r2243330614


More information about the core-libs-dev mailing list