Skip to content

Commit 50b756a

Browse files
committed
Merge branch 'main' into wasi_sdk22
2 parents 52e14b3 + 5b5d791 commit 50b756a

518 files changed

Lines changed: 20919 additions & 9103 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@
324324
<NoTargetFrameworkFiltering>true</NoTargetFrameworkFiltering>
325325

326326
<NativeBuildPartitionPropertiesToRemove>ClrFullNativeBuild;ClrRuntimeSubset;ClrJitSubset;ClrPalTestsSubset;ClrAllJitsSubset;ClrILToolsSubset;ClrNativeAotSubset;ClrSpmiSubset;ClrCrossComponentsSubset;ClrDebugSubset;HostArchitecture;PgoInstrument;NativeOptimizationDataSupported;CMakeArgs;CxxStandardLibrary;CxxStandardLibraryStatic;CxxAbiLibrary</NativeBuildPartitionPropertiesToRemove>
327+
<UseSystemZlib Condition="'$(TargetsAppleMobile)' == 'true' or '$(TargetOS)' == 'android' or '$(TargetArchitecture)' == 'armv6'">true</UseSystemZlib>
327328
</PropertyGroup>
328329

329330
<!-- RepositoryEngineeringDir isn't set when Installer tests import this file. -->

docs/area-owners.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Note: Editing this file doesn't update the mapping used by `@msftbot` for area-s
147147
| area-UWP | @tommcdon | @dotnet/area-uwp | UWP-specific issues including Microsoft.NETCore.UniversalWindowsPlatform and Microsoft.Net.UWPCoreRuntimeSdk |
148148
| area-VM-coreclr | @mangod9 | @mangod9 | |
149149
| area-VM-meta-mono | @steveisok | @lambdageek | |
150-
| area-VM-reflection-mono | @mangod9 | @lambdageek | MonoVM-specific reflection and reflection-emit issues |
150+
| area-VM-reflection-mono | @steveisok | @lambdageek | MonoVM-specific reflection and reflection-emit issues |
151151
| area-VM-threading-mono | @mangod9 | @lambdageek | |
152152
| area-Workloads | @lewing | @dotnet/net-sdk-workload-contributors | |
153153

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# Contract RuntimeTypeSystem
2+
3+
This contract is for exploring the properties of the runtime types of values on the managed heap or on the stack in a .NET process.
4+
5+
## APIs of contract
6+
7+
A `MethodTable` is the runtime representation of the type information about a value. Given a `TargetPointer` address, the `RuntimeTypeSystem` contract provides a `MethodTableHandle` for querying the `MethodTable`.
8+
9+
``` csharp
10+
struct MethodTableHandle
11+
{
12+
// no public properties or constructors
13+
14+
internal TargetPointer Address { get; }
15+
}
16+
```
17+
18+
``` csharp
19+
#region MethodTable inspection APIs
20+
public virtual MethodTableHandle GetMethodTableHandle(TargetPointer targetPointer);
21+
22+
public virtual TargetPointer GetModule(MethodTableHandle methodTable);
23+
// A canonical method table is either the MethodTable itself, or in the case of a generic instantiation, it is the
24+
// MethodTable of the prototypical instance.
25+
public virtual TargetPointer GetCanonicalMethodTable(MethodTableHandle methodTable);
26+
public virtual TargetPointer GetParentMethodTable(MethodTableHandle methodTable);
27+
28+
public virtual uint GetBaseSize(MethodTableHandle methodTable);
29+
// The component size is only available for strings and arrays. It is the size of the element type of the array, or the size of an ECMA 335 character (2 bytes)
30+
public virtual uint GetComponentSize(MethodTableHandle methodTable);
31+
32+
// True if the MethodTable is the sentinel value associated with unallocated space in the managed heap
33+
public virtual bool IsFreeObjectMethodTable(MethodTableHandle methodTable);
34+
public virtual bool IsString(MethodTableHandle methodTable);
35+
// True if the MethodTable represents a type that contains managed references
36+
public virtual bool ContainsGCPointers(MethodTableHandle methodTable);
37+
public virtual bool IsDynamicStatics(MethodTableHandle methodTable);
38+
public virtual ushort GetNumMethods(MethodTableHandle methodTable);
39+
public virtual ushort GetNumInterfaces(MethodTableHandle methodTable);
40+
41+
// Returns an ECMA-335 TypeDef table token for this type, or for its generic type definition if it is a generic instantiation
42+
public virtual uint GetTypeDefToken(MethodTableHandle methodTable);
43+
// Returns the ECMA 335 TypeDef table Flags value (a bitmask of TypeAttributes) for this type,
44+
// or for its generic type definition if it is a generic instantiation
45+
public virtual uint GetTypeDefTypeAttributes(MethodTableHandle methodTable);
46+
#endregion MethodTable inspection APIs
47+
```
48+
49+
## Version 1
50+
51+
The `MethodTable` inspection APIs are implemented in terms of the following flags on the runtime `MethodTable` structure:
52+
53+
``` csharp
54+
internal partial struct RuntimeTypeSystem_1
55+
{
56+
// The lower 16-bits of the MTFlags field are used for these flags,
57+
// if WFLAGS_HIGH.HasComponentSize is unset
58+
[Flags]
59+
internal enum WFLAGS_LOW : uint
60+
{
61+
GenericsMask = 0x00000030,
62+
GenericsMask_NonGeneric = 0x00000000, // no instantiation
63+
64+
StringArrayValues = GenericsMask_NonGeneric,
65+
}
66+
67+
// Upper bits of MTFlags
68+
[Flags]
69+
internal enum WFLAGS_HIGH : uint
70+
{
71+
Category_Mask = 0x000F0000,
72+
Category_Array = 0x00080000,
73+
Category_Array_Mask = 0x000C0000,
74+
Category_Interface = 0x000C0000,
75+
ContainsGCPointers = 0x01000000,
76+
HasComponentSize = 0x80000000, // This is set if lower 16 bits is used for the component size,
77+
// otherwise the lower bits are used for WFLAGS_LOW
78+
}
79+
80+
[Flags]
81+
internal enum WFLAGS2_ENUM : uint
82+
{
83+
DynamicStatics = 0x0002,
84+
}
85+
86+
// Encapsulates the MethodTable flags v1 uses
87+
internal struct MethodTableFlags
88+
{
89+
public uint MTFlags { get; }
90+
public uint MTFlags2 { get; }
91+
public uint BaseSize { get; }
92+
93+
public WFLAGS_LOW GetFlag(WFLAGS_LOW mask) { ... /* mask & lower 16 bits of MTFlags */ }
94+
public WFLAGS_HIGH GetFlag(WFLAGS_HIGH mask) { ... /* mask & upper 16 bits of MTFlags */ }
95+
96+
public WFLAGS2_ENUM GetFlag(WFLAGS2_ENUM mask) { ... /* mask & MTFlags2*/ }
97+
98+
private bool TestFlagWithMask(WFLAGS_LOW mask, WFLAGS_LOW flag)
99+
{
100+
if (IsStringOrArray)
101+
{
102+
return (WFLAGS_LOW.StringArrayValues & mask) == flag;
103+
}
104+
else
105+
{
106+
return (FlagsLow & mask) == flag;
107+
}
108+
}
109+
110+
public ushort ComponentSizeBits => (ushort)(MTFlags & 0x0000ffff); // only meaningful if HasComponentSize is set
111+
112+
public bool HasComponentSize => GetFlag(WFLAGS_HIGH.HasComponentSize) != 0;
113+
public bool IsInterface => GetFlag(WFLAGS_HIGH.Category_Mask) == WFLAGS_HIGH.Category_Interface;
114+
public bool IsString => HasComponentSize && !IsArray && ComponentSizeBits == 2;
115+
public bool IsArray => GetFlag(WFLAGS_HIGH.Category_Array_Mask) == WFLAGS_HIGH.Category_Array;
116+
public bool IsStringOrArray => HasComponentSize;
117+
public ushort ComponentSize => HasComponentSize ? ComponentSizeBits : (ushort)0;
118+
public bool HasInstantiation => !TestFlagWithMask(WFLAGS_LOW.GenericsMask, WFLAGS_LOW.GenericsMask_NonGeneric);
119+
public bool ContainsGCPointers => GetFlag(WFLAGS_HIGH.ContainsGCPointers) != 0;
120+
public bool IsDynamicStatics => GetFlag(WFLAGS2_ENUM.DynamicStatics) != 0;
121+
}
122+
123+
[Flags]
124+
internal enum EEClassOrCanonMTBits
125+
{
126+
EEClass = 0,
127+
CanonMT = 1,
128+
Mask = 1,
129+
}
130+
}
131+
```
132+
133+
Internally the contract has a `MethodTable_1` struct that depends on the `MethodTable` data descriptor
134+
135+
```csharp
136+
internal struct MethodTable_1
137+
{
138+
internal RuntimeTypeSystem_1.MethodTableFlags Flags { get; }
139+
internal ushort NumInterfaces { get; }
140+
internal ushort NumVirtuals { get; }
141+
internal TargetPointer ParentMethodTable { get; }
142+
internal TargetPointer Module { get; }
143+
internal TargetPointer EEClassOrCanonMT { get; }
144+
internal MethodTable_1(Data.MethodTable data)
145+
{
146+
Flags = new RuntimeTypeSystem_1.MethodTableFlags
147+
{
148+
MTFlags = data.MTFlags,
149+
MTFlags2 = data.MTFlags2,
150+
BaseSize = data.BaseSize,
151+
};
152+
NumInterfaces = data.NumInterfaces;
153+
NumVirtuals = data.NumVirtuals;
154+
EEClassOrCanonMT = data.EEClassOrCanonMT;
155+
Module = data.Module;
156+
ParentMethodTable = data.ParentMethodTable;
157+
}
158+
}
159+
```
160+
161+
The contract depends on the global pointer value `FreeObjectMethodTablePointer`.
162+
The contract additionally depends on the `EEClass` data descriptor.
163+
164+
```csharp
165+
private readonly Dictionary<TargetPointer, MethodTable_1> _methodTables;
166+
167+
internal TargetPointer FreeObjectMethodTablePointer {get; }
168+
169+
public MethodTableHandle GetMethodTableHandle(TargetPointer methodTablePointer)
170+
{
171+
... // validate that methodTablePointer points to something that looks like a MethodTable.
172+
... // read Data.MethodTable from methodTablePointer.
173+
... // create a MethodTable_1 and add it to _methodTables.
174+
return MethodTableHandle { Address = methodTablePointer }
175+
}
176+
177+
internal static EEClassOrCanonMTBits GetEEClassOrCanonMTBits(TargetPointer eeClassOrCanonMTPtr)
178+
{
179+
return (EEClassOrCanonMTBits)(eeClassOrCanonMTPtr & (ulong)EEClassOrCanonMTBits.Mask);
180+
}
181+
182+
public uint GetBaseSize(MethodTableHandle methodTableHandle) => _methodTables[methodTableHandle.Address].Flags.BaseSize;
183+
184+
public uint GetComponentSize(MethodTableHandle methodTableHandle) => GetComponentSize(_methodTables[methodTableHandle.Address]);
185+
186+
private TargetPointer GetClassPointer(MethodTableHandle methodTableHandle)
187+
{
188+
... // if the MethodTable stores a pointer to the EEClass, return it
189+
// otherwise the MethodTable stores a pointer to the canonical MethodTable
190+
// in that case, return the canonical MethodTable's EEClass.
191+
// Canonical MethodTables always store an EEClass pointer.
192+
}
193+
194+
private Data.EEClass GetClassData(MethodTableHandle methodTableHandle)
195+
{
196+
TargetPointer eeClassPtr = GetClassPointer(methodTableHandle);
197+
... // read Data.EEClass data from eeClassPtr
198+
}
199+
200+
201+
public TargetPointer GetCanonicalMethodTable(MethodTableHandle methodTableHandle) => GetClassData(methodTableHandle).MethodTable;
202+
203+
public TargetPointer GetModule(MethodTableHandle methodTableHandle) => _methodTables[methodTableHandle.Address].Module;
204+
public TargetPointer GetParentMethodTable(MethodTableHandle methodTableHandle) => _methodTables[methodTableHandle.Address].ParentMethodTable;
205+
206+
public bool IsFreeObjectMethodTable(MethodTableHandle methodTableHandle) => FreeObjectMethodTablePointer == methodTableHandle.Address;
207+
208+
public bool IsString(MethodTableHandle methodTableHandle) => _methodTables[methodTableHandle.Address].Flags.IsString;
209+
public bool ContainsGCPointers(MethodTableHandle methodTableHandle) => _methodTables[methodTableHandle.Address].Flags.ContainsGCPointers;
210+
211+
public uint GetTypeDefToken(MethodTableHandle methodTableHandle)
212+
{
213+
MethodTable_1 methodTable = _methodTables[methodTableHandle.Address];
214+
return (uint)(methodTable.Flags.GetTypeDefRid() | ((int)TableIndex.TypeDef << 24));
215+
}
216+
217+
public ushort GetNumMethods(MethodTableHandle methodTableHandle) => GetClassData(methodTableHandle).NumMethods;
218+
219+
public ushort GetNumInterfaces(MethodTableHandle methodTableHandle) => _methodTables[methodTableHandle.Address].NumInterfaces;
220+
221+
public uint GetTypeDefTypeAttributes(MethodTableHandle methodTableHandle) => GetClassData(methodTableHandle).CorTypeAttr;
222+
223+
public bool IsDynamicStatics(MethodTableHandle methodTableHandle) => _methodTables[methodTableHandle.Address].Flags.IsDynamicStatics;
224+
```

