Skip to content

RyuJIT: Optimze Type.GetType("type id str") to type handle #31974

@EgorBo

Description

@EgorBo

I wonder if it makes sense in RyuJIT to optimize things like

Type type = Type.GetType("Foo.MyType"); // and, perhaps,  typeof(T).Assembly.GetType

to a runtime equivalent of :

Type type = typeof(Foo.MyType); // to CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE

Once #1378 is merged there will be getStringLiteral API for ldstr tokens.

Example: Environment.Unix.cs (on tier1 compilation most assemblies/types most likely will be already known/loaded, e.g. via the same code but on tier0 🙂)

Or this is how we detect mono runtime:

bool isMono = typeof(object).Assembly.GetType("Mono.RuntimeStructs") != null;

/cc @jkotas @MichalStrehovsky

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIoptimizationuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions