Skip to content

Instantly share code, notes, and snippets.

@dsyme
Created November 16, 2021 17:34
Show Gist options
  • Save dsyme/38b8df4282edf33d381f9cc55eb6191f to your computer and use it in GitHub Desktop.
Save dsyme/38b8df4282edf33d381f9cc55eb6191f to your computer and use it in GitHub Desktop.
NonGeneric --> TypeHandle(NonGeneric)
--> MethodTable "NonGeneric" ~~~~> System.Type
---> vtable NonGeneric::VirtualMethod1
---> ...
---> vtable NonGeneric::VirtualMethod2
---> **iimpls** for NonGeneric
---> EEClass "NonGeneric"
List<int> --> TypeHandle(List<int>)
--> MethodTable "List<int>" ~~~~> System.Type
---> vtable List<int>::VirtualMethod1
---> ...
---> vtable List<int>::VirtualMethod2
---> **iimpls** for List<int>
---> TypeHandle for "int"
---> EEClass "List<int>"
-*-> EEClass/MethodTable "List<_>"
List<string> --> TypeHandle(List<string>)
--> MethodTable "List<string>" ~~~~> System.Type
-*-> vtable List<CANONICAL>::VirtualMethod1
-*-> ...
-*-> vtable List<CANONICAL>::VirtualMethod2
-*-> **iimpls** for List<CANONICAL>
---> TypeHandle for "string"
-*-> EEClass "List<CANONICAL>"
-*-> EEClass/MethodTable "List<_>"
List<MyClass> --> MethodTable "List<MyClass>" ~~~~> System.Type
-*-> vtable List<CANONICAL>::VirtualMethod1
-*-> ...
-*-> vtable List<CANONICAL>::VirtualMethod2
---> <MyClass>
-*-> EEClass "List<CANONICAL>"
-*-> EEClass/MethodTable "List<_>"
NonGeneric::SomeMethod ---> MethodDesc "NonGeneric::SomeMethod"
---> x64 code for "NonGeneric::SomeMethod"
~~~~> MethodInfo
~~~~> Reflection, P/Invoke, Marshalling data
~~~~> Debug data, debug step tracing
NonGeneric::SomeGenericMethod<int> ---> InstantiatedMethodDesc "NonGeneric::SomeGenericMethod<int>"
--> x64 code for "NonGeneric::SomeGenericMethod<int>"
--> MethodTable "NonGeneric"
--> MethodDesc "NonGeneric::SomeGenericMethod<_>"
--> <int>
NonGeneric::SomeGenericMethod<string> ---> InstantiatedMethodDesc "NonGeneric::SomeGenericMethod<string>"
--> x64 code for "NonGeneric::SomeGenericMethod<CANONICAL>"
--> MethodTable "NonGeneric"
-*-> MethodDesc "NonGeneric::SomeGenericMethod<_>"
--> <string>
--> chunk-1
--> type-directed-slot-1 SomeThingInvolving<string>
--> type-directed-slot-2 C.Method<string>
--> type-directed-slot-3
--> type-directed-slot-4
--> chunk-2
--> type-directed-slot-1
--> type-directed-slot-2
--> type-directed-slot-3
--> type-directed-slot-4
NonGeneric::SomeGenericMethod<MyClass> ---> InstantiatedMethodDesc "NonGeneric::SomeGenericMethod<MyClass>"
--> x64 code for "NonGeneric::SomeGenericMethod<CANONICAL>"
--> MethodTable "NonGeneric"
-*-> MethodDesc "NonGeneric::SomeGenericMethod<_>"
--> <MyClass>
--> chunk-1
--> type-directed-slot-1 SomeThingInvolving<MyClass>
--> type-directed-slot-2 C.Method<MyClass>
--> type-directed-slot-3
--> type-directed-slot-4
--> chunk-2
--> type-directed-slot-1
--> type-directed-slot-2
--> type-directed-slot-3
--> type-directed-slot-4
---> End ---> runtime lookup needed!!
NonGeneric::SomeGenericMethod<CANONICAL>(ExtraArgFor_SomeGenericMethod_T {
....
ldtoken SomeThingInvolving<T>
C.Method<T>(....)
call C::Method<CANONICAL>(ExtraArgForM_T)
}
TypeHandle = MethodTable | Array-type-handle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment