Skip to content
Closed
Changes from 3 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
31 changes: 20 additions & 11 deletions src/coreclr/jit/emitxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12644,18 +12644,27 @@ void emitter::emitDispConstant(const instrDesc* id, bool skipComma) const
}
}

if ((val > -1000) && (val < 1000))
switch (id->idOpSize())
{
printf("%d", (int)val);
Copy link
Contributor

@xtqqczze xtqqczze Aug 18, 2025

Choose a reason for hiding this comment

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

we were printing decimal here not hex

Copy link
Author

Choose a reason for hiding this comment

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

Yikes! Good catch. Fixed.

}
else if ((val > 0) || (val < -0xFFFFFF))
{
printf("0x%zX", (ssize_t)val);
}
else
{
// (val < 0)
printf("-0x%zX", (ssize_t)-val);
Copy link
Member

Choose a reason for hiding this comment

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

The below code will never print negative values anymore. I do not think we want that to change.

FWIW, the jit disasm is a power user scenario for curious users only. It is not meant to be full fidelity/correct assembly output, and in various cases the produced disassembly will not be fully faithful. That is expected.

case EA_1BYTE:
printf("0x%X", static_cast<uint8_t>(val));
break;

case EA_2BYTE:
printf("0x%X", static_cast<uint16_t>(val));
break;

case EA_4BYTE:
printf("0x%X", static_cast<uint32_t>(val));
break;

case EA_8BYTE:
printf("0x%X", static_cast<uint64_t>(val));
break;

default:
printf("0x%zX", (size_t)val);
break;
}

emitDispCommentForHandle(cnsVal.cnsVal, id->idDebugOnlyInfo()->idMemCookie, id->idDebugOnlyInfo()->idFlags);
Expand Down
Loading