-
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
Update BCDCHK uncommoning for off-heap #20302
Merged
r30shah
merged 1 commit into
eclipse-openj9:master
from
VermaSh:off-heap_daa_failure_fix
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,15 @@ UncommonBCDCHKAddressNode::perform() | |
{ | ||
TR::Node* node = tt->getNode(); | ||
|
||
if(node && node->getOpCodeValue() == TR::BCDCHK && node->getSymbol() && node->getSymbol()->getResolvedMethodSymbol()) | ||
if(node && node->getOpCodeValue() == TR::BCDCHK && | ||
node->getSymbol() && | ||
node->getSymbol()->getResolvedMethodSymbol() && | ||
node->getNumChildren() >= 2 && | ||
node->getFirstChild() && | ||
node->getFirstChild()->getType().isBCD() && | ||
node->getSecondChild() && | ||
node->getSecondChild()->getDataType().isAddress() && | ||
node->getSecondChild()->getReferenceCount() > 1) | ||
{ | ||
TR::RecognizedMethod method = node->getSymbol()->getResolvedMethodSymbol()->getRecognizedMethod(); | ||
if(method == TR::com_ibm_dataaccess_DecimalData_convertIntegerToPackedDecimal_ || | ||
|
@@ -60,27 +68,51 @@ UncommonBCDCHKAddressNode::perform() | |
method == TR::com_ibm_dataaccess_PackedDecimal_shiftLeftPackedDecimal_ || | ||
method == TR::com_ibm_dataaccess_PackedDecimal_shiftRightPackedDecimal_) | ||
{ | ||
TR::Node* pdOpNode = node->getFirstChild(); | ||
TR::Node* oldAddressNode = node->getSecondChild(); | ||
TR_ASSERT(pdOpNode && oldAddressNode, "Unexpected null PD opNode or address node under BCDCHK"); | ||
TR_ASSERT(oldAddressNode->getNumChildren() == 2, "Expecting 2 children under address node of BCDCHK."); | ||
|
||
TR::ILOpCodes addressOp = oldAddressNode->getOpCodeValue(); | ||
TR_ASSERT((addressOp == TR::aladd || addressOp == TR::aiadd), "Unexpected addressNode opcode"); | ||
|
||
if(oldAddressNode->getReferenceCount() > 1) | ||
/* Expected tree structures for oldAddressNode | ||
* 1. non off-heap mode | ||
* aladd/aiadd | ||
* load array_object | ||
* array_element_offset | ||
* | ||
* 2. off-heap enabled: loading first array element because offset is 0 | ||
* aloadi <contiguousArrayDataAddrFieldSymbol> | ||
* load array_object | ||
* | ||
* 3. off-heap enabled | ||
* aladd/aiadd | ||
* aloadi <contiguousArrayDataAddrFieldSymbol> | ||
* load array_object | ||
* array_element_offset | ||
*/ | ||
TR_ASSERT_FATAL_WITH_NODE(node, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to have the expected tree structure comment moved here before the ASSERT to highlight what you are checking here? |
||
(oldAddressNode->isDataAddrPointer() && oldAddressNode->getNumChildren() == 1) | ||
|| ((addressOp == TR::aladd || addressOp == TR::aiadd) && oldAddressNode->getNumChildren() == 2), | ||
"Expecting either a dataAddrPointer node with 1 child or a aladd/aiadd with 2 children under address node of BCDCHK." | ||
"But the address node %s had %d children and dataAddrPointer flag set to %s\n", | ||
oldAddressNode->getOpCode().getName(), oldAddressNode->getNumChildren(), oldAddressNode->isDataAddrPointer() ? "true" : "false"); | ||
TR::Node* newAddressNode = NULL; | ||
if (oldAddressNode->getOpCodeValue() == TR::aloadi) | ||
{ | ||
TR::Node* newAddressNode = TR::Node::create(node, addressOp, 2, | ||
oldAddressNode->getFirstChild(), | ||
oldAddressNode->getSecondChild()); | ||
node->setAndIncChild(1, newAddressNode); | ||
oldAddressNode->decReferenceCount(); | ||
traceMsg(comp(), "%sReplacing node %s [%p] with [%p]\n", | ||
OPT_DETAILS, | ||
oldAddressNode->getOpCode().getName(), | ||
oldAddressNode, | ||
newAddressNode); | ||
// handles expected tree structure 2 | ||
newAddressNode = TR::TransformUtil::generateArrayElementAddressTrees(comp(), oldAddressNode->getFirstChild()); | ||
} | ||
else | ||
{ | ||
// handles expected tree structure 1 and 3 | ||
newAddressNode = TR::Node::create(node, addressOp, 2, | ||
oldAddressNode->getFirstChild(), | ||
oldAddressNode->getSecondChild()); | ||
} | ||
|
||
node->setAndIncChild(1, newAddressNode); | ||
oldAddressNode->decReferenceCount(); | ||
traceMsg(comp(), "%sReplacing node %s [%p] with [%p]\n", | ||
OPT_DETAILS, | ||
oldAddressNode->getOpCode().getName(), | ||
oldAddressNode, | ||
newAddressNode); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 do not want to stretch this PR too much as it is fixing the functional issue, and following question is related to code that already exists so we can probably in future change this.
Instead of having a large if condition check, we should take out the check for recog. DAA method to a separate function and have a switch case in that function, that will make this code more readable.
Again, suggestion as it is something I observed in the PR.