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

Fix handle dumping for AOT scenarios #98728

Merged
merged 1 commit into from
Feb 21, 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
19 changes: 17 additions & 2 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,12 +857,27 @@ void Compiler::optPrintAssertion(AssertionDsc* curAssertion, AssertionIndex asse
if (curAssertion->op1.kind == O1K_EXACT_TYPE)
{
ssize_t iconVal = curAssertion->op2.u1.iconVal;
printf("Exact Type MT(0x%p %s)", dspPtr(iconVal), eeGetClassName((CORINFO_CLASS_HANDLE)iconVal));
if (IsTargetAbi(CORINFO_NATIVEAOT_ABI) || opts.IsReadyToRun())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: IsReadyToRun is true for NAOT too, so IsTargetAbi(CORINFO_NATIVEAOT_ABI) is redundant. I presume a better way is to rely on compiler->opts.compReloc.

{
printf("Exact Type MT(0x%p)", dspPtr(iconVal));
}
else
{
printf("Exact Type MT(0x%p %s)", dspPtr(iconVal),
eeGetClassName((CORINFO_CLASS_HANDLE)iconVal));
}
}
else if (curAssertion->op1.kind == O1K_SUBTYPE)
{
ssize_t iconVal = curAssertion->op2.u1.iconVal;
printf("MT(0x%p %s)", dspPtr(iconVal), eeGetClassName((CORINFO_CLASS_HANDLE)iconVal));
if (IsTargetAbi(CORINFO_NATIVEAOT_ABI) || opts.IsReadyToRun())
{
printf("MT(0x%p)", dspPtr(iconVal));
}
else
{
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
27 changes: 24 additions & 3 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12152,13 +12152,34 @@ void Compiler::gtDispConst(GenTree* tree)
printf(" scope");
break;
case GTF_ICON_CLASS_HDL:
printf(" class %s", eeGetClassName((CORINFO_CLASS_HANDLE)iconVal));
if (IsTargetAbi(CORINFO_NATIVEAOT_ABI) || opts.IsReadyToRun())
{
printf(" class");
}
else
{
printf(" class %s", eeGetClassName((CORINFO_CLASS_HANDLE)iconVal));
}
break;
case GTF_ICON_METHOD_HDL:
printf(" method %s", eeGetMethodFullName((CORINFO_METHOD_HANDLE)iconVal));
if (IsTargetAbi(CORINFO_NATIVEAOT_ABI) || opts.IsReadyToRun())
{
printf(" method");
}
else
{
printf(" method %s", eeGetMethodFullName((CORINFO_METHOD_HANDLE)iconVal));
}
break;
case GTF_ICON_FIELD_HDL:
printf(" field %s", eeGetFieldName((CORINFO_FIELD_HANDLE)iconVal, true));
if (IsTargetAbi(CORINFO_NATIVEAOT_ABI) || opts.IsReadyToRun())
{
printf(" field");
}
else
{
printf(" field %s", eeGetFieldName((CORINFO_FIELD_HANDLE)iconVal, true));
}
break;
case GTF_ICON_STATIC_HDL:
printf(" static");
Expand Down
27 changes: 15 additions & 12 deletions src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9006,19 +9006,22 @@ 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)
if (!comp->IsTargetAbi(CORINFO_NATIVEAOT_ABI) && !comp->opts.IsReadyToRun())
{
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;
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