Skip to content
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

Disable commoning of dataAddr Pointer in createStoresForVar() #7476

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions compiler/il/OMRNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3911,13 +3911,25 @@ OMR::Node::createStoresForVar(TR::SymbolReference * &nodeRef, TR::TreeTop *inser
}
else
{
newArrayRef = comp->getSymRefTab()->
createTemporary(comp->getMethodSymbol(), TR::Address);
TR::Node *arrayObjectNode = NULL;
TR::Node *arrayLoadNode = NULL;

TR::Node *newStore = TR::Node::createStore(newArrayRef, child);
if (child->isDataAddrPointer())
arrayObjectNode = child->getFirstChild();

newArrayRef = comp->getSymRefTab()->createTemporary(comp->getMethodSymbol(), TR::Address);
TR::Node *newStore = TR::Node::createStore(newArrayRef, arrayObjectNode ? arrayObjectNode : child);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests whether arrayObjectNode is non-null in deciding whether to use arrayObjectNode or child, but the condition on the if statement below uses child->isDataAddrPointer() again. It might be easier to read if both used the same condition - I have a slight preference for child->isDataAddrPointer() to make it more obvious arrayObjectNode will be operated set or referenced in all three places.

newStoreTree = TR::TreeTop::create(comp, newStore);

newArrayRef->getSymbol()->setPinningArrayPointer();
pinningArray = newArrayRef->getSymbol()->castToAutoSymbol();

if (child->isDataAddrPointer())
{
arrayLoadNode = TR::Node::createLoad(arrayObjectNode, newArrayRef);
child->setAndIncChild(0, arrayLoadNode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are changing the grand-child array object load to the pinning-array local load, but i didn't see previous code (for non-offheap case) changing the child into the corresponding pinning array local load. is it done somewhere else?

I would like to ask @vijaysun-omr for a review too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intent was take a similar approach to what was done in c86da7e:

omr/compiler/il/OMRNode.cpp

Lines 3788 to 3800 in fa23d1b

if (self()->isDataAddrPointer())
{
TR::Node *firstChild = self()->getFirstChild();
TR::Node *arrayLoadNode = NULL;
TR::SymbolReference *newArrayRef = comp->getSymRefTab()->createTemporary(comp->getMethodSymbol(), TR::Address);
TR::Node *newStore = TR::Node::createStore(newArrayRef, firstChild);
TR::TreeTop *newStoreTree = TR::TreeTop::create(comp, newStore);
insertBefore = origInsertBefore->insertBefore(newStoreTree);
arrayLoadNode = TR::Node::createLoad(firstChild, newArrayRef);
self()->setAndIncChild(0, arrayLoadNode);
firstChild->recursivelyDecReferenceCount();
return insertBefore;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Julian that we probably don't need to change the child to be a load of the newly created temp (the code after line 3927). It probably doesn't hurt doing so either. If you have time to test without the changes to use the load, that may be worth it to minimize what is being changed.

arrayObjectNode->recursivelyDecReferenceCount();
}
}
}
}
Expand Down