Skip to content

Commit

Permalink
Define nonNullableArrayNullStoreCheck non-helper symbol
Browse files Browse the repository at this point in the history
Downstream projects might define classes that do not permit null
references.  This change defines a non-helper symbol that takes an array
reference and a value reference as arguments.  A downstream project can
use this as a placeholder for a check of whether  the component type of
an array is a class that does not permit null references, and if so,
whether the value that is being assigned to an element of the array is
a null reference.

Signed-off-by:  Henry Zongaro <zongaro@ca.ibm.com>
  • Loading branch information
hzongaro committed Aug 23, 2021
1 parent ab70342 commit 0175216
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
16 changes: 16 additions & 0 deletions compiler/compile/OMRNonHelperSymbols.enum
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,22 @@
*/
objectEqualityComparisonSymbol,

/**
* \brief Tests, in some consumer-specific way, whether the array operand has a component type that
* is a non-nullable class, and if so, performs a NULLCHK on the value that needs to be assigned to
* an element of the array
*
* \code
* call <nonNullableArrayNullStoreCheck>
* value-reference-to-be-stored
* array-reference-to-which-value-will-be-stored
* \endcode
*
* \note A call to this symbol is not to be evaluated by code generation; some optimization pass prior to
* code generation should transform it to more primitive operations.
*/
nonNullableArrayNullStoreCheckSymbol,

/** \brief
*
* This symbol is used by the code generator to recognize and inline a call which emulates the following
Expand Down
13 changes: 13 additions & 0 deletions compiler/compile/OMRSymbolReferenceTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,19 @@ class SymbolReferenceTable
*/
objectEqualityComparisonSymbol,

/**
* \brief Tests, in some consumer-specific way, whether the array operand has a component type that
* is a non-nullable class, and if so, performs a NULLCHK on the value that needs to be assigned to
* an element of the array
*
* \code
* call <nonNullableArrayNullStoreCheck>
* value-reference-to-be-stored
* array-reference-to-which-value-will-be-stored
* \endcode
*/
nonNullableArrayNullStoreCheckSymbol,

/** \brief
*
* This symbol is used by the code generator to recognize and inline a call which emulates the following
Expand Down
7 changes: 6 additions & 1 deletion compiler/il/Aliases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ OMR::SymbolReference::getUseonlyAliasesBV(TR::SymbolReferenceTable * symRefTab)
{
return &symRefTab->aliasBuilder.defaultMethodUseAliases();
}
if (symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::nonNullableArrayNullStoreCheckSymbol))
{
return &symRefTab->aliasBuilder.defaultMethodUseAliases();
}

if (!methodSymbol->isHelper())
{
Expand Down Expand Up @@ -329,7 +333,8 @@ OMR::SymbolReference::getUseDefAliasesBV(bool isDirectCall, bool includeGCSafePo
symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::osrFearPointHelperSymbol) ||
symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::potentialOSRPointHelperSymbol) ||
symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::eaEscapeHelperSymbol) ||
symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::objectEqualityComparisonSymbol))
symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::objectEqualityComparisonSymbol) ||
symRefTab->isNonHelper(self(), TR::SymbolReferenceTable::nonNullableArrayNullStoreCheckSymbol))
{
return &symRefTab->aliasBuilder.defaultMethodDefAliases();
}
Expand Down
3 changes: 3 additions & 0 deletions compiler/ras/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1656,6 +1656,8 @@ TR_Debug::getName(TR::SymbolReference * symRef)
return "<j9VMThreadFloatTemp1Symbol>";
case TR::SymbolReferenceTable::objectEqualityComparisonSymbol:
return "<objectEqualityComparison>";
case TR::SymbolReferenceTable::nonNullableArrayNullStoreCheckSymbol:
return "<nonNullableArrayNullStoreCheck>";
case TR::SymbolReferenceTable::J9JNIMethodIDvTableIndexFieldSymbol:
return "<J9JNIMethodIDvTableIndexFieldSymbol>";
}
Expand Down Expand Up @@ -2104,6 +2106,7 @@ static const char *commonNonhelperSymbolNames[] =
"<startPCLinkageInfo>",
"<instanceShapeFromROMClass>",
"<objectEqualityComparison>",
"<nonNullableArrayNullStoreCheck>",
"<synchronizedFieldLoad>",
"<atomicAdd>",
"<atomicFetchAndAdd>",
Expand Down

0 comments on commit 0175216

Please sign in to comment.