Skip to content

Commit

Permalink
Merge pull request eclipse-openj9#16916 from a7ehuo/fix-setHasNews-VP
Browse files Browse the repository at this point in the history
Value Types: Set setHasNews on the compiled method symbol
  • Loading branch information
hzongaro committed Mar 16, 2023
2 parents de87c47 + ef1b11e commit 5b6fbc8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions runtime/compiler/optimizer/J9ValuePropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ J9::ValuePropagation::constrainRecognizedMethod(TR::Node *node)
bool canTransformUnflattenedArrayElementLoadStoreUseTypeHint = false;
bool canTransformIdentityArrayElementLoadStoreUseTypeHint = false;
static const char *disableFlattenedArrayElementTypeHintXForm = feGetEnv("TR_DisableFlattenedArrayElementTypeHintXForm");
static const char *disableUnflattenedArrayElementTypeHintXForm = feGetEnv("TR_DisableUnflattenedArrayElementTypeHintXForm");
static const char *enableUnflattenedArrayElementTypeHintXForm = feGetEnv("TR_EnableUnflattenedArrayElementTypeHintXForm");
TR_OpaqueClassBlock *typeHintClass = arrayConstraint ? arrayConstraint->getTypeHintClass() : NULL;

if (typeHintClass &&
Expand All @@ -984,7 +984,7 @@ J9::ValuePropagation::constrainRecognizedMethod(TR::Node *node)
{
TR_OpaqueClassBlock *hintComponentClass = comp()->fej9()->getComponentClassFromArrayClass(typeHintClass);

if (!disableUnflattenedArrayElementTypeHintXForm &&
if (enableUnflattenedArrayElementTypeHintXForm &&
TR::Compiler->cls.classHasIdentity(hintComponentClass))
{
canTransformIdentityArrayElementLoadStoreUseTypeHint = true;
Expand Down Expand Up @@ -1017,7 +1017,7 @@ J9::ValuePropagation::constrainRecognizedMethod(TR::Node *node)
}
}
}
else if (!disableUnflattenedArrayElementTypeHintXForm)
else if (enableUnflattenedArrayElementTypeHintXForm)
{
canTransformUnflattenedArrayElementLoadStoreUseTypeHint = true;
}
Expand Down Expand Up @@ -2195,6 +2195,7 @@ J9::ValuePropagation::transformFlattenedArrayElementLoad(TR_OpaqueClassBlock *ar
TR::Node *newValueNode = TR::Node::recreateWithoutProperties(callNode, TR::newvalue, fieldCount+1, classNode, comp()->getSymRefTab()->findOrCreateNewValueSymbolRef(method));
newValueNode->setIdentityless(true);
method->setHasNews(true);
comp()->getMethodSymbol()->setHasNews(true);

// If the array element contains zero field, the newvalue will contain only loadaddr
if (fieldCount == 0)
Expand Down Expand Up @@ -2470,6 +2471,10 @@ J9::ValuePropagation::transformFlattenedArrayElementLoadStoreUseTypeHint(TR_Opaq
// "elseTree" is the fast path that uses sym ref to access array elements through "newvalue"
TR::TreeTop *elseTree = TR::TreeTop::create(comp(), callTree->getNode()->duplicateTree());

if (trace())
traceMsg(comp(), "%s: ifTree n%dn (%p). slow path helper call treetop n%dn (%p). fast path newvalue treetop n%dn (%p)\n", __FUNCTION__,
ifTree->getNode()->getGlobalIndex(), ifTree->getNode(), thenTree->getNode()->getGlobalIndex(), thenTree->getNode(), elseTree->getNode()->getGlobalIndex(), elseTree->getNode());

J9::TransformUtil::createDiamondForCall(this,
callTree,
ifTree /* The tree containing the if node */,
Expand Down Expand Up @@ -2539,6 +2544,10 @@ J9::ValuePropagation::transformUnflattenedArrayElementLoadStoreUseTypeHint(TR_Op
// "elseTree" is the fast path that uses regular aaload and aastore to access array elements
TR::TreeTop *elseTree = TR::TreeTop::create(comp(), callTree->getNode()->duplicateTree());

if (trace())
traceMsg(comp(), "%s: ifTree n%dn (%p). slow path helper call treetop n%dn (%p). fast path treetop n%dn (%p)\n", __FUNCTION__,
ifTree->getNode()->getGlobalIndex(), ifTree->getNode(), thenTree->getNode()->getGlobalIndex(), thenTree->getNode(), elseTree->getNode()->getGlobalIndex(), elseTree->getNode());

J9::TransformUtil::createDiamondForCall(this,
callTree,
ifTree /* The tree containing the if node */,
Expand Down

0 comments on commit 5b6fbc8

Please sign in to comment.