Skip to content

Commit

Permalink
Merge branch 'main' into host-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sirntar authored Dec 20, 2024
2 parents 291f186 + ec1e561 commit b609f45
Show file tree
Hide file tree
Showing 424 changed files with 6,407 additions and 10,821 deletions.
6 changes: 6 additions & 0 deletions .CodeQL.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ path_classifiers:
# be excluded from analysis. If there is a problem at the API layer, the analysis
# engine will detect the problem in the src/ implementations anyway.
- src/libraries/**/ref/*
# exclude artifacts/obj/**/CMakeFiles/**/CheckFunctionExists.c since CMake
# generates random directory names causing creation of duplicate issues
# related to obsolete encryption algorithm used. Note that CheckFuntionExists
# files are generated as part of build-time checks in CMake and are not compiled
# or linked into any product binaries.
- artifacts/obj/**/CMakeFiles/**/CheckFunctionExists.c
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
]
},
"microsoft.dotnet.xharness.cli": {
"version": "10.0.0-prerelease.24575.1",
"version": "10.0.0-prerelease.24610.1",
"commands": [
"xharness"
]
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@
<!-- when this is updated, make sure to keep $(_NetCoreAppToolCurrent)
in src/mono/wasm/build/WasmApp.LocalBuild.props
and in src/mono/msbuild/apple/build/AppleBuild.LocalBuild.props in sync -->
<NetCoreAppToolCurrentVersion>9.0</NetCoreAppToolCurrentVersion>
<NetCoreAppToolCurrentVersion>10.0</NetCoreAppToolCurrentVersion>
<NetCoreAppToolCurrent>net$(NetCoreAppToolCurrentVersion)</NetCoreAppToolCurrent>
<NetCoreAppCurrentToolTargetFrameworkMoniker>$(NetCoreAppCurrentIdentifier),Version=v$(NetCoreAppToolCurrentVersion)</NetCoreAppCurrentToolTargetFrameworkMoniker>

<AspNetCoreAppCurrentVersion>9.0</AspNetCoreAppCurrentVersion>
<AspNetCoreAppCurrentVersion>10.0</AspNetCoreAppCurrentVersion>
<AspNetCoreAppCurrent>net$(AspNetCoreAppCurrentVersion)</AspNetCoreAppCurrent>

<NetFrameworkMinimum>net462</NetFrameworkMinimum>
Expand Down
2 changes: 1 addition & 1 deletion docs/area-owners.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This list is for this **dotnet/runtime** repo. The **dotnet/aspnetcore** repo ha

## Areas

Note: Editing this file doesn't update the mapping used by `@msftbot` for area-specific issue/PR notifications. That configuration is part of the [`fabricbot.json`](../.github/fabricbot.json) file, and many areas use GitHub teams for those notifications. If you're a community member interested in receiving area-specific issue/PR notifications, you won't appear in this table or be added to those GitHub teams, but you can create a PR that updates `fabricbot.json` to add yourself to those notifications. See [automation.md](infra/automation.md) for more information on the schema and tools used by FabricBot.
Note: Editing this file doesn't update the mapping used by `@dotnet-policy-service` for area-specific issue/PR notifications. That configuration is part of the [`resourceManagement.yml`](../.github/policies/resourceManagement.yml) file, and many areas use GitHub teams for those notifications. If you're a community member interested in receiving area-specific issue/PR notifications, you won't appear in this table or be added to those GitHub teams, but you can create a PR that updates `resourceManagement.yml` to add yourself to those notifications. See [automation.md](infra/automation.md) for more information.

| Area | Lead | Owners (area experts to tag in PRs and issues) | Notes |
|------------------------------------------------|----------------------|------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
Expand Down
13 changes: 13 additions & 0 deletions docs/design/datacontracts/CodeVersions.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public virtual bool CodeVersionManagerSupportsMethod(TargetPointer methodDesc);

// Return the instruction pointer corresponding to the start of the given native code version
public virtual TargetCodePointer GetNativeCode(NativeCodeVersionHandle codeVersionHandle);

// Gets the GCStressCodeCopy pointer if available, otherwise returns TargetPointer.Null
public virtual TargetPointer GetGCStressCodeCopy(NativeCodeVersionHandle codeVersionHandle);
```
### Extension Methods
```csharp
Expand All @@ -61,13 +64,15 @@ Data descriptors used:
| NativeCodeVersionNode | NativeCode | indicates an explicit native code version node |
| NativeCodeVersionNode | Flags | `NativeCodeVersionNodeFlags` flags, see below |
| NativeCodeVersionNode | VersionId | Version ID corresponding to the parent IL code version |
| NativeCodeVersionNode | GCCoverageInfo | GCStress debug info, if supported |
| ILCodeVersioningState | FirstVersionNode | pointer to the first `ILCodeVersionNode` |
| ILCodeVersioningState | ActiveVersionKind | an `ILCodeVersionKind` value indicating which fields of the active version are value |
| ILCodeVersioningState | ActiveVersionNode | if the active version is explicit, the NativeCodeVersionNode for the active version |
| ILCodeVersioningState | ActiveVersionModule | if the active version is synthetic or unknown, the pointer to the Module that defines the method |
| ILCodeVersioningState | ActiveVersionMethodDef | if the active version is synthetic or unknown, the MethodDef token for the method |
| ILCodeVersionNode | VersionId | Version ID of the node |
| ILCodeVersionNode | Next | Pointer to the next `ILCodeVersionNode`|
| GCCoverageInfo | SavedCode | Pointer to the GCCover saved code copy, if supported |

The flag indicates that the default version of the code for a method desc is active:
```csharp
Expand Down Expand Up @@ -249,3 +254,11 @@ bool ICodeVersions.CodeVersionManagerSupportsMethod(TargetPointer methodDescAddr
return true;
}
```

### Finding GCStress Code Copy
```csharp
public virtual TargetPointer GetGCStressCodeCopy(NativeCodeVersionHandle codeVersionHandle);
```

1. If `codeVersionHandle` is synthetic, use the `IRuntimeTypeSystem` to find the GCStressCodeCopy.
2. If `codeVersionHandle` is explicit, read the `NativeCodeVersionNode` for the `GCCoverageInfo` pointer. This value only exists in some builds. If the value doesn't exist or is a nullptr, return `TargetPointer.Null`. Otherwise return the `SavedCode` pointer from the `GCCoverageInfo` struct.
4 changes: 4 additions & 0 deletions docs/design/datacontracts/RuntimeTypeSystem.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ partial interface IRuntimeTypeSystem : IContract
// Get an instruction pointer that can be called to cause the MethodDesc to be executed
public virtual TargetCodePointer GetNativeCode(MethodDescHandle methodDesc);

// Gets the GCStressCodeCopy pointer if available, otherwise returns TargetPointer.Null
public virtual TargetPointer GetGCStressCodeCopy(MethodDescHandle methodDesc);
}
```

Expand Down Expand Up @@ -638,6 +640,7 @@ We depend on the following data descriptors:
| `MethodDesc` | `Slot` | The method's slot |
| `MethodDesc` | `Flags` | The method's flags |
| `MethodDesc` | `Flags3AndTokenRemainder` | More flags for the method, and the low bits of the method's token's RID |
| `MethodDesc` | `GCCoverageInfo` | The method's GCCover debug info, if supported |
| `MethodDescCodeData` | `VersioningState` | The IL versioning state associated with a method descriptor
| `MethodDescChunk` | `MethodTable` | The method table set of methods belongs to |
| `MethodDescChunk` | `Next` | The next chunk of methods |
Expand All @@ -654,6 +657,7 @@ We depend on the following data descriptors:
| `StoredSigMethodDesc` | `cSig` | Count of bytes in the metadata signature |
| `StoredSigMethodDesc` | `ExtendedFlags` | Flags field for the `StoredSigMethodDesc` |
| `DynamicMethodDesc` | `MethodName` | Pointer to Null-terminated UTF8 string describing the Method desc |
| `GCCoverageInfo` | `SavedCode` | Pointer to the GCCover saved code copy, if supported |


The contract depends on the following other contracts
Expand Down
12 changes: 10 additions & 2 deletions docs/workflow/building/coreclr/nativeaot.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,21 @@
* [Design Documentation](#design-documentation)
* [Further Reading](#further-reading)

The Native AOT toolchain can be currently built for Linux (x64/arm64), macOS (x64) and Windows (x64/arm64).
The Native AOT toolchain can be currently built for Linux (x64/arm32/arm64), macOS (x64/arm64) and Windows (x86/x64/arm64).

## Building

1. [Install pre-requisites](/docs/workflow/README.md#build-requirements)
1. Run `build[.cmd|.sh] clr.aot+libs -rc [Debug|Release]` from the repo root to build binaries for local development. This will build individual components, but not the NuGet packages and builds much faster.
1. Run `build[.cmd|.sh] clr.aot+libs -rc [Debug|Checked|Release] -lc Release` from the repo root to build binaries for local development. This will build individual components, but not the NuGet packages and builds much faster. The `-rc` parameters specifies build configuration of the runtime, AOT compiler, and corelib, `-lc` specifies the configuration of the rest of BCL libraries. The repo and test infra generally assumes BCL libraries are compiled as Release and you're unlikely to need Debug.

Once you build the repo, you can use the produced binaries in one of four ways specified below ("Using built binaries", "Building packages", "Convenience Visual Studio "repro" project", "Running tests").

### Using built binaries

In this workflow, you have a project file that you want to `dotnet publish`, but you want to use your own build of the compiler/runtime/framework. You need to be using a daily build of the .NET SDK downloaded from the dotnet/sdk repo. It's typically enough to just download the daily build ZIP file, unpack it, and make sure the unpacked directory is the first thing in your PATH. Don't forget to add a NuGet.config as specified by the dotnet/sdk repo- you'll hit restore issues otherwise.

The native AOT MSBuild targets allow overriding the paths to compiler/runtime/framework with the compiler/runtime/framework you just built. This requires that the SDK you're using is not too far from the runtime repo you just built. They sometimes get out of sync, if that happens you need to use the "Building packages" workflow below (you'll see issues such as missing members/types in assemblies, incorrect command line arguments passed to the compiler, and linking failures).

The paths to major components can be overridden using `IlcToolsPath`, `IlcSdkPath`, `IlcFrameworkPath`, `IlcFrameworkNativePath` and `IlcMibcPath` properties for `dotnet publish`. For example, `/p:IlcToolsPath=<repo root>\artifacts\bin\coreclr\windows.x64.Debug\ilc` can be used to override the compiler with a local debug build for troubleshooting or quick iterations.

### Building packages
Expand Down Expand Up @@ -65,6 +71,8 @@ Typical workflow for working on the compiler:
* Set Application arguments in the project Debug options to the response file that was generated by regular native aot publishing of your test project, e.g. `@obj\Release\net8.0\win-x64\native\HelloWorld.ilc.rsp`
* Build & run using **F5**

NOTE: this requires that you globally install the same .NET SDK version as the one that is used to build the repo. You can avoid this requirement by launching Visual Studio through the build.cmd script at the root of the repo. `build.cmd -vs src\coreclr\tools\aot\ilc.sln` opens the ILC solution, `build.cmd -vs nativeaot` opens the native AOT solution.

## Convenience Visual Studio "repro" project

Typical native AOT runtime developer scenario workflow is to native AOT compile a short piece of C# and run it. The repo contains helper projects that make debugging the AOT compiler and the runtime easier.
Expand Down
8 changes: 4 additions & 4 deletions eng/SourceBuildPrebuiltBaseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
<UsagePattern IdentityGlob="Microsoft.CodeAnalysis*/*4.8.*" />

<!-- Allowed and pinned to major version due to https://github.com/dotnet/source-build/issues/3228 -->
<UsagePattern IdentityGlob="Microsoft.NETCore.App.Crossgen2.linux-x64/*9.*" />
<UsagePattern IdentityGlob="Microsoft.NETCore.App.Runtime.linux-x64/*9.*" />
<UsagePattern IdentityGlob="*Microsoft.DotNet.ILCompiler/*9.*" />
<UsagePattern IdentityGlob="Microsoft.NETCore.App.Crossgen2.linux-x64/*10.*" />
<UsagePattern IdentityGlob="Microsoft.NETCore.App.Runtime.linux-x64/*10.*" />
<UsagePattern IdentityGlob="*Microsoft.DotNet.ILCompiler/*10.*" />

<!-- Allowed and pinned to SDK version -->
<UsagePattern IdentityGlob="Microsoft.NET.ILLink.Tasks/*9.*" />
<UsagePattern IdentityGlob="Microsoft.NET.ILLink.Tasks/*10.*" />

<!-- This version is brought in transitively from NuGet.Packaging.6.2.4.
Once a newer version of NuGet.Packaging is referenced which has a
Expand Down
2 changes: 1 addition & 1 deletion eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@
</ItemGroup>
<ItemGroup>
<SharedFrameworkProjectToBuild Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\Microsoft.NETCore.App\Microsoft.NETCore.App.Runtime.sfxproj" />
<SharedFrameworkProjectToBuild Condition="'$(BuildNativeAOTRuntimePack)' != 'true' and '$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)' and '$(TargetsMobile)' != 'true' and '$(DotNetBuildSourceOnly)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\bundle\Microsoft.NETCore.App.Bundle.bundleproj" />
<SharedFrameworkProjectToBuild Condition="'$(BuildNativeAOTRuntimePack)' != 'true' and '$(RuntimeFlavor)' == '$(PrimaryRuntimeFlavor)' and '$(TargetsMobile)' != 'true'" Include="$(InstallerProjectRoot)pkg\sfx\bundle\Microsoft.NETCore.App.Bundle.bundleproj" />
<ProjectToBuild Include="@(SharedFrameworkProjectToBuild)" Category="packs" />
</ItemGroup>
</When>
Expand Down
Loading

0 comments on commit b609f45

Please sign in to comment.