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

Add eaEscapeHelperSymbol #4665

Merged
merged 1 commit into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 13 additions & 0 deletions compiler/compile/OMRSymbolReferenceTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,19 @@ OMR::SymbolReferenceTable::findOrCreateOSRFearPointHelperSymbolRef()
return element(osrFearPointHelperSymbol);
}

TR::SymbolReference *
OMR::SymbolReferenceTable::findOrCreateEAEscapeHelperSymbolRef()
{
if (!element(eaEscapeHelperSymbol))
{
TR::MethodSymbol* sym = TR::MethodSymbol::create(trHeapMemory(), TR_None);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the rationale for TR_None here that it is not a helper in the sense that it is'nt expected to reach the codegen even ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

correct

sym->setHelper();
TR::SymbolReference* symRef = new (trHeapMemory()) TR::SymbolReference(self(), eaEscapeHelperSymbol, sym);
element(eaEscapeHelperSymbol) = symRef;
}
return element(eaEscapeHelperSymbol);
}

TR::SymbolReference *
OMR::SymbolReferenceTable::getOriginalUnimprovedSymRef(TR::SymbolReference *symRef)
{
Expand Down
16 changes: 16 additions & 0 deletions compiler/compile/OMRSymbolReferenceTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,21 @@ class SymbolReferenceTable
* The call is not to be codegen evaluated, it should be cleaned up before codegen.
*/
osrFearPointHelperSymbol,
/** \brief
*
* A call with this symbol marks a place where we want/need escape analysis to add heapifications for any stack allocated
* objects. The primary use case is to force escape of all live local objects ahead of a throw to an OSR catch block
* but they may also be inserted to facilitate peeking of methods under HCR or other uses. Calls to this helper should
* only exist while escape analysis is running
*
* \code
* call <eaEscapeHelperSymbol>
* \endcode
*
* \note
* The call is not to be codegen evaluated, it should be cleaned up by postEscapeAnalysis.
*/
eaEscapeHelperSymbol,
lowTenureAddressSymbol, // on j9vmthread
highTenureAddressSymbol, // on j9vmthread
fragmentParentSymbol,
Expand Down Expand Up @@ -461,6 +476,7 @@ class SymbolReferenceTable
TR::SymbolReference * findOrCreateJProfileValuePlaceHolderWithNullCHKSymbolRef();
TR::SymbolReference * findOrCreatePotentialOSRPointHelperSymbolRef();
TR::SymbolReference * findOrCreateOSRFearPointHelperSymbolRef();
TR::SymbolReference * findOrCreateEAEscapeHelperSymbolRef();
TR::SymbolReference * findOrCreateInduceOSRSymbolRef(TR_RuntimeHelper induceOSRHelper);

TR::ParameterSymbol * createParameterSymbol(TR::ResolvedMethodSymbol * owningMethodSymbol, int32_t slot, TR::DataType, TR::KnownObjectTable::Index knownObjectIndex = TR::KnownObjectTable::UNKNOWN);
Expand Down
10 changes: 9 additions & 1 deletion compiler/il/Aliases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ OMR::SymbolReference::getUseonlyAliasesBV(TR::SymbolReferenceTable * symRefTab)
return &symRefTab->aliasBuilder.defaultMethodUseAliases();
}

// Aliases for eaEscapeHelper
// Ensure EA sees the method as causing an escape for all arguments passed
if (symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::eaEscapeHelperSymbol))
{
return &symRefTab->aliasBuilder.defaultMethodUseAliases();
}

if (!methodSymbol->isHelper())
{
return &symRefTab->aliasBuilder.defaultMethodUseAliases();
Expand Down Expand Up @@ -312,7 +319,8 @@ OMR::SymbolReference::getUseDefAliasesBV(bool isDirectCall, bool includeGCSafePo

if (symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::arraySetSymbol) ||
symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::osrFearPointHelperSymbol) ||
symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::potentialOSRPointHelperSymbol))
symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::potentialOSRPointHelperSymbol) ||
symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::eaEscapeHelperSymbol))
{
return &symRefTab->aliasBuilder.defaultMethodDefAliases();
}
Expand Down
23 changes: 23 additions & 0 deletions compiler/il/OMRNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,16 @@ OMR::Node::createOSRFearPointHelperCall(TR::Node* originatingByteCodeNode)
return callNode;
}

TR::Node *
OMR::Node::createEAEscapeHelperCall(TR::Node* originatingByteCodeNode, int32_t numChildren)
{
TR::Compilation* comp = TR::comp();

TR_ASSERT(!comp->isPeekingMethod(), "Can not generate the helper call during peeking");

TR::Node* callNode = TR::Node::createWithSymRef(originatingByteCodeNode, TR::call, numChildren, TR::comp()->getSymRefTab()->findOrCreateEAEscapeHelperSymbolRef());
return callNode;
}

TR::Node *
OMR::Node::createLoad(TR::SymbolReference * symRef)
Expand Down Expand Up @@ -8698,3 +8708,16 @@ OMR::Node::isPotentialOSRPointHelperCall()

return false;
}

bool
OMR::Node::isEAEscapeHelperCall()
{
TR::Compilation *c = TR::comp();

if (self()->getOpCode().isCall()
&& self()->getSymbol()->isMethod()
&& c->getSymRefTab()->isNonHelper(self()->getSymbolReference(), TR::SymbolReferenceTable::eaEscapeHelperSymbol))
return true;

return false;
}
12 changes: 12 additions & 0 deletions compiler/il/OMRNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ class OMR_EXTENSIBLE Node
*
*/
static TR::Node *createOSRFearPointHelperCall(TR::Node* originatingByteCodeNode);
/**
* \brief
* Create a call to eaEscapeHelperSymbol
*
* \parm originatingByteCodeNode The node whose bytecode info is used to create the call
*/
static TR::Node *createEAEscapeHelperCall(TR::Node *originatingByteCodeNode, int32_t numChildren);

static TR::Node *createLoad(TR::SymbolReference * symRef);
static TR::Node *createLoad(TR::Node *originatingByteCodeNode, TR::SymbolReference *);
Expand Down Expand Up @@ -556,6 +563,11 @@ class OMR_EXTENSIBLE Node
* Return true if the node is a call with potentialOSRPointHelperSymbol
*/
bool isPotentialOSRPointHelperCall();
/**
* \brief
* Return true if the node is a call with eaEscapeHelperSymbol
*/
bool isEAEscapeHelperCall();

// A common query used by the optimizer
inline bool isSingleRef();
Expand Down
7 changes: 3 additions & 4 deletions compiler/ras/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1651,10 +1651,8 @@ TR_Debug::getName(TR::SymbolReference * symRef)
return "<potentialOSRPointHelper>";
case TR::SymbolReferenceTable::osrFearPointHelperSymbol:
return "<osrFearPointHelper>";
case TR::SymbolReferenceTable::jProfileValueSymbol:
return "<jProfileValuePlaceHolder>";
case TR::SymbolReferenceTable::jProfileValueWithNullCHKSymbol:
return "<jProfileValueWithNullCHKPlaceHolder>";
case TR::SymbolReferenceTable::eaEscapeHelperSymbol:
return "<eaEscapeHelper>";
}
}

Expand Down Expand Up @@ -2084,6 +2082,7 @@ static const char *commonNonhelperSymbolNames[] =
"<osrReturnAddress>",
"<potentialOSRPointHelper>",
"<osrFearPointHelper>",
"<eaEscapeHelper>",
"<lowTenureAddress>",
"<highTenureAddress>",
"<fragmentParent>",
Expand Down