On Wed, 19 Feb 2025 05:01:53 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> Class.isInterface() can check modifier flags, Class.isArray() can check 
>> whether component mirror is non-null and Class.isPrimitive() needs a new 
>> final transient boolean in java.lang.Class that the JVM code initializes.
>> Tested with tier1-4 and performance tests.
>
> src/hotspot/share/classfile/javaClasses.cpp line 1371:
> 
>> 1369: #endif
>> 1370:   set_modifiers(java_class, JVM_ACC_ABSTRACT | JVM_ACC_FINAL | 
>> JVM_ACC_PUBLIC);
>> 1371:   set_is_primitive(java_class);
> 
> Just wondering what the comments at the start of this method are alluding to 
> now that we do have a field at the Java level. ???

I think this comment is talking about java.lang.Class.klass field is null.  
Which it still is since there's no Klass pointer for basic types. But no idea 
what the comment is in ClassFileParser and I don't think introducing a new 
Klass for primitive types is an improvement.  There are comments elsewhere that 
the klass is null for primitive types, including the call to 
java_lang_Class::is_primitive(), so this whole comment is only confusing so 
I'll remove it.  Or change it to:

  // Mirrors for basic types have a null klass field, which makes them special.

> src/hotspot/share/prims/jvm.cpp line 1262:
> 
>> 1260: JVM_END
>> 1261: 
>> 1262: JVM_ENTRY(jboolean, JVM_IsArrayClass(JNIEnv *env, jclass cls))
> 
> Where are the changes to jvm.h?

Good catch, I also removed getProtectionDomain.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23572#discussion_r1961739084
PR Review Comment: https://git.openjdk.org/jdk/pull/23572#discussion_r1961773882

Reply via email to