Skip to content

Commit

Permalink
Merge pull request #7669 from a7ehuo/debug-print-TR_YesNoMaybe
Browse files Browse the repository at this point in the history
Add utility method to print TR_YesNoMaybe
  • Loading branch information
hzongaro authored Feb 24, 2025
2 parents 74118d3 + 7b0c603 commit 48451f6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion compiler/optimizer/OMRValuePropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7620,7 +7620,7 @@ void OMR::ValuePropagation::doDelayedTransformations()
callUnreachable = false;

if (trace())
traceMsg(comp(), "typeCompatibleStatus [%p] %d\n", guardNode, typeCompatibleStatus);
traceMsg(comp(), "typeCompatibleStatus [%p] %s\n", guardNode, comp()->getDebug()->getName(typeCompatibleStatus));
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizer/TrivialDeadBlockRemover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ TR_YesNoMaybe TR_TrivialDeadBlockRemover::evaluateTakeBranch (TR::Node* ifNode)

if (trace())
traceMsg(comp(), "ifNode %p folded using a decision table,"
"row %d col %d value %d\n", ifNode, row, col, decisionTable[row][col]);
"row %d col %d value %s\n", ifNode, row, col, comp()->getDebug()->getName(decisionTable[row][col]));

return decisionTable[row][col];
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/optimizer/VPHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3494,8 +3494,7 @@ TR::Node *constrainThrow(OMR::ValuePropagation *vp, TR::Node *node)

if (debug("traceThrowToGoto"))
printf("\n\n catch type %s %.*s\n",
(willCatch == TR_yes ? "yes" : (willCatch == TR_no ? "no" : "maybe")),
catchBlock->getExceptionClassNameLength(), catchBlock->getExceptionClassNameChars());
vp->comp()->getDebug()->getName(willCatch), catchBlock->getExceptionClassNameLength(), catchBlock->getExceptionClassNameChars());
}
else if (debug("traceThrowToGoto"))
printf("\n\n catch type maybe unresolved class\n");
Expand Down
5 changes: 3 additions & 2 deletions compiler/optimizer/ValuePropagationCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1419,8 +1419,9 @@ void OMR::ValuePropagation::transformArrayCopyCall(TR::Node *node)
}

if (trace())
traceMsg(comp(), "%s: n%dn %p transformTheCall %d isSrcArrayNullRestricted %d isDstArrayNullRestricted %d doRuntimeNullRestrictedTest %d\n", __FUNCTION__,
node->getGlobalIndex(), node, transformTheCall, isSrcArrayNullRestricted, isDstArrayNullRestricted, doRuntimeNullRestrictedTest);
traceMsg(comp(), "%s: n%dn %p transformTheCall %d isSrcArrayNullRestricted %s isDstArrayNullRestricted %s doRuntimeNullRestrictedTest %d\n", __FUNCTION__,
node->getGlobalIndex(), node, transformTheCall, comp()->getDebug()->getName(isSrcArrayNullRestricted),
comp()->getDebug()->getName(isDstArrayNullRestricted), doRuntimeNullRestrictedTest);
}
#else
bool isStringCompressedArrayCopy = false;
Expand Down
6 changes: 6 additions & 0 deletions compiler/ras/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,12 @@ TR_Debug::print(TR::LabelSymbol * labelSymbol, TR_PrettyPrinterString& output)
output.appendf( "%s", getName(labelSymbol));
}

const char *
TR_Debug::getName(TR_YesNoMaybe value)
{
return (value == TR_yes) ? "TR_yes" : ((value == TR_no) ? "TR_no" : "TR_maybe");
}

const char *
TR_Debug::getName(void * address, const char * prefix, uint32_t nextNumber, bool enumerate)
{
Expand Down
1 change: 1 addition & 0 deletions compiler/ras/Debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ class TR_Debug
virtual const char * getName(void *, const char *, uint32_t, bool);
virtual const char * getName(const char *s) { return s; }
virtual const char * getName(const char *s, int32_t len) { return s; }
virtual const char * getName(TR_YesNoMaybe value);
virtual const char * getVSSName(TR::AutomaticSymbol *sym);
virtual const char * getWriteBarrierKindName(int32_t);
virtual const char * getSpillKindName(uint8_t);
Expand Down

0 comments on commit 48451f6

Please sign in to comment.