From 81b562d6cf5b353e19440780a602b878451c0049 Mon Sep 17 00:00:00 2001 From: Abdulrahman Alattas Date: Tue, 26 Nov 2024 13:30:02 -0500 Subject: [PATCH 1/2] Insert OffHeap dataAddr load for invariant initialization tree Signed-off-by: Abdulrahman Alattas --- compiler/optimizer/InductionVariable.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/compiler/optimizer/InductionVariable.cpp b/compiler/optimizer/InductionVariable.cpp index 5ce2a73ccba..ce7c48bc7c6 100644 --- a/compiler/optimizer/InductionVariable.cpp +++ b/compiler/optimizer/InductionVariable.cpp @@ -983,7 +983,12 @@ int32_t TR_LoopStrider::detectCanonicalizedPredictableLoops(TR_Structure *loopSt { TR::Node *constantNode = TR::Node::create(byteCodeInfoNode, TR::lconst); constantNode->setLongInt((int64_t)index); - arrayRefNode = TR::Node::create(TR::aladd, 2, TR::Node::createWithSymRef(byteCodeInfoNode, TR::aload, 0, origAuto), constantNode); + arrayRefNode = TR::Node::createWithSymRef(byteCodeInfoNode, TR::aload, 0, origAuto); +#if defined(OMR_GC_SPARSE_HEAP_ALLOCATION) + if (TR::Compiler->om.isOffHeapAllocationEnabled()) + arrayRefNode = TR::TransformUtil::generateDataAddrLoadTrees(comp(), arrayRefNode); +#endif /* OMR_GC_SPARSE_HEAP_ALLOCATION */ + arrayRefNode = TR::Node::create(TR::aladd, 2, arrayRefNode, constantNode); } else arrayRefNode = TR::Node::create(TR::aiadd, 2, TR::Node::createWithSymRef(byteCodeInfoNode, TR::aload, 0, origAuto), TR::Node::create(byteCodeInfoNode, TR::iconst, 0, index)); @@ -992,7 +997,14 @@ int32_t TR_LoopStrider::detectCanonicalizedPredictableLoops(TR_Structure *loopSt { TR::SymbolReference *indexSymRef = symRefPair->_indexSymRef; if (usingAladd) - arrayRefNode = TR::Node::create(TR::aladd, 2, TR::Node::createWithSymRef(byteCodeInfoNode, TR::aload, 0, origAuto), TR::Node::createWithSymRef(byteCodeInfoNode, TR::lload, 0, indexSymRef)); + { + arrayRefNode = TR::Node::createWithSymRef(byteCodeInfoNode, TR::aload, 0, origAuto); +#if defined(OMR_GC_SPARSE_HEAP_ALLOCATION) + if (TR::Compiler->om.isOffHeapAllocationEnabled()) + arrayRefNode = TR::TransformUtil::generateDataAddrLoadTrees(comp(), arrayRefNode); +#endif /* OMR_GC_SPARSE_HEAP_ALLOCATION */ + arrayRefNode = TR::Node::create(TR::aladd, 2, arrayRefNode, TR::Node::createWithSymRef(byteCodeInfoNode, TR::lload, 0, indexSymRef)); + } else arrayRefNode = TR::Node::create(TR::aiadd, 2, TR::Node::createWithSymRef(byteCodeInfoNode, TR::aload, 0, origAuto), TR::Node::createWithSymRef(byteCodeInfoNode, TR::iload, 0, indexSymRef)); } From c7f89a0e96106fbd52a9c65b640d2d923cac9386 Mon Sep 17 00:00:00 2001 From: Abdulrahman Alattas Date: Tue, 3 Dec 2024 15:17:44 -0500 Subject: [PATCH 2/2] Disable storing dataAddr in temps Given issues when storing dataAddrPtr in temps and the dual purpose of using that as the destination address (correct) and destination object (incorrect) from some evaluators, the store of dataAddrPtr in temps is disabled until its fixed (Issue: OMR #7560) Signed-off-by: Abdulrahman Alattas --- compiler/optimizer/InductionVariable.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/optimizer/InductionVariable.cpp b/compiler/optimizer/InductionVariable.cpp index ce7c48bc7c6..32da373efaf 100644 --- a/compiler/optimizer/InductionVariable.cpp +++ b/compiler/optimizer/InductionVariable.cpp @@ -3404,6 +3404,8 @@ bool TR_LoopStrider::reassociateAndHoistComputations(TR::Block *loopInvariantBlo index header_size/-header_size + OffHeap reassociation and hoisting is temporarily disabled + TODO enable storing dataAddrPtr in temps off-heap mode: aladd (internal pointer) contiguousArrayDataAddrFieldSymbol (dataAddrPointer, internal pointer) @@ -3462,6 +3464,7 @@ bool TR_LoopStrider::reassociateAndHoistComputations(TR::Block *loopInvariantBlo //node->getSymbolReference()->getSymbol()->isAuto() && node->getSymbolReference()->getSymbol()->isAutoOrParm() && _neverWritten->get(node->getSymbolReference()->getReferenceNumber()))) && + !originalNode->getFirstChild()->isDataAddrPointer() && // TODO enable storing dataAddrPtr in temps (!_registersScarce || (originalNode->getReferenceCount() > 1)) && (comp()->getSymRefTab()->getNumInternalPointers() < maxInternalPointers()) && (!comp()->cg()->canBeAffectedByStoreTagStalls() || @@ -3672,7 +3675,8 @@ bool TR_LoopStrider::reassociateAndHoistComputations(TR::Block *loopInvariantBlo * If first child of originalNode is not dataAddr pointer we have already * hoisted the array aload, no need to do it again. */ - if (TR::Compiler->om.isOffHeapAllocationEnabled() && originalNode && originalNode->getFirstChild()->isDataAddrPointer()) + if (false && // TODO enable storing dataAddrPtr in temps + TR::Compiler->om.isOffHeapAllocationEnabled() && originalNode && originalNode->getFirstChild()->isDataAddrPointer()) { if ((isInternalPointer && (comp()->getSymRefTab()->getNumInternalPointers() < maxInternalPointers())) &&