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

Chen Liang liach at openjdk.org
Wed Feb 19 15:45:56 UTC 2025


On Wed, 19 Feb 2025 05:08:36 GMT, David Holmes <dholmes 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.
>
> 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?

This is to improve the layout so the introduction of a boolean field does not increase the size of a Class object.

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

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


More information about the core-libs-dev mailing list