-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Simpler using compressed oops flag representation #15509
Simpler using compressed oops flag representation #15509
Conversation
This commit modifies the internal representation of the JVM flag UseCompressedOops to just be a String. This means we can just store the value of the flag or "unknown" directly so that we do not have to engage in shenanigans with three-valued logic around a boxed boolean. Relates #15489
The ultimate endgame here is simpler handling in the backwards compatibility code in the 2.x line so that we can distinguish between "true", "false" and "unknown" from a >= 2.2.0 node, and null from a < 2.2.0 node. |
} else { | ||
usingCompressedOops = null; | ||
} | ||
useCompressedOops = in.readOptionalString(); |
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.
Can it be null?
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.
@nik9000 Not in master, good catch. I'll remove the optional for master but it will be needed on the 2.x backport.
LGTM - I left a comment asking about the return value from the jvm's info API. Maybe if it returns null we should set it to "unknown". |
@@ -307,7 +314,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws | |||
builder.field(Fields.GC_COLLECTORS, gcCollectors); | |||
builder.field(Fields.MEMORY_POOLS, memoryPools); | |||
|
|||
builder.field(Fields.USING_COMPRESSED_OOPS, usingCompressedOops == null ? "unknown" : Boolean.toString(usingCompressedOops)); | |||
builder.field(Fields.USING_COMPRESSED_OOPS, useCompressedOops); |
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.
If it can be null we should skip it here.
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.
@nik9000 Yes, that's exactly how it will be on the backport but it's not needed here.
The return from the API can not be null. |
…resentation Simpler using compressed oops flag representation
Thank you for reviewing @nik9000. |
This commit modifies the internal representation of the JVM flag
UseCompressedOops to just be a String. This means we can just store the
value of the flag or "unknown" directly so that we do not have to engage
in shenanigans with three-valued logic around a boxed boolean.
Relates #15489