On Thu, 7 May 2026 23:41:10 GMT, Coleen Phillimore <[email protected]> wrote:

>> Yeah, it's possible, but I wasn't totally sure what other components might 
>> be inspecting this field directly. Didn't want to rock the boat. I agree 
>> it's worth considering as a future refactoring.
>
> I didn't really like injecting 'identity'.   java.lang.Class can figure this 
> out optimally without the JVM's help.
> The JVM just sets the value based on whether it's an array and the 
> ACC_IDENTITY access flag is set.
> 
>   set_is_identity(mirror(), k->is_array_klass() || k->is_identity_class());
> 
> You could cache the answer if you'd like in a field:
>    value = !isArray() && getClassAccessFlags() has ACC_IDENTITY (why not in 
> modifiers??) && !primitive && !isInterface();
> 
> Anyways, you can check the performance and fix this later.

Good to know! Somehow I was thinking it was filtered out of `modifiers`, but 
it's right there, so easy to check directly.

I tried to see what happens if I delete the field & constructor parameter, but 
stuff breaks without many breadcrumbs, so I'll file a bug and leave that to 
somebody who knows what they're doing. 😄

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2397#discussion_r3210089567

Reply via email to