Skip to content

Commit ebb4a67

Browse files
committed
placeholder ExecutionManager contract; updates to RTS and Loader
1 parent f1d7be8 commit ebb4a67

File tree

3 files changed

+49
-3
lines changed

3 files changed

+49
-3
lines changed

docs/design/datacontracts/ExecutionManager.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Contracts used:
5050
```csharp
5151
```
5252

53+
**TODO** Methods
54+
5355
### NibbleMap
5456

5557
**TODO**

docs/design/datacontracts/Loader.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ TargetPointer GetLoaderAllocator(ModuleHandle handle);
3838
TargetPointer GetThunkHeap(ModuleHandle handle);
3939
TargetPointer GetILBase(ModuleHandle handle);
4040
ModuleLookupTables GetLookupTables(ModuleHandle handle);
41+
TargetPointer GetModuleLookupMapElement(TargetPointer table, uint rid, out TargetNUInt flags);
42+
bool IsCollectibleLoaderAllocator(ModuleHandle handle);
43+
4144
```
4245

4346
## Version 1
@@ -58,6 +61,10 @@ Data descriptors used:
5861
| `Module` | `TypeDefToMethodTableMap` | Mapping table |
5962
| `Module` | `TypeRefToMethodTableMap` | Mapping table |
6063
| `ModuleLookupMap` | `TableData` | Start of the mapping table's data |
64+
| `ModuleLookupMap` | `SupportedFlagsMask` | Mask for flag bits on lookup map entries |
65+
| `ModuleLookupMap` | `Count` | Number of TargetPointer sized entries in this section of the map |
66+
| `ModuleLookupMap` | `Next` | Pointer to next ModuleLookupMap segment for this map
67+
| `LoaderAllocator` | `IsCollectible` | Flag indicating if this is loader allocator may be collected
6168

6269
``` csharp
6370
ModuleHandle GetModuleHandle(TargetPointer modulePointer)
@@ -110,3 +117,5 @@ ModuleLookupTables GetLookupTables(ModuleHandle handle)
110117
Module::MethodDefToILCodeVersioningState */));
111118
}
112119
```
120+
121+
**TODO* pseudocode for IsCollectibleLoaderAllocator and LookupTableMap element lookup

docs/design/datacontracts/RuntimeTypeSystem.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,31 @@ partial interface IRuntimeTypeSystem : IContract
137137
// Return true if a MethodDesc represents an IL Stub dynamically generated by the runtime
138138
// A IL Stub method is also a StoredSigMethodDesc, and a NoMetadataMethod
139139
public virtual bool IsILStub(MethodDescHandle methodDesc);
140+
141+
// Return true if a MethodDesc is in a collectible module
142+
public virtual bool IsCollectibleMethod(MethodDescHandle methodDesc);
143+
144+
// Return true if a MethodDesc is in a module that supports Edit-And-Continue
145+
public virtual bool InEnCEnabledModule(MethodDescHandle methodDesc);
146+
147+
// Return true if a MethodDesc supports mulitiple code versions
148+
public virtual bool IsVersionable(MethodDescHandle methodDesc);
149+
150+
// Return a pointer to the IL versioning state of the MethodDesc
151+
public virtual TargetPointer GetMethodDescVersioningState(MethodDescHandle methodDesc);
152+
153+
// Return the MethodTable slot number of the MethodDesc
154+
public virtual ushort GetSlotNumber(MethodDescHandle methodDesc);
155+
156+
// Return true if the MethodDesc has space associated with it for storing a pointer to a code block
157+
public virtual bool HasNativeCodeSlot(MethodDescHandle methodDesc);
158+
159+
// Return the address of the space that stores a pointer to a code block associated with the MethodDesc
160+
public virtual TargetPointer GetAddressOfNativeCodeSlot(MethodDescHandle methodDesc);
161+
162+
// Get an instruction pointer that can be called to cause the MethodDesc to be executed
163+
public virtual TargetCodePointer GetNativeCode(MethodDescHandle methodDesc);
164+
140165
}
141166
```
142167

@@ -605,6 +630,7 @@ The version 1 `MethodDesc` APIs depend on the `MethodDescAlignment` global and t
605630
| `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. |
606631
| `MethodDescTokenRemainderBitCount` | Number of bits in the token remainder in `MethodDesc` |
607632

633+
**TODO** MethodDesc code pointers additions
608634

609635
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
610636
will typically have multiple chunks. There are subkinds of MethodDescs at runtime of varying sizes (but the sizes must be mutliples of `MethodDescAlignment`) and each chunk contains method descriptors of the same size.
@@ -629,6 +655,15 @@ We depend on the following data descriptors:
629655
| `StoredSigMethodDesc` | `ExtendedFlags` | Flags field for the `StoredSigMethodDesc` |
630656
| `DynamicMethodDesc` | `MethodName` | Pointer to Null-terminated UTF8 string describing the Method desc |
631657

658+
**TODO** MethodDesc code pointers additions
659+
660+
The contract depends on the following other contracts
661+
662+
| Contract |
663+
| --- |
664+
| Loader |
665+
| ReJIT |
666+
| CodeVersions |
632667

633668
And the following enumeration definitions
634669

@@ -708,9 +743,9 @@ And the various apis are implemented with the following algorithms
708743
public uint GetMethodToken(MethodDescHandle methodDescHandle)
709744
{
710745
MethodDesc methodDesc = _methodDescs[methodDescHandle.Address];
711-
746+
712747
TargetPointer methodDescChunk = // Using ChunkIndex from methodDesc, compute the wrapping MethodDescChunk
713-
748+
714749
ushort Flags3AndTokenRemainder = // Read Flags3AndTokenRemainder field from MethodDesc contract using address methodDescHandle.Address
715750
716751
ushort FlagsAndTokenRange = // Read FlagsAndTokenRange field from MethodDescChunk contract using address methodDescChunk
@@ -819,4 +854,4 @@ And the various apis are implemented with the following algorithms
819854
return ((DynamicMethodDescExtendedFlags)ExtendedFlags).HasFlag(DynamicMethodDescExtendedFlags.IsILStub);
820855
}
821856
```
822-
**TODO(cdac)**
857+
**TODO(cdac)** additional code pointers methods on MethodDesc

0 commit comments

Comments
 (0)