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
Flatten non-static NullRestricted fields #18173
Flatten non-static NullRestricted fields #18173
Conversation
runtime/oti/j9.h
Outdated
@@ -337,6 +337,7 @@ static const struct { \ | |||
* Disable flattening of volatile field that is > 8 bytes for now, as the current implementation of copyObjectFields() will tear this field. | |||
*/ | |||
#define J9_IS_FIELD_FLATTENED(fieldClazz, romFieldShape) \ | |||
J9_ARE_NO_BITS_SET((romFieldShape)->modifiers, J9FieldFlagIsNullRestricted) || \ |
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.
Only null restricted field can be potentially flattened with the newer javac, so it should be sth like J9_ARE_ALL_BITS_SET((romFieldShape)->modifiers, J9FieldFlagIsNullRestricted) && (ALL the existing conditions of J9_IS_FIELD_FLATTENED)
As the current javac does not produce null restricted attribute yet, for now to keep the builds working, we can keep this macro unchanged and add a new macro J9_IS_NULL_RESTRICTED_FIELD_FLATTENED
and define it to
J9_ARE_ALL_BITS_SET((romFieldShape)->modifiers, J9FieldFlagIsNullRestricted) && J9_IS_FIELD_FLATTENED()
.
Then in this line, you can use J9_IS_NULL_RESTRICTED_FIELD_FLATTENED
. Eventually we will remove the current J9_IS_FIELD_FLATTENED
and rename J9_IS_NULL_RESTRICTED_FIELD_FLATTENED
to J9_IS_FIELD_FLATTENED
.
Also this line should be removed as it will always be false with the new javac. (If there are tests failed due to this remval, the test should be either rewritten or disabled)
But I think these changes can be done under #18157, not necessarily in this PR.
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.
88cfaf7
to
82db70b
Compare
runtime/oti/j9.h
Outdated
@@ -339,6 +339,10 @@ static const struct { \ | |||
#define J9_IS_FIELD_FLATTENED(fieldClazz, romFieldShape) \ | |||
(J9_IS_J9CLASS_FLATTENED(fieldClazz) && \ | |||
(J9_ARE_NO_BITS_SET((romFieldShape)->modifiers, J9AccVolatile) || (J9CLASS_UNPADDED_INSTANCE_SIZE(fieldClazz) <= sizeof(U_64)))) | |||
/* This will replace J9_IS_FIELD_FLATTENED when QTypes are removed */ | |||
#define J9_IS_NULL_RESTRICTED_FIELD_FLATTENED(fieldClazz, romFieldShape) \ | |||
J9_ARE_ALL_BITS_SET((romFieldShape)->modifiers, J9FieldFlagIsNullRestricted) && \ |
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 see J9_IS_J9CLASS_FLATTENED(fieldClazz)
is removed. After looking at the code closer, I think we should still keep J9_IS_J9CLASS_FLATTENED(fieldClazz)
, as user can use -XX:ValueTypeFlatteningThreshold=<size>
to control whether J9ClassIsFlattened
will be set on a J9Class based on the instance size. This should change the field flattening behaviour.
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.
yes thats true. that addition will make it so J9_IS_NULL_RESTRICTED_FIELD_FLATTENED since its only true for primitive value classes but its going to get messier before it gets better.
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 have added J9_IS_NULL_RESTRICTED_FIELD_FLATTENED
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.
OK, thanks
82db70b
to
947bfea
Compare
Signed-off-by: Theresa Mammarella <Theresa.T.Mammarella@ibm.com>
947bfea
to
4735b67
Compare
Jenkins test sanity,extended zlinuxval jdknext |
Related: #17340