Skip to content

GDV: Multiple type-checks work items #86769

Open
@EgorBo

Description

@EgorBo

A tracking issue for progress related to GDV with multiple type-checks. Essentially, today we expand virtual calls like this:

obj.DoWork(); // interface or virtual call and JIT doesn't know obj's exact type

Jit is able to record (probe) obj's type in Tier0 so then in Tier1 we can expand it like this;

if (obj is Class1)
    ((Class1)obj).DoWork(); // no longer virtual, can be inlined
else
    obj.DoWork(); // virtual call as a fallback

We call this Guarded Devirtualization or GDV.
However, for polymorphic virtual call-sites where we see more than a single dominating class we want to be able to expand multiple candidates, e.g.:

if (obj is Class1)
    ((Class1)obj).DoWork();
if (obj is Class2)
    ((Class2)obj).DoWork();
if (obj is Class3 || obj is Class4) // e.g. they share the same method since DoWork is not overriden in Class4
    ((Class3)obj).DoWork();
else
    obj.DoWork(); // fallback (can be omitted in case of NativeAOT)

Tasks:

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions