From 5fb24f31bb2a37a37779f6dc0d9d76b8c8273c8c Mon Sep 17 00:00:00 2001 From: Shubham Verma Date: Sun, 14 May 2023 13:15:22 +0530 Subject: [PATCH] Add dataAddr field shadow symbol reference Signed-off-by: Shubham Verma --- compiler/compile/OMRSymbolReferenceTable.cpp | 21 ++++++++++++++++++++ compiler/compile/OMRSymbolReferenceTable.hpp | 5 +++++ compiler/il/OMRNode.cpp | 8 ++++++++ compiler/il/OMRNode.hpp | 3 +++ compiler/il/OMRSymbol.hpp | 5 ++++- compiler/il/OMRSymbol_inlines.hpp | 13 ++++++++++++ compiler/ras/Debug.cpp | 3 +++ 7 files changed, 57 insertions(+), 1 deletion(-) diff --git a/compiler/compile/OMRSymbolReferenceTable.cpp b/compiler/compile/OMRSymbolReferenceTable.cpp index d0f6234594f..0e599b26479 100644 --- a/compiler/compile/OMRSymbolReferenceTable.cpp +++ b/compiler/compile/OMRSymbolReferenceTable.cpp @@ -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() @@ -2151,6 +2171,7 @@ const char *OMR::SymbolReferenceTable::_commonNonHelperSymbolNames[] = "", "", "", + "", "", "", "", diff --git a/compiler/compile/OMRSymbolReferenceTable.hpp b/compiler/compile/OMRSymbolReferenceTable.hpp index dfdb713607d..231eed1b40b 100644 --- a/compiler/compile/OMRSymbolReferenceTable.hpp +++ b/compiler/compile/OMRSymbolReferenceTable.hpp @@ -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 * @@ -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); diff --git a/compiler/il/OMRNode.cpp b/compiler/il/OMRNode.cpp index ac151cfcc47..eedab756b1d 100644 --- a/compiler/il/OMRNode.cpp +++ b/compiler/il/OMRNode.cpp @@ -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() { diff --git a/compiler/il/OMRNode.hpp b/compiler/il/OMRNode.hpp index acc0108c1b9..8277d906413 100644 --- a/compiler/il/OMRNode.hpp +++ b/compiler/il/OMRNode.hpp @@ -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); diff --git a/compiler/il/OMRSymbol.hpp b/compiler/il/OMRSymbol.hpp index 6f24e5d3cba..1733e0dcd11 100644 --- a/compiler/il/OMRSymbol.hpp +++ b/compiler/il/OMRSymbol.hpp @@ -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(); @@ -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, diff --git a/compiler/il/OMRSymbol_inlines.hpp b/compiler/il/OMRSymbol_inlines.hpp index 0a5114188ce..5ff98c60517 100644 --- a/compiler/il/OMRSymbol_inlines.hpp +++ b/compiler/il/OMRSymbol_inlines.hpp @@ -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() { diff --git a/compiler/ras/Debug.cpp b/compiler/ras/Debug.cpp index 891be089d15..8b895e0ffb4 100644 --- a/compiler/ras/Debug.cpp +++ b/compiler/ras/Debug.cpp @@ -1667,6 +1667,8 @@ TR_Debug::getName(TR::SymbolReference * symRef) return ""; case TR::SymbolReferenceTable::J9JNIMethodIDvTableIndexFieldSymbol: return ""; + case TR::SymbolReferenceTable::contiguousArrayDataAddrFieldSymbol: + return ""; case TR::SymbolReferenceTable::defaultValueSymbol: return ""; case TR::SymbolReferenceTable::jitDispatchJ9MethodSymbol: @@ -2111,6 +2113,7 @@ static const char *commonNonhelperSymbolNames[] = "", "", "", + "", "", "", "",