Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Add EETypeOf intrinsic #852

Closed
Closed

Description

@MichalStrehovsky

Pull request #851 has a pretty awkward way to get to the EEType of the string type.

I propose we add an intrinsic to make this less awkward. The declaration of the intrinsic would look like this:

[Intrinsic]
IntPtr EETypeOf<T>() { }

The compiler would generate following IL method body:

ldtoken !!0
call RuntimeTypeHandle::get_RawValue
ret

(I'm wondering if the IntPtr should actually be EETypePtr.)

Activity

  1. MichalStrehovsky commented on Feb 11, 2016

    @MichalStrehovsky
    MemberAuthor

    @jkotas Is this a good/bad idea?

  2. jkotas commented on Feb 11, 2016

    @jkotas
    Member

    I like it. Random thoughts:

    The return type may be EETypePtr instead.

    We should use it in FastAllocateString and startup code to get the EEType for String. It will be faster, and we should be able to get rid of the plumbing used to pass String EEType to startup code.

    For !CORERT, it can be implemented as "typeof(T).TypeHandle.RawValue" - that should just work for .NET Native for UWP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions