Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions runtime/vm/createramclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2406,8 +2406,8 @@ internalCreateRAMClassDone(J9VMThread *vmThread, J9ClassLoader *classLoader, J9C
}
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */
#endif /* defined(J9VM_OPT_VALHALLA_VALUE_TYPES) */
} else if (!(J9_IS_CLASSFILE_OR_ROMCLASS_VALUETYPE_VERSION(romClass) && J9ROMCLASS_IS_INTERFACE(romClass))) {
/* All classes before value type version are identity. */
} else if (!J9ROMCLASS_IS_VALUE(romClass) && !J9ROMCLASS_IS_INTERFACE(romClass)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove the interface check here. J9ROMCLASS_IS_VALUE is only true when an interface flag is not set.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J9ROMCLASS_IS_VALUE is false for interfaces. If I remove the interface check, J9ROMCLASS_IS_VALUE will return false for interfaces and enters the else if block and sets J9ClassHasIdentity flag for interfaces too.

Copy link
Contributor

@hangshao0 hangshao0 Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the original code, if Valhalla JDK is running on an older version of class file (e.g. Java 21), J9ClassHasIdentity is set on interface. With this change, J9ClassHasIdentity won't be set.

Have you checked the return value of java.lang.Class.isIdentity() with OpenJDK Valhalla build if given a interface compiled by Java 21 ?

/* All classes which are not value classes and are not interfaces are identity. */
classFlags |= J9ClassHasIdentity;
}
#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
Expand Down