RFR: 8349860: Make Class.isArray(), Class.isInterface() and Class.isPrimitive() non-native

David Holmes dholmes at openjdk.org
Wed Feb 19 05:14:58 UTC 2025


On Tue, 11 Feb 2025 20:56:39 GMT, Coleen Phillimore <coleenp at 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.

Just a few passing comments as this is mainly compiler stuff.

Does the SA not need any updates in relation to this?

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. ???

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?

src/java.base/share/classes/java/lang/Class.java line 1009:

> 1007:     private transient Object classData; // Set by VM
> 1008:     private transient Object[] signers; // Read by VM, mutable
> 1009:     private final transient char modifiers;  // Set by the VM

Why the change of type here?

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

PR Review: https://git.openjdk.org/jdk/pull/23572#pullrequestreview-2625638624
PR Review Comment: https://git.openjdk.org/jdk/pull/23572#discussion_r1960955739
PR Review Comment: https://git.openjdk.org/jdk/pull/23572#discussion_r1960959718
PR Review Comment: https://git.openjdk.org/jdk/pull/23572#discussion_r1960960668


More information about the core-libs-dev mailing list