Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display names of handles in dumps #97573

Merged
merged 3 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,12 +856,13 @@ void Compiler::optPrintAssertion(AssertionDsc* curAssertion, AssertionIndex asse
case O2K_IND_CNS_INT:
if (curAssertion->op1.kind == O1K_EXACT_TYPE)
{
printf("Exact Type MT(%08X)", dspPtr(curAssertion->op2.u1.iconVal));
assert(curAssertion->op2.HasIconFlag());
ssize_t iconVal = curAssertion->op2.u1.iconVal;
printf("Exact Type MT(0x%p %s)", dspPtr(iconVal), eeGetClassName((CORINFO_CLASS_HANDLE)iconVal));
}
else if (curAssertion->op1.kind == O1K_SUBTYPE)
{
printf("MT(%08X)", dspPtr(curAssertion->op2.u1.iconVal));
ssize_t iconVal = curAssertion->op2.u1.iconVal;
printf("MT(0x%p %s)", dspPtr(iconVal), eeGetClassName((CORINFO_CLASS_HANDLE)iconVal));
assert(curAssertion->op2.HasIconFlag());
}
else if ((curAssertion->op1.kind == O1K_BOUND_OPER_BND) ||
Expand Down
16 changes: 8 additions & 8 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12031,12 +12031,12 @@ void Compiler::gtDispConst(GenTree* tree)
}
else
{
ssize_t dspIconVal =
tree->IsIconHandle() ? dspPtr(tree->AsIntCon()->gtIconVal) : tree->AsIntCon()->gtIconVal;
ssize_t iconVal = tree->AsIntCon()->gtIconVal;
ssize_t dspIconVal = tree->IsIconHandle() ? dspPtr(iconVal) : iconVal;

if (tree->TypeGet() == TYP_REF)
{
if (tree->AsIntCon()->gtIconVal == 0)
if (iconVal == 0)
{
printf(" null");
}
Expand All @@ -12046,12 +12046,12 @@ void Compiler::gtDispConst(GenTree* tree)
printf(" 0x%llx", dspIconVal);
}
}
else if ((tree->AsIntCon()->gtIconVal > -1000) && (tree->AsIntCon()->gtIconVal < 1000))
else if ((iconVal > -1000) && (iconVal < 1000))
{
printf(" %ld", dspIconVal);
}
#ifdef TARGET_64BIT
else if ((tree->AsIntCon()->gtIconVal & 0xFFFFFFFF00000000LL) != 0)
else if ((iconVal & 0xFFFFFFFF00000000LL) != 0)
{
if (dspIconVal >= 0)
{
Expand Down Expand Up @@ -12083,13 +12083,13 @@ void Compiler::gtDispConst(GenTree* tree)
printf(" scope");
break;
case GTF_ICON_CLASS_HDL:
printf(" class");
printf(" class %s", eeGetClassName((CORINFO_CLASS_HANDLE)iconVal));
break;
case GTF_ICON_METHOD_HDL:
printf(" method");
printf(" method %s", eeGetMethodFullName((CORINFO_METHOD_HANDLE)iconVal));
break;
case GTF_ICON_FIELD_HDL:
printf(" field");
printf(" field %s", eeGetFieldName((CORINFO_FIELD_HANDLE)iconVal, true));
break;
case GTF_ICON_STATIC_HDL:
printf(" static");
Expand Down
14 changes: 14 additions & 0 deletions src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9006,6 +9006,20 @@ void ValueNumStore::vnDump(Compiler* comp, ValueNum vn, bool isPtr)
ssize_t val = ConstantValue<ssize_t>(vn);
const GenTreeFlags handleFlags = GetHandleFlags(vn);
printf("Hnd const: 0x%p %s", dspPtr(val), GenTree::gtGetHandleKindString(handleFlags));
switch (handleFlags & GTF_ICON_HDL_MASK)
{
case GTF_ICON_CLASS_HDL:
printf(" %s", comp->eeGetClassName((CORINFO_CLASS_HANDLE)val));
break;
case GTF_ICON_METHOD_HDL:
printf(" %s", comp->eeGetMethodFullName((CORINFO_METHOD_HANDLE)val));
break;
case GTF_ICON_FIELD_HDL:
printf(" %s", comp->eeGetFieldName((CORINFO_FIELD_HANDLE)val, true));
break;
default:
break;
}
}
else if (IsVNConstant(vn))
{
Expand Down
Loading