You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Signature parsing and GetFieldDescData cDAC API (#119417)
* signature parsing and GetFieldDescData cDAC API
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Max Charlamb <44248479+max-charlamb@users.noreply.github.com>
In version 1 of the SignatureDecoder contract we take advantage of the System.Reflection.Metadata signature decoding. We implement a SignatureTypeProvider that inherits from System.Reflection.Metadata ISignatureTypeProvider.
14
+
15
+
Data descriptors used:
16
+
| Data Descriptor Name | Field | Meaning |
17
+
| --- | --- | --- |
18
+
19
+
20
+
Global variables used:
21
+
| Global Name | Type | Purpose |
22
+
| --- | --- | --- |
23
+
24
+
25
+
Contracts used:
26
+
| Contract Name |
27
+
| --- |
28
+
| RuntimeTypeSystem |
29
+
| Loader |
30
+
| EcmaMetadata |
31
+
32
+
### SignatureTypeProvider
33
+
The cDAC implements the ISignatureTypeProvider<TType,TGenericContext> with TType=TypeHandle. TGenericContext can either be a MethodDescHandle or TypeHandle; MethodDescHandle context is used to look up generic method parameters, and TypeHandle context is used to look up generic type parameters.
34
+
35
+
A cDAC SignatureTypeProvider is instantiated over a Module which is used to lookup types.
36
+
37
+
The following ISignatureTypeProvider APIs are trivially implemented using RuntimeTypeSystem.GetPrimitiveType and RuntimeTypeSystem.GetConstructedType:
38
+
39
+
* GetArrayType - GetConstructedType
40
+
* GetByReferenceType - GetConstructedType
41
+
* GetFunctionPointerType - Implemented as primitive IntPtr type
42
+
* GetGenericInstantiation - GetConstructedType
43
+
* GetModifiedType - Returns unmodified type
44
+
* GetPinnedType - Returns unpinned type
45
+
* GetPointerType - GetConstructedType
46
+
* GetPrimitiveType - GetConstructedType
47
+
* GetSZArrayType - GetConstructedType
48
+
49
+
GetGenericMethodParameter is only supported when TGenericContext=MethodDescHandle and looks up the method parameters from the context using RuntimeTypeSystem.GetGenericMethodInstantiation.
50
+
51
+
GetGenericTypeParameter is only supported when TGenericContext=TypeHandle and looks up the type parameters from the context using RuntimeTypeSystem.GetInstantiation.
52
+
53
+
GetTypeFromDefinition uses the SignatureTypeProvider's ModuleHandle to lookup the given Token in the Module's TypeDefToMethodTableMap. If a value is not found return null.
54
+
55
+
GetTypeFromReference uses the SignatureTypeProvider's ModuleHandle to lookup the given Token in the Module's TypeRefToMethodTableMap. If a value is not found return null.The implementation when the type exists in a different module is incomplete.
56
+
57
+
GetTypeFromSpecification is not currently implemented.
0 commit comments