docs/project/dogfooding.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dotnet new nugetconfig
1414

1515
Next, add the package source to NuGet.Config with the [dotnet nuget add source](https://learn.microsoft.com/dotnet/core/tools/dotnet-nuget-add-source) command:
1616
```
17-
dotnet nuget add source -n dotnet8 https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet8/nuget/v3/index.json
17+
dotnet nuget add source -n dotnet9 https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet9/nuget/v3/index.json
1818
```
1919

2020
Then, you will be able to add the latest prerelease version of the desired package to your project.
@@ -31,7 +31,7 @@ To use daily builds of the entire runtime, follow the steps given in the rest of
3131
If you're using private Azure DevOps feeds for your projects, you might need to add the preview feed through the Azure-specific feed URI format, which is `azure-feed://organization/optionalProject/feed@view`. In this case, you can add the .NET development package feed as follows:
3232

3333
```
34-
azure-feed://dnceng/public/dotnet8@Local
34+
azure-feed://dnceng/public/dotnet9@Local
3535
```
3636

3737
## Install prerequisites
@@ -40,19 +40,19 @@ azure-feed://dnceng/public/dotnet8@Local
4040

4141
2. If you are using a local copy of the dotnet CLI, take care that when you type `dotnet` you do not inadvertently pick up a different copy that you may have in your path. On Windows, for example, if you use a Command Prompt, a global copy may be in the path, so use the fully qualified path to your local `dotnet` (e.g. `C:\dotnet\dotnet.exe`). If you receive an error "error NETSDK1045: The current .NET SDK does not support targeting .NET 9.0." then you may be executing an older `dotnet`.
4242

43-
After setting up dotnet you can verify you are using the dogfooding version by executing `dotnet --info`. Here is an example output at the time of writing:
43+
After setting up dotnet you can verify you are using the current preview version by executing `dotnet --info`. Here is an example output:
4444
```
4545
>dotnet --info
4646
.NET SDK:
47-
Version: 9.0.100-preview.5.22226.4
47+
Version: 9.0.100-preview.1.23456.7
4848
Commit: fc127ac5a4
4949
5050
Runtime Environment:
5151
OS Name: Windows
5252
OS Version: 10.0.22616
5353
OS Platform: Windows
5454
RID: win10-x64
55-
Base Path: C:\Program Files\dotnet\sdk\9.0.100-preview.5.22226.4\
55+
Base Path: C:\Program Files\dotnet\sdk\9.0.100-preview.1.23456.7\
5656
5757
global.json file:
5858
Not found
@@ -63,10 +63,10 @@ Host:
6363
Commit: 47d9c43ab1
6464
6565
.NET SDKs installed:
66-
9.0.100-preview.5.22226.4 [C:\Program Files\dotnet\sdk]
66+
9.0.100-preview.1.23456.7 [C:\Program Files\dotnet\sdk]
6767
6868
.NET runtimes installed:
69-
Microsoft.NETCore.App 9.0.0-preview.5.22224.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
69+
Microsoft.NETCore.App 9.0.0-preview.1.23456.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
7070
7171
Download .NET:
7272
https://aka.ms/dotnet-download
@@ -79,7 +79,7 @@ Learn about .NET Runtimes and SDKs:
7979
3. Our daily builds are uploaded to development feed, not NuGet - so ensure the development feed is in your nuget configuration in case you need other packages that aren't included in the download. For example, on Windows you could edit `%userprofile%\appdata\roaming\nuget\nuget.config` or on Linux edit `~/.nuget/NuGet/NuGet.Config` to add these lines:
8080
```xml
8181
<packageSources>
82-
<add key="dotnet8" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet8/nuget/v3/index.json" />
82+
<add key="dotnet9" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet9/nuget/v3/index.json" />
8383
...
8484
</packageSources>
8585
```
@@ -150,7 +150,7 @@ make it self-contained by adding a RuntimeIdentifier (RID).
150150
<!-- Ensure that the target framework is correct e.g. 'net9.0' -->
151151
<TargetFramework>net9.0</TargetFramework>
152152
<!-- modify build in this line with version reported by `dotnet --info` as above under ".NET runtimes installed" -> Microsoft.NETCore.App -->
153-
<!-- moreover, this can be any valid Microsoft.NETCore.App package version from https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json -->
153+
<!-- moreover, this can be any valid Microsoft.NETCore.App package version from https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json -->
154154
<RuntimeFrameworkVersion>9.0.0-preview.5.22224.3</RuntimeFrameworkVersion>
155155
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <!-- RID to make it self-contained -->
156156
</PropertyGroup>
@@ -165,8 +165,8 @@ $ bin\Debug\net9.0\win-x64\publish\App.exe
165165
### Daily builds table
166166

167167
<!--
168-
To update this table, run 'build.sh/cmd RegenerateDownloadTable'. See
169-
'tools-local/regenerate-readme-table.proj' to add or remove rows or columns,
168+
To update this table, run 'build.sh/cmd -s RegenerateDownloadTable'. See
169+
'eng/regenerate-download-table.csproj' to add or remove rows or columns,
170170
and add links below to fill out the table's contents.
171171
-->
172172
<!-- BEGIN generated table -->

docs/project/list-of-diagnostics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ The PR that reveals the implementation of the `<IncludeInternalObsoleteAttribute
110110
| __`SYSLIB0053`__ | AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size. |
111111
| __`SYSLIB0054`__ | Thread.VolatileRead and Thread.VolatileWrite are obsolete. Use Volatile.Read or Volatile.Write respectively instead. |
112112
| __`SYSLIB0055`__ | The underlying hardware instruction does not perform a signed saturate narrowing operation, and it always returns an unsigned result. Use the unsigned overload instead. |
113+
| __`SYSLIB0057`__ | Loading certificate data through the constructor or Import is obsolete. Use X509CertificateLoader instead to load certificates. |
113114

114115
## Analyzer Warnings
115116

docs/workflow/ci/pr-guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Anyone with write access can merge a pull request manually when the following co
3030
* The PR has been approved by at least one reviewer and any other objections are addressed.
3131
* You can request another review from the original reviewer.
3232
* The PR successfully builds and passes all tests in the Continuous Integration (CI) system. In case of failures, refer to the [analyzing build failures](failure-analysis.md) doc.
33+
* The CI results are no more than 1 week old.
3334

3435
Typically, PRs are merged as one commit (squash merges). It creates a simpler history than a Merge Commit. "Special circumstances" are rare, and typically mean that there are a series of cleanly separated changes that will be too hard to understand if squashed together, or for some reason we want to preserve the ability to disect them.
3536

0 commit comments

Comments
 (0)