Skip to content

Commit 0df3870

Browse files
authored
[cDAC] Multi data-descriptor proposal (#118126)
* Update cDAC docs to account for multi data-descriptor support
1 parent 4562739 commit 0df3870

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

docs/design/datacontracts/contract-descriptor.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,17 @@ a JSON integer constant.
8686
"s_pThreadStore": [ 0 ], // indirect from pointer data offset 0
8787
"RuntimeID": "win-x64" // string value
8888
},
89+
"sub-descriptors":
90+
{
91+
"GCDescriptor": [ 1 ]
92+
},
8993
"contracts": {"Thread": 1, "GCHandle": 1, "ThreadStore": 1}
9094
}
9195
```
9296

9397
## Contract symbol
9498

95-
To aid in discovery, the contract descriptor should be exported by the module hosting the .NET
99+
To aid in discovery, the main contract descriptor should be exported by the module hosting the .NET
96100
runtime with the name `DotNetRuntimeContractDescriptor` using the C symbol naming conventions of the
97101
target platform.
98102

docs/design/datacontracts/data_descriptor.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ endianness. The types `nint`, `nuint` and `pointer` have target architecture po
3131
The data descriptor consists of:
3232
* a collection of type structure descriptors
3333
* a collection of global value descriptors
34+
* an optional collection of pointers to sub-descriptors
3435

3536
## Types
3637

@@ -92,6 +93,15 @@ The value must be an integral constant within the range of its type. Signed val
9293
natural encoding. Pointer values need not be aligned and need not point to addressable target
9394
memory.
9495

96+
## Sub-descriptor descriptors
97+
98+
Each sub-descriptor descriptor is effectively a global with a type of `pointer`. They will consist of:
99+
* a name
100+
* a pointer value
101+
102+
If the value is non-null, the pointer points to another [contract descriptor](contract-descriptor.md#contract-descriptor-1).
103+
104+
When parsing a data descriptor with sub-descriptors each sub-descriptor should be parsed then its type, global, and contract values should be merged in. If any conflicts arise when merging in sub-descriptor data, this is an error and behavior is undefined.
95105

96106
## Physical descriptors
97107

@@ -129,6 +139,7 @@ The toplevel dictionary will contain:
129139
* optional `"baseline": "BASELINE_ID"` see below
130140
* `"types": TYPES_DESCRIPTOR` see below
131141
* `"globals": GLOBALS_DESCRIPTOR` see below
142+
* optional `"sub-descriptors": SUB_DESCRIPTORS_DESCRIPTOR` see below
132143

133144
Additional toplevel keys may be present. For example, the in-memory data descriptor will contain a
134145
`"contracts"` key (see [contract descriptor](./contract_descriptor.md#Compatible_contracts)) for the
@@ -233,7 +244,9 @@ Note that a two element array is unambiguously "type and value", whereas a one-e
233244
unambiguously "indirect value".
234245

235246

236-
**Both formats**
247+
### Sub-descriptor Values
248+
249+
Sub-descriptor values will be an additional array, with the same specification as [global values](#Global-values) with the exception that the only valid value type is a `pointer`.
237250

238251
#### Specification Appendix
239252

@@ -284,7 +297,7 @@ string. For pointers, the address can be stored at a known offset in an in-proc
284297
array of pointers and the offset written into the constant JSON string.
285298

286299
The indirection array is not part of the data descriptor spec. It is part of the [contract
287-
descriptor](./contract_descriptor.md#Contract_descriptor).
300+
descriptor](./contract-descriptor.md#Contract_descriptor).
288301

289302

290303
## Example
@@ -345,6 +358,10 @@ The following is an example of an in-memory descriptor that references the above
345358
"FEATURE_COMINTEROP": 0,
346359
"s_pThreadStore": [ 0 ], // indirect from aux data offset 0
347360
"RuntimeID": "windows-x64"
361+
},
362+
"sub-descriptors":
363+
{
364+
"GC": [ 1 ] // indirect from aux data offset 1
348365
}
349366
}
350367
```

docs/design/datacontracts/datacontracts_design.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ More details are provided in the [data descriptor spec](./data_descriptor.md).
2626

2727
#### Global Values
2828

29-
Global values which can be either primitive integer constants or pointers.
29+
Global values which can be either primitive integer constants, pointers, or strings.
3030
All global values have a string describing their name, a type, and a value of one of the above types.
3131

3232
#### Data Structure Layout
@@ -41,6 +41,10 @@ The determinate size of a structure may be larger than the sum of the sizes of t
4141
in the data descriptor (that is, the data descriptor does not include every field and may not
4242
include padding bytes).
4343

44+
#### (Optional) Sub-descriptor pointers
45+
46+
Sub-descriptors are special global values which contain a pointer to another data descriptor. These are used when data definitions are not known by the runtime at compile time but may be known by an external component. In that case the data descriptor defers to the external component to describe its data.
47+
4448
### Compatible Contract
4549

4650
Each compatible contract is described by a string naming the contract, and a uint32 version. It is an ERROR if multiple versions of a contract are specified in the contract descriptor.

0 commit comments

Comments
 (0)