[lworld] RFR: 8363846: [lworld] Make Class.isIdentityClass() non-native [v4]
Roger Riggs
rriggs at openjdk.org
Wed Jul 23 18:30:16 UTC 2025
On Wed, 23 Jul 2025 17:24:54 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> This moves isIdentityClass() implementation to Class.java, and checks within the JVM that is_identity_class() doesn't check the access flags for an ArrayKlass, since AccessFlags aren't initialized in ArrayKlasses. The AccessFlags should be moved from Klass.hpp to InstanceKlass.cpp in mainline but that's a more complicated change and has several pieces.
>> Added a test.
>> Tested with tier1 locally.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>
> Minimize the test.
test/jdk/valhalla/valuetypes/IsIdentityClassTest.java line 27:
> 25: * @test
> 26: * @summary Test that IsIdentityClass and modifiers return true for arrays that can be flattened.
> 27: * @library /test/lib
You'll need to add `@enablePreview false` to counteract the setting in TEST.properties.
Its still running both tests as enablePreview = true.
test/jdk/valhalla/valuetypes/IsIdentityClassTest.java line 41:
> 39:
> 40: import jdk.internal.misc.PreviewFeatures;
> 41: import jdk.internal.value.ValueClass;
Unused import
test/jdk/valhalla/valuetypes/IsIdentityClassTest.java line 62:
> 60: assertFalseIfPreview(Modifier.isIdentity(imod), "Modifier of Integer should not have IDENTITY set");
> 61: int amod = Integer[].class.getModifiers();
> 62: assertTrue(Modifier.isIdentity(amod), "Modifier of array of inline types should have IDENTITY set");
Suggestion:
assertEquals(PreviewFeatures.isPreviewEnabled(), Modifier.isIdentity(amod), "Modifier of array should have IDENTITY set");
Before Valhalla, Arrays had identity but did not have a modifier bit set.
When --enable-preview, the IDENTITY modifier bit is set.
test/jdk/valhalla/valuetypes/IsIdentityClassTest.java line 68:
> 66: void testAccessFlags() {
> 67: Set<AccessFlag> iacc = Integer.class.accessFlags();
> 68: assertFalseIfPreview(iacc.contains(Modifier.IDENTITY), "Access flags should not contain IDENTITY");
Suggestion:
if (PreviewFeatures.isEnabled()) {
Set<AccessFlag> iacc = Integer.class.accessFlags();
assertFalse(iacc.contains(AccessFlag.IDENTITY), "Access flags should not contain IDENTITY");
}
Without --enable-preview (before Valhalla), there was no IDENTITY accessflag.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1514#discussion_r2226254970
PR Review Comment: https://git.openjdk.org/valhalla/pull/1514#discussion_r2226225014
PR Review Comment: https://git.openjdk.org/valhalla/pull/1514#discussion_r2226322924
PR Review Comment: https://git.openjdk.org/valhalla/pull/1514#discussion_r2226336992
More information about the valhalla-dev
mailing list