Repository: dotnet/runtime
File: src/coreclr/jit/emitarm.cpp (C++)

Code before:
                /* Find the appropriate entry in the data section list */

                for (jdsc = emitConsDsc.dsdList; jdsc; jdsc = jdsc->dsNext)
                {
                    UNATIVE_OFFSET size = jdsc->dsSize;

                    /* Is this a label table? */

                    if (jdsc->dsType == dataSection::blockAbsoluteAddr)
                    {
                        if (offs == imm)
                            break;
                    }

                    offs += size;
                }

                if (id->idIsDspReloc())
                {
                    printf("reloc ");
                }
                printf("%s ADDRESS J_M%03u_DS%02u", (id->idIns() == INS_movw) ? "LOW" : "HIGH", emitComp->compMethodID,
                       imm);

                // After the MOVT, dump the table if jdsc is not null (i.e., this is a block address table)
                if (jdsc != NULL && id->idIns() == INS_movt)
                {
                    unsigned     cnt = jdsc->dsSize / TARGET_POINTER_SIZE;
                    BasicBlock** bbp = (BasicBlock**)jdsc->dsCont;

                    bool isBound = (emitCodeGetCookie(*bbp) != NULL);

                    if (isBound)
                    {
                        printf("\n\n    J_M%03u_DS%02u LABEL   DWORD", emitComp->compMethodID, imm);

                        /* Display the label table (it's stored as "BasicBlock*" values) */

                        do
                        {
                            insGroup* lab;

                            /* Convert the BasicBlock* value to an IG address */

                            lab = (insGroup*)emitCodeGetCookie(*bbp++);
                            assert(lab);

                            printf("\n            DD      %s", emitLabelString(lab));
                        } while (--cnt);
                    }
                }

Review comment (bug):
@copilot Use `nullptr` instead of NULL, and also change the printing above to print the address with `RWD%02zu` format when this isn't a block address table

Code after:
                /* Find the appropriate entry in the data section list */

                for (jdsc = emitConsDsc.dsdList; jdsc; jdsc = jdsc->dsNext)
                {
                    UNATIVE_OFFSET size = jdsc->dsSize;

                    /* Is this a label table? */

                    if (jdsc->dsType == dataSection::blockAbsoluteAddr)
                    {
                        if (offs == imm)
                            break;
                    }

                    offs += size;
                }

                if (id->idIsDspReloc())
                {
                    printf("reloc ");
                }

                if (jdsc != nullptr)
                {
                    printf("%s ADDRESS J_M%03u_DS%02u", (id->idIns() == INS_movw) ? "LOW" : "HIGH",
                           emitComp->compMethodID, imm);
                }
                else
                {
                    printf("%s ADDRESS RWD%02zu", (id->idIns() == INS_movw) ? "LOW" : "HIGH", (size_t)imm);
                }

                // After the MOVT, dump the table if jdsc is not null. jdsc is null for async resume info
                // and non-null for block address tables.
                if (jdsc != nullptr && id->idIns() == INS_movt)
                {
                    unsigned     cnt = jdsc->dsSize / TARGET_POINTER_SIZE;
                    BasicBlock** bbp = (BasicBlock**)jdsc->dsCont;

                    bool isBound = (emitCodeGetCookie(*bbp) != nullptr);

                    if (isBound)
                    {
                        printf("\n\n    J_M%03u_DS%02u LABEL   DWORD", emitComp->compMethodID, imm);

                        /* Display the label table (it's stored as "BasicBlock*" values) */

                        do
                        {
                            insGroup* lab;