Skip to content

Commit

Permalink
Merge pull request #7205 from jdmpapin/remove-removed-guards
Browse files Browse the repository at this point in the history
Delete now-unnecessary TR_Removed*Guard guard kinds
  • Loading branch information
dsouzai authored Dec 27, 2023
2 parents 2067ba1 + e183807 commit 787725a
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 85 deletions.
56 changes: 0 additions & 56 deletions compiler/codegen/OMRAheadOfTimeCompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 0 additions & 2 deletions compiler/codegen/OMRCodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion compiler/codegen/OMRCodeGenerator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
3 changes: 0 additions & 3 deletions compiler/compile/VirtualGuard.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions compiler/optimizer/LocalOpts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions compiler/optimizer/LoopVersioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 0 additions & 6 deletions compiler/optimizer/OMROptimization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
9 changes: 0 additions & 9 deletions compiler/optimizer/VPHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 787725a

Please sign in to comment.