-
Notifications
You must be signed in to change notification settings - Fork 729
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
Unhide compressed refs logic from Unsafe CAS codegen #20400
Conversation
Disables code on Power and Z that hides compressedrefs logic from the fast path code generation for the following recognized methods: sun_misc_Unsafe_compareAndSwapObject_jlObjectJjlObjectjlObject_Z jdk_internal_misc_Unsafe_compareAndExchangeObject jdk_internal_misc_Unsafe_compareAndExchangeReference Fast path code generation for those recognized methods is updated to handle compressedrefs. Original behavior can be restored by setting the TR_UseOldCompareAndSwapObject environment variable. This behavior matches the X implementation which has already disabled the compressedrefs hiding logic when the envvar is not set. Signed-off-by: jimmyk <[email protected]>
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.
Couple of nitpicks. Overall it looks good to me.
// Hiding compressedref logic from CodeGen doesn't seem a good practise, the evaluator always need the uncompressedref node for write barrier, | ||
// therefore, this part is deprecated. It'll be removed once P and Z update their corresponding evaluators. | ||
// Hiding compressedref logic from CodeGen isn't a good practice, and the evaluator still needs the uncompressedref node for write barriers. | ||
// Therefore, this part is deprecated. It can only be activated on X, P or Z with the TR_UseOldCompareAndSwapObject envvar. | ||
static bool UseOldCompareAndSwapObject = (bool)feGetEnv("TR_UseOldCompareAndSwapObject"); |
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.
Something that already in code, but not related to overall changes, Should we change UseOldCompareAndSwapObject
to useOldCompareAndSwapObject
?
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 can change this.
@@ -11952,7 +11952,7 @@ TR::Register* | |||
J9::Z::TreeEvaluator::VMinlineCompareAndSwap(TR::Node *node, TR::CodeGenerator *cg, TR::InstOpCode::Mnemonic casOp, bool isObj, bool isExchange) | |||
{ | |||
TR::Register *scratchReg = NULL; | |||
TR::Register *objReg, *oldVReg, *newVReg; | |||
TR::Register *objReg, *oldVReg, *newVReg, *decompressedValueRegister; |
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 understand this exists, but we should initialize the registers here with 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.
I can change this.
@@ -11969,9 +11969,10 @@ J9::Z::TreeEvaluator::VMinlineCompareAndSwap(TR::Node *node, TR::CodeGenerator * | |||
// compression sequence. | |||
bool isValueCompressedReference = false; | |||
|
|||
TR::Node* decompressedValueNode = newVNode; | |||
static bool UseOldCompareAndSwapObject = (bool)feGetEnv("TR_UseOldCompareAndSwapObject"); |
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 understand the intention was to match the environment set throughout the code base, but we should rename variable name useOldCompareAndSwapObject
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 can change this.
Added more comments to clarify issues. Renamed UseOldCompareAndSwapObject to useOldCompareAndSwapObject.
My latest commit should address all previous comments. |
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.
LGTM. Trivial change in x86 evaluator is fine as well. Sniffed at P code seems fine. Will wait for @zl-wang 's review.
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.
LGTM
jenkins test sanity all jdk21 |
Failure in https://openj9-jenkins.osuosl.org/job/Test_openjdk21_j9_sanity.openjdk_aarch64_linux_Personal/84/ is not related with the changes in this PR, they are related to #18463. |
Given the one failure related to #18463, other tests on all other platform passes. Merging this one. |
Disables code on Power and Z that hides compressedrefs logic from the fast path code generation for the following recognized methods:
sun_misc_Unsafe_compareAndSwapObject_jlObjectJjlObjectjlObject_Z
jdk_internal_misc_Unsafe_compareAndExchangeObject
jdk_internal_misc_Unsafe_compareAndExchangeReference
Fast path code generation for those recognized methods is updated to handle compressedrefs.
Original behavior can be restored by setting the
TR_UseOldCompareAndSwapObject
environment variable. This behavior matches the X implementation which has already disabled the compressedrefs hiding logic when the envvar is not set.