dotnet / corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.

Home Page:http://dot.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: NoMetadataRuntimeInterfacesAlgorithm

yowl opened this issue · comments

commented

What would be an example of a type that fits this:

    /// <summary>
    /// Gets interface information from the RuntimeTypeHandle for a type with no metadata
    /// </summary>
    internal class NoMetadataRuntimeInterfacesAlgorithm : RuntimeInterfacesAlgorithm
    {

?

The type system C# source code is shared between the compiler and the runtime type system.

The runtime type system is used to build new EETypes at runtime - mostly for things like MakeGenericType and MakeGenericMethod. If I remember correctly, in the runtime type system, all runtime types are represented as "no metadata types", because the amount of metadata we have is extremely limited (basically, we construct TypeDesc instances that are only backed by the EEType data structure - we can't answer questions such as: what are all the methods on this type?).

The class you're asking about is a good example of what that means: instead of having to compute the list of interfaces based on metadata (which would entail walking the list of interfaces introduced by each of the base classes), we just grab a precomputed list of interfaces from the EEType (because the data structure is already laid out to have all the runtime interfaces available because that's what we need for casting).

commented

Thanks