Skip to content

Commit 46cda59

Browse files
Copilotjakobbotsch
authored andcommitted
JIT: fix arm32 dump/disasm of references to async resume info (dotnet#123814)
## Description ARM32 JIT dump/disasm asserts when encountering async resume info references. The `IF_T2_N2` instruction format handles both block address tables and async resume info, but the dump logic only expected the former. ## Changes - **Remove assert in `emitarm.cpp:7308`**: Was failing when `jdsc` is null (async resume info case) - **Add null check before table dump**: Skip inline block address table dump when `jdsc` is null - **Use `nullptr` instead of `NULL`**: Modern C++ style throughout the code block - **Add conditional printing**: Print `RWD%02zu` format for async resume info (when `jdsc` is null) and `J_M%03u_DS%02u` format for block address tables (when `jdsc` is not null) - **Clarify comment**: Document when `jdsc` is null vs non-null The fix preserves all existing dump behavior for block address tables while allowing async resume info to display properly without assertion. ```cpp // Before: would assert if jdsc is null and always print as DS format assert(jdsc != NULL); printf("... J_M%03u_DS%02u", ...); if (id->idIns() == INS_movt) { /* dump table using jdsc */ } // After: skip table dump when jdsc is null and use appropriate format if (jdsc != nullptr) printf("... J_M%03u_DS%02u", ...); // block address table else printf("... RWD%02zu", ...); // async resume info if (jdsc != nullptr && id->idIns() == INS_movt) { /* dump table using jdsc */ } ``` Affects dump/disasm output only; no impact on code generation. <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>JIT: fix arm32 dump/disasm of references to async resume info</issue_title> > <issue_description>See dotnet#123781 (comment) > > Seemingly `IF_T2_N2` expects the data to resolve to a table of block addresses, so if we reuse this form for references to async resume info it doesn't display properly. > > I think this just impacts dumping and disasm. But not 100% sure. > </issue_description> > > <agent_instructions>Fix this issue by handling gracefully the situation where `jdsc` is null -- skip the inline table dump logic in that case</agent_instructions> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes dotnet#123813 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/dotnet/runtime/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: jakobbotsch <7887810+jakobbotsch@users.noreply.github.com>
1 parent e0e5fe0 commit 46cda59

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

src/coreclr/jit/emitarm.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7285,7 +7285,7 @@ void emitter::emitDispInsHelp(
72857285
emitDispReg(id->idReg1(), attr, true);
72867286
imm = emitGetInsSC(id);
72877287
{
7288-
dataSection* jdsc = 0;
7288+
dataSection* jdsc = nullptr;
72897289
NATIVE_OFFSET offs = 0;
72907290

72917291
/* Find the appropriate entry in the data section list */
@@ -7305,22 +7305,29 @@ void emitter::emitDispInsHelp(
73057305
offs += size;
73067306
}
73077307

7308-
assert(jdsc != NULL);
7309-
73107308
if (id->idIsDspReloc())
73117309
{
73127310
printf("reloc ");
73137311
}
7314-
printf("%s ADDRESS J_M%03u_DS%02u", (id->idIns() == INS_movw) ? "LOW" : "HIGH", emitComp->compMethodID,
7315-
imm);
73167312

7317-
// After the MOVT, dump the table
7318-
if (id->idIns() == INS_movt)
7313+
if (jdsc != nullptr)
7314+
{
7315+
printf("%s ADDRESS J_M%03u_DS%02u", (id->idIns() == INS_movw) ? "LOW" : "HIGH",
7316+
emitComp->compMethodID, imm);
7317+
}
7318+
else
7319+
{
7320+
printf("%s ADDRESS RWD%02zu", (id->idIns() == INS_movw) ? "LOW" : "HIGH", (size_t)imm);
7321+
}
7322+
7323+
// After the MOVT, dump the table if jdsc is not null. jdsc is null for async resume info
7324+
// and non-null for block address tables.
7325+
if (jdsc != nullptr && id->idIns() == INS_movt)
73197326
{
73207327
unsigned cnt = jdsc->dsSize / TARGET_POINTER_SIZE;
73217328
BasicBlock** bbp = (BasicBlock**)jdsc->dsCont;
73227329

7323-
bool isBound = (emitCodeGetCookie(*bbp) != NULL);
7330+
bool isBound = (emitCodeGetCookie(*bbp) != nullptr);
73247331

73257332
if (isBound)
73267333
{

0 commit comments

Comments
 (0)