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
Implementation of SOSDacApi GetMethodDescName for cDAC (#106169)
Add a number of new `MethodDesc` contract definitions
| Contract algorithm on RuntimeTypeSystem |
| --- |
| `IsGenericMethodDefinition`|
|`GetGenericMethodInstantiation`|
|`GetMethodToken`|
|`IsArrayMethod`|
|`IsDynamicMethod`|
|`IsStoredSigMethodDesc`|
|`IsNoMetadataMethod`|
|`IsILStub`|
Update cDAC compat asserts in cDAC to always be enabled by using a tls variable in `mscordaccore`
Implement `GetMethodDescName` on `ISOSDacInterface` in the `cdacreader`
Stub out an implementation of `GetPath` in the `Loader` contract used in a fallback after a fallback. This will need further work, but is included to make sure the code path isn't lost.
Fix the `EcmaMetadataReader` to be able to find blobs in the metadata
Add ability to read target data from a buffer held on the cdac side using the `Target` class. This was needed to handle signature containing a `CorElementType.Internal`.
And finally actually implement the name generation algorithm via a line for line port from the CoreCLR codebase.
Contributes to #99302
@@ -563,7 +602,8 @@ The version 1 `MethodDesc` APIs depend on the `MethodDescAlignment` global and t
563
602
564
603
| Global name | Meaning |
565
604
| --- | --- |
566
-
| `MethodDescAlignment` | `MethodDescChunk` trailing data is allocated in multiples of this constant. The size (in bytes) of each `MethodDesc` (or subclass) instance is a multiple of this constant.
605
+
|`MethodDescAlignment`|`MethodDescChunk` trailing data is allocated in multiples of this constant. The size (in bytes) of each `MethodDesc` (or subclass) instance is a multiple of this constant. |
606
+
|`MethodDescTokenRemainderBitCount`| Number of bits in the token remainder in `MethodDesc`|
567
607
568
608
569
609
In the runtime a `MethodDesc` implicitly belongs to a single `MethodDescChunk` and some common data is shared between method descriptors that belong to the same chunk. A single method table
@@ -572,12 +612,211 @@ will typically have multiple chunks. There are subkinds of MethodDescs at runti
572
612
We depend on the following data descriptors:
573
613
| Data Descriptor Name | Field | Meaning |
574
614
| --- | --- | --- |
575
-
| `MethodDesc` | `ChunkIndex` | Offset of this `MethodDesc` relative to the end of its containing `MethodDescChunk` - in multiples of `MethodDescAlignment`
576
-
| `MethodDesc` | `Slot` | The method's slot
577
-
| `MethodDesc` | `Flags` | The method's flags
578
-
| `MethodDescChunk` | `MethodTable` | The method table set of methods belongs to
579
-
| `MethodDescChunk` | `Next` | The next chunk of methods
580
-
| `MethodDescChunk` | `Size` | The size of this `MethodDescChunk` following this `MethodDescChunk` header, minus 1. In multiples of `MethodDescAlignment`
581
-
| `MethodDescChunk` | `Count` | The number of `MethodDesc` entries in this chunk, minus 1.
615
+
|`MethodDesc`|`ChunkIndex`| Offset of this `MethodDesc` relative to the end of its containing `MethodDescChunk` - in multiples of `MethodDescAlignment`|
616
+
|`MethodDesc`|`Slot`| The method's slot |
617
+
|`MethodDesc`|`Flags`| The method's flags |
618
+
|`MethodDesc`|`Flags3AndTokenRemainder`| More flags for the method, and the low bits of the method's token's RID |
619
+
|`MethodDescChunk`|`MethodTable`| The method table set of methods belongs to |
620
+
|`MethodDescChunk`|`Next`| The next chunk of methods |
621
+
|`MethodDescChunk`|`Size`| The size of this `MethodDescChunk` following this `MethodDescChunk` header, minus 1. In multiples of `MethodDescAlignment`|
622
+
|`MethodDescChunk`|`Count`| The number of `MethodDesc` entries in this chunk, minus 1. |
623
+
|`MethodDescChunk`|`FlagsAndTokenRange`|`MethodDescChunk` flags, and the upper bits of the method token's RID |
624
+
|`InstantiatedMethodDesc`|`PerInstInfo`| The pointer to the method's type arguments |
625
+
|`InstantiatedMethodDesc`|`Flags2`| Flags for the `InstantiatedMethodDesc`|
626
+
|`InstantiatedMethodDesc`|`NumGenericArgs`| How many generic args the method has |
627
+
|`StoredSigMethodDesc`|`Sig`| Pointer to a metadata signature |
628
+
|`StoredSigMethodDesc`|`cSig`| Count of bytes in the metadata signature |
629
+
|`StoredSigMethodDesc`|`ExtendedFlags`| Flags field for the `StoredSigMethodDesc`|
630
+
|`DynamicMethodDesc`|`MethodName`| Pointer to Null-terminated UTF8 string describing the Method desc |
631
+
632
+
633
+
And the following enumeration definitions
634
+
635
+
```csharp
636
+
internalenumMethodDescClassification
637
+
{
638
+
IL=0, // IL
639
+
FCall=1, // FCall (also includes tlbimped ctor, Delegate ctor)
640
+
PInvoke=2, // PInvoke method
641
+
EEImpl=3, // special method; implementation provided by EE (like Delegate Invoke)
642
+
Array=4, // Array ECall
643
+
Instantiated=5, // Instantiated generic methods, including descriptors
644
+
// for both shared and unshared code (see InstantiatedMethodDesc)
645
+
ComInterop=6,
646
+
Dynamic=7, // for method desc with no metadata behind
647
+
}
648
+
649
+
[Flags]
650
+
internalenumMethodDescFlags : ushort
651
+
{
652
+
ClassificationMask=0x7,
653
+
HasNonVtableSlot=0x0008,
654
+
}
655
+
656
+
internalenumInstantiatedMethodDescFlags2 : ushort
657
+
{
658
+
KindMask=0x07,
659
+
GenericMethodDefinition=0x01,
660
+
UnsharedMethodInstantiation=0x02,
661
+
SharedMethodInstantiation=0x03,
662
+
WrapperStubWithInstantiations=0x04,
663
+
}
664
+
665
+
[Flags]
666
+
internalenumDynamicMethodDescExtendedFlags : uint
667
+
{
668
+
IsLCGMethod=0x00004000,
669
+
IsILStub=0x00008000,
670
+
}
671
+
```
672
+
673
+
674
+
And the various apis are implemented with the following algorithms
0 commit comments