From e183807923d8e0dc98e1b203ae18312e67fd4d61 Mon Sep 17 00:00:00 2001 From: Devin Papineau Date: Fri, 8 Dec 2023 12:18:34 -0500 Subject: [PATCH] Delete now-unnecessary TR_Removed*Guard guard kinds AOT now takes care of generating the TR_Inlined*Method relocations for inlined methods without corresponding guards, so we can remove guards without creating stand-ins. --- compiler/codegen/OMRAheadOfTimeCompile.cpp | 56 ---------------------- compiler/codegen/OMRCodeGenerator.cpp | 2 - compiler/codegen/OMRCodeGenerator.hpp | 1 - compiler/compile/VirtualGuard.hpp | 3 -- compiler/optimizer/LocalOpts.cpp | 5 -- compiler/optimizer/LoopVersioner.cpp | 3 -- compiler/optimizer/OMROptimization.cpp | 6 --- compiler/optimizer/VPHandlers.cpp | 9 ---- 8 files changed, 85 deletions(-) diff --git a/compiler/codegen/OMRAheadOfTimeCompile.cpp b/compiler/codegen/OMRAheadOfTimeCompile.cpp index 867ced61f85..ba21564aa3b 100644 --- a/compiler/codegen/OMRAheadOfTimeCompile.cpp +++ b/compiler/codegen/OMRAheadOfTimeCompile.cpp @@ -114,59 +114,3 @@ void OMR::AheadOfTimeCompile::traceRelocationOffsets(uint8_t *&cursor, int32_t o cursor += offsetSize; } } - -void createGuardSiteForRemovedGuard(TR::Compilation *comp, TR::Node *ifNode) - { -#ifdef J9_PROJECT_SPECIFIC - if (comp->cg()->needGuardSitesEvenWhenGuardRemoved() && ifNode->isTheVirtualGuardForAGuardedInlinedCall()) - { - TR_VirtualGuard *virtualGuard = comp->findVirtualGuardInfo(ifNode); - - if (virtualGuard->getKind() == TR_HCRGuard) - { - if (comp->getOption(TR_TraceRelocatableDataCG)) - traceMsg(comp, "createGuardSiteForRemovedGuard: removing HCRGuard, no need to add AOTNOPsite, node %p\n", ifNode); - return; - } - - if (virtualGuard->getKind() == TR_BreakpointGuard) - { - if (comp->getOption(TR_TraceRelocatableDataCG)) - traceMsg(comp, "createGuardSiteForRemovedGuard: removing BreakpointGuard, no need to add AOTNOPsite, node %p\n", ifNode); - return; - } - - TR_VirtualGuardKind removedGuardKind; - switch (virtualGuard->getKind()) - { - case TR_ProfiledGuard: - removedGuardKind = TR_RemovedProfiledGuard; - TR_ASSERT(ifNode->isProfiledGuard(), "guard for profiled guard has unexpected kind"); - break; - case TR_InterfaceGuard: - removedGuardKind = TR_RemovedInterfaceGuard; - TR_ASSERT(ifNode->isInterfaceGuard(), "guard for interface guard has unexpected kind"); - break; - case TR_NonoverriddenGuard: - case TR_DirectMethodGuard: - removedGuardKind = TR_RemovedNonoverriddenGuard; - TR_ASSERT(ifNode->isNonoverriddenGuard(), "guard for nonoverridden guard has unexpected kind"); - break; - default: - TR_ASSERT(false, "removed virtual guard type %d on node %p not supported yet.", virtualGuard->getKind(), ifNode); - break; - }; - - TR_AOTGuardSite *site = comp->addAOTNOPSite(); - site->setLocation(NULL); - site->setType(removedGuardKind); - site->setGuard(virtualGuard); - site->setNode(NULL); - - if (comp->getOption(TR_TraceAll)) - traceMsg(comp, "createGuardSiteForRemovedGuard: removedGuardKind %d, removedGurad %p, _callNode %p, _guardNode %p, _thisClass %p, _calleeIndex %d, _byteCodeIndex %d, addedAOTNopSite %p\n", - removedGuardKind, virtualGuard, virtualGuard->getCallNode(), virtualGuard->getGuardNode(), virtualGuard->getThisClass(), - virtualGuard->getCalleeIndex(), virtualGuard->getByteCodeIndex(), site); - } -#endif - } diff --git a/compiler/codegen/OMRCodeGenerator.cpp b/compiler/codegen/OMRCodeGenerator.cpp index 7a591f6842c..b2739b44e15 100644 --- a/compiler/codegen/OMRCodeGenerator.cpp +++ b/compiler/codegen/OMRCodeGenerator.cpp @@ -1235,8 +1235,6 @@ OMR::CodeGenerator::getBlocksWithCalls() bool OMR::CodeGenerator::profiledPointersRequireRelocation() { return self()->comp()->compileRelocatableCode(); } -bool OMR::CodeGenerator::needGuardSitesEvenWhenGuardRemoved() { return self()->comp()->compileRelocatableCode(); } - bool OMR::CodeGenerator::supportsInternalPointers() { if (_disableInternalPointers) diff --git a/compiler/codegen/OMRCodeGenerator.hpp b/compiler/codegen/OMRCodeGenerator.hpp index 888e002995e..76215cf9333 100644 --- a/compiler/codegen/OMRCodeGenerator.hpp +++ b/compiler/codegen/OMRCodeGenerator.hpp @@ -1524,7 +1524,6 @@ class OMR_EXTENSIBLE CodeGenerator bool constantAddressesCanChangeSize(TR::Node *node); bool profiledPointersRequireRelocation(); - bool needGuardSitesEvenWhenGuardRemoved(); // will a BCD left shift always leave the sign code unchanged and thus allow it to be propagated through and upwards bool propagateSignThroughBCDLeftShift(TR::DataType type) { return false; } diff --git a/compiler/compile/VirtualGuard.hpp b/compiler/compile/VirtualGuard.hpp index 87c642444f6..90a9229e16a 100644 --- a/compiler/compile/VirtualGuard.hpp +++ b/compiler/compile/VirtualGuard.hpp @@ -43,13 +43,10 @@ enum TR_VirtualGuardKind { TR_NoGuard, TR_ProfiledGuard, - TR_RemovedProfiledGuard, TR_InterfaceGuard, - TR_RemovedInterfaceGuard, TR_AbstractGuard, TR_HierarchyGuard, TR_NonoverriddenGuard, - TR_RemovedNonoverriddenGuard, TR_SideEffectGuard, TR_DummyGuard, TR_HCRGuard, diff --git a/compiler/optimizer/LocalOpts.cpp b/compiler/optimizer/LocalOpts.cpp index 635142c21f5..d48f1f4ac91 100644 --- a/compiler/optimizer/LocalOpts.cpp +++ b/compiler/optimizer/LocalOpts.cpp @@ -111,8 +111,6 @@ #include "runtime/RuntimeAssumptions.hpp" #endif -extern void createGuardSiteForRemovedGuard(TR::Compilation *comp, TR::Node* ifNode); - // basic blocks peephole optimization. // Return "true" if any basic block peephole optimization was done @@ -3086,9 +3084,6 @@ int32_t TR_SimplifyAnds::process(TR::TreeTop *startTree, TR::TreeTop *endTree) TR::TreeTop *previousTree = block->getLastRealTreeTop()->getPrevTreeTop(); TR::CFGEdge* currentSucc = block->getSuccessors().front(); TR::CFGNode *succBlock = currentSucc->getTo(); -#ifdef J9_PROJECT_SPECIFIC - createGuardSiteForRemovedGuard(comp(), lastRealNode); -#endif if (newOrOpcode != TR::BadILOp) { // Modify first ificmpeq diff --git a/compiler/optimizer/LoopVersioner.cpp b/compiler/optimizer/LoopVersioner.cpp index 4fd3b8546c5..5b52f30ed31 100644 --- a/compiler/optimizer/LoopVersioner.cpp +++ b/compiler/optimizer/LoopVersioner.cpp @@ -9308,9 +9308,6 @@ bool TR_LoopVersioner::guardOkForExpr(TR::Node *node, bool onlySearching) case TR_MethodEnterExitGuard: case TR_InnerGuard: case TR_ArrayStoreCheckGuard: - case TR_RemovedProfiledGuard: - case TR_RemovedNonoverriddenGuard: - case TR_RemovedInterfaceGuard: return false; default: diff --git a/compiler/optimizer/OMROptimization.cpp b/compiler/optimizer/OMROptimization.cpp index 7c95ddf37e7..cb81975a2ca 100644 --- a/compiler/optimizer/OMROptimization.cpp +++ b/compiler/optimizer/OMROptimization.cpp @@ -276,7 +276,6 @@ OMR::Optimization::anchorNode(TR::Node *node, TR::TreeTop* anchorTree) } } -extern void createGuardSiteForRemovedGuard(TR::Compilation *comp, TR::Node* ifNode); /** * Folds a given if in IL. This method does NOT update CFG * The callers should handle any updates to CFG or call @@ -290,11 +289,6 @@ OMR::Optimization::removeOrconvertIfToGoto(TR::Node* &node, TR::Block* block, in // In either case the CFG must be updated to reflect the change. // -#ifdef J9_PROJECT_SPECIFIC - // doesn't matter taken or untaken, if it's a profiled guard we need to make sure the AOT relocation is created - createGuardSiteForRemovedGuard(self()->comp(), node); -#endif - node->setVirtualGuardInfo(NULL, self()->comp()); if (takeBranch) diff --git a/compiler/optimizer/VPHandlers.cpp b/compiler/optimizer/VPHandlers.cpp index 19d93cfa512..c0b747de185 100644 --- a/compiler/optimizer/VPHandlers.cpp +++ b/compiler/optimizer/VPHandlers.cpp @@ -92,7 +92,6 @@ extern TR::Node *constrainChildren(OMR::ValuePropagation *vp, TR::Node *node); extern TR::Node *constrainVcall(OMR::ValuePropagation *vp, TR::Node *node); -extern void createGuardSiteForRemovedGuard(TR::Compilation *comp, TR::Node* ifNode); static void checkForNonNegativeAndOverflowProperties(OMR::ValuePropagation *vp, TR::Node *node, TR::VPConstraint *constraint = NULL) { @@ -8989,10 +8988,6 @@ static void generateModifiedNopGuard( static void changeConditionalToGoto(OMR::ValuePropagation *vp, TR::Node *node, TR::CFGEdge *branchEdge) { -#ifdef J9_PROJECT_SPECIFIC - createGuardSiteForRemovedGuard(vp->comp(), node); -#endif - // NOTE: No special handling is required here to deal with the possibility // that node is a virtual guard that has been merged with an HCR or an OSR // guard. It's always safe to go to the taken (cold) side. @@ -9022,10 +9017,6 @@ static void changeConditionalToGoto(OMR::ValuePropagation *vp, TR::Node *node, T static void removeConditionalBranch(OMR::ValuePropagation *vp, TR::Node *node, TR::CFGEdge *branchEdge) { -#ifdef J9_PROJECT_SPECIFIC - createGuardSiteForRemovedGuard(vp->comp(), node); -#endif - // If node is a virtual guard merged with an HCR or an OSR guard, then it // will still be possible to go to the cold side. In that case, node will // still be removed, but an HCR or OSR guard will be added in its place, so