Skip to content

ReadyToRun: JIT helper not supported: CORINFO_HELP_INITCLASS #6902

@MichalStrehovsky

Description

@MichalStrehovsky

Running crossgen on the below code results in following messages

ReadyToRun: JIT helper not supported: CORINFO_HELP_INITCLASS
ReadyToRun: JIT helper not supported: CORINFO_HELP_INITINSTCLASS

Infrastructure to support this has been added to RyuJIT with dotnet/coreclr#7842, but this is currently excluded with eeGetEEInfo()->targetAbi == CORINFO_CORERT_ABI because only CoreRT knows how to generate the helper.

using System;

class Gen1<T> where T: class
{
    static Gen1()
    {
    }

    public static string Get1()
    {
        return ("Hello" as T) as string;
    }

    public static string Get2<U>()
    {
        return ("Hello" as T) as string;
    }
}

class Gen2<T> where T: class
{
    public static string GetFromClassParam()
    {
        return (Gen1<T>.Get1() as T) as string;
    }

    public static string GetFromMethodParam()
    {
        return (Gen1<T>.Get2<T>() as T) as string;
    }
}

internal class Program
{
    private static int Main()
    {
        return Gen2<string>.GetFromClassParam().Length + Gen2<string>.GetFromMethodParam().Length;
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions