On Wed, 30 Jul 2025 11:05:34 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:

>> This change removes the intrinsic for getClassAccessFlagsRaw for reflection 
>> and initializes an rawAccessFlags field in java.lang.Class instead, that 
>> Java code can non-natively access.
>> Tested with tier1-4.
>
> 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-b...@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`.

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

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

Reply via email to