-
Notifications
You must be signed in to change notification settings - Fork 776
Fix J9ClassHasIdentity flag assignment #23008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Set the J9ClassHasIdentity flag only if the class is not a value class and not an interface.
d1e0327 to
ae31000
Compare
| #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)) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| #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)) { |
There was a problem hiding this comment.
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 ?
Set the J9ClassHasIdentity flag only if the class is
not a value class and not an interface.
Fixes the following failure in
test/jdk/valhalla/valuetypes/ValueClassTest.java