Skip to content

Commit

Permalink
Add dataAddr field shadow symbol reference
Browse files Browse the repository at this point in the history
Signed-off-by: Shubham Verma <[email protected]>
  • Loading branch information
VermaSh committed Jan 19, 2024
1 parent 3a47874 commit afc06e0
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 1 deletion.
21 changes: 21 additions & 0 deletions compiler/compile/OMRSymbolReferenceTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,26 @@ OMR::SymbolReferenceTable::findOrCreateContiguousArraySizeSymbolRef()
return element(contiguousArraySizeSymbol);
}

#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
TR::SymbolReference *
OMR::SymbolReferenceTable::findOrCreateContiguousArrayDataAddrFieldShadowSymRef()
{
if (!element(contiguousArrayDataAddrFieldSymbol))
{
TR::Symbol * sym = TR::Symbol::createShadow(trHeapMemory(), TR::Address);
sym->setContiguousArrayDataAddrFieldSymbol();
element(contiguousArrayDataAddrFieldSymbol) = new (trHeapMemory()) TR::SymbolReference(self(), contiguousArrayDataAddrFieldSymbol, sym);
element(contiguousArrayDataAddrFieldSymbol)->setOffset(TR::Compiler->om.offsetOfContiguousDataAddrField());
}
return element(contiguousArrayDataAddrFieldSymbol);
}
#endif // defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)

TR::SymbolReference *
OMR::SymbolReferenceTable::findContiguousArrayDataAddrFieldShadowSymRef()
{
return element(contiguousArrayDataAddrFieldSymbol);
}

TR::SymbolReference *
OMR::SymbolReferenceTable::findOrCreateVftSymbolRef()
Expand Down Expand Up @@ -2152,6 +2172,7 @@ const char *OMR::SymbolReferenceTable::_commonNonHelperSymbolNames[] =
"<osrScratchBuffer>",
"<osrFrameIndex>",
"<osrReturnAddress>",
"<contiguousArrayDataAddrField>",
"<potentialOSRPointHelper>",
"<osrFearPointHelper>",
"<eaEscapeHelper>",
Expand Down
5 changes: 5 additions & 0 deletions compiler/compile/OMRSymbolReferenceTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ class SymbolReferenceTable
osrScratchBufferSymbol, //osrScratchBuffer slot on j9vmthread
osrFrameIndexSymbol, // osrFrameIndex slot on j9vmthread
osrReturnAddressSymbol, // osrFrameIndex slot on j9vmthread
contiguousArrayDataAddrFieldSymbol, // dataAddr field symbol used to track data portion of the array

/** \brief
*
Expand Down Expand Up @@ -803,6 +804,10 @@ class SymbolReferenceTable
TR::SymbolReference * findOrCreateTemporaryWithKnowObjectIndex(TR::ResolvedMethodSymbol * owningMethodSymbol, TR::KnownObjectTable::Index knownObjectIndex);
TR::SymbolReference * findOrCreateThisRangeExtensionSymRef(TR::ResolvedMethodSymbol *owningMethodSymbol = 0);
TR::SymbolReference * findOrCreateContiguousArraySizeSymbolRef();
#if defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
TR::SymbolReference * findOrCreateContiguousArrayDataAddrFieldShadowSymRef();
#endif // defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION)
TR::SymbolReference * findContiguousArrayDataAddrFieldShadowSymRef();
TR::SymbolReference * findOrCreateNewArrayNoZeroInitSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
TR::SymbolReference * findOrCreateNewObjectSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
TR::SymbolReference * findOrCreateNewObjectNoZeroInitSymbolRef(TR::ResolvedMethodSymbol * owningMethodSymbol);
Expand Down
8 changes: 8 additions & 0 deletions compiler/il/OMRNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5898,6 +5898,14 @@ OMR::Node::setIsInternalPointer(bool v)
_flags.set(internalPointer, v);
}

bool
OMR::Node::isDataAddrPointer()
{
return self()->getOpCodeValue() == TR::aloadi
&& self()->getOpCode().hasSymbolReference()
&& self()->getSymbolReference() == TR::comp()->getSymRefTab()->findContiguousArrayDataAddrFieldShadowSymRef();
}

bool
OMR::Node::isArrayTRT()
{
Expand Down
3 changes: 3 additions & 0 deletions compiler/il/OMRNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,9 @@ class OMR_EXTENSIBLE Node
bool isInternalPointer();
void setIsInternalPointer(bool v);

// Flag used by TR::aloadi
bool isDataAddrPointer();

// Flags used by TR::arraytranslate and TR::arraytranslateAndTest
bool isArrayTRT();
void setArrayTRT(bool v);
Expand Down
5 changes: 4 additions & 1 deletion compiler/il/OMRSymbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ class OMR_EXTENSIBLE Symbol
inline void setArrayShadowSymbol();
inline bool isArrayShadowSymbol();

inline void setContiguousArrayDataAddrFieldSymbol();
inline bool isContiguousArrayDataAddrFieldSymbol();

inline bool isRecognizedShadow();

inline bool isRecognizedKnownObjectShadow();
Expand Down Expand Up @@ -515,7 +518,7 @@ class OMR_EXTENSIBLE Symbol
///< to behave as regular locals to
///< preserve floating point semantics
PinningArrayPointer = 0x10000000,
// Available = 0x00020000,
contiguousArrayDataAddrField = 0x00020000,
AutoAddressTaken = 0x04000000, ///< a loadaddr of this auto exists
SpillTempLoaded = 0x04000000, ///< share bit with loadaddr because spill temps will never have their address taken. Used to remove store to spill if never loaded
// Available = 0x02000000,
Expand Down
13 changes: 13 additions & 0 deletions compiler/il/OMRSymbol_inlines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,19 @@ OMR::Symbol::isArrayShadowSymbol()
return self()->isShadow() && _flags.testAny(ArrayShadow);
}


void
OMR::Symbol::setContiguousArrayDataAddrFieldSymbol()
{
_flags.set(contiguousArrayDataAddrField);
}

bool
OMR::Symbol::isContiguousArrayDataAddrFieldSymbol()
{
return _flags.testAny(contiguousArrayDataAddrField);
}

bool
OMR::Symbol::isRecognizedShadow()
{
Expand Down
3 changes: 3 additions & 0 deletions compiler/ras/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,8 @@ TR_Debug::getName(TR::SymbolReference * symRef)
return "<storeFlattenableArrayElementNonHelper>";
case TR::SymbolReferenceTable::J9JNIMethodIDvTableIndexFieldSymbol:
return "<J9JNIMethodIDvTableIndexFieldSymbol>";
case TR::SymbolReferenceTable::contiguousArrayDataAddrFieldSymbol:
return "<contiguousArrayDataAddrFieldSymbol>";
case TR::SymbolReferenceTable::defaultValueSymbol:
return "<defaultValue>";
case TR::SymbolReferenceTable::jitDispatchJ9MethodSymbol:
Expand Down Expand Up @@ -2111,6 +2113,7 @@ static const char *commonNonhelperSymbolNames[] =
"<osrScratchBuffer>",
"<osrFrameIndex>",
"<osrReturnAddress>",
"<contiguousArrayDataAddrField>",
"<potentialOSRPointHelper>",
"<osrFearPointHelper>",
"<eaEscapeHelper>",
Expand Down

0 comments on commit afc06e0

Please sign in to comment.