Skip to content

Unclear logic in Compiler::impDevirtualizeCall #43607

@Rattenkrieg

Description

@Rattenkrieg

I'm learning the code behind devirtualization and stumbled upon this one:
https://github.com/dotnet/runtime/blob/master/src/coreclr/src/jit/importer.cpp#L20539-L20547
For some reason this doesn't embeds, so here are lines under question:

        CORINFO_CLASS_HANDLE uniqueImplementingClass = NO_CLASS_HANDLE;

        // info.compCompHnd->getUniqueImplementingClass(objClass);

        if (uniqueImplementingClass == NO_CLASS_HANDLE)
        {
            JITDUMP("No unique implementor of interface %p (%s), sorry\n", dspPtr(objClass), objClassName);
            return;
        }

This was introduced in dotnet/coreclr#21270 and never changed afterwards
What my guesses are:
There is no implementation (yet) for getUniqueImplementingClass, so commented out getUniqueImplementingClass(objClass); makes sense. And I guess this stub meant to produce value for uniqueImplementingClass.
What surprised me is the following logic ending with the call to addGuardedDevirtualizationCandidate which will never be reached due to if (uniqueImplementingClass == NO_CLASS_HANDLE).

I found no mention of this in dotnet/coreclr#21270
Github search for getUniqueImplementingClass gives me nothing as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions