Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eng/Version.Details.xml76
-rw-r--r--eng/Versions.props32
-rw-r--r--eng/common/sdl/sdl.ps137
-rw-r--r--eng/common/templates/steps/execute-sdl.yml37
-rw-r--r--eng/testing/tests.singlefile.targets39
-rw-r--r--global.json6
-rw-r--r--src/coreclr/dlls/mscorrc/mscorrc.rc1
-rw-r--r--src/coreclr/dlls/mscorrc/resource.h1
-rw-r--r--src/coreclr/inc/readytorun.h7
-rw-r--r--src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets6
-rw-r--r--src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h4
-rw-r--r--src/coreclr/tools/Common/Compiler/Int128FieldLayoutAlgorithm.cs10
-rw-r--r--src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs4
-rw-r--r--src/coreclr/tools/Common/TypeSystem/Common/DefType.FieldLayout.cs23
-rw-r--r--src/coreclr/tools/Common/TypeSystem/Common/FieldLayoutAlgorithm.cs1
-rw-r--r--src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs31
-rw-r--r--src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs8
-rw-r--r--src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs5
-rw-r--r--src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/CompilerGeneratedNames.cs13
-rw-r--r--src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/CompilerGeneratedState.cs15
-rw-r--r--src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReferenceSource/CompilerGeneratedNames.cs13
-rw-r--r--src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReferenceSource/CompilerGeneratedState.cs14
-rw-r--r--src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logger.cs13
-rw-r--r--src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs6
-rw-r--r--src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ArchitectureSpecificFieldLayoutTests.cs74
-rw-r--r--src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InstanceFieldLayout.cs24
-rw-r--r--src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs18
-rw-r--r--src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILCompiler.TypeSystem.Tests.csproj1
-rw-r--r--src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestTypeSystemContext.cs11
-rw-r--r--src/coreclr/tools/aot/ILCompiler/Program.cs16
-rw-r--r--src/coreclr/tools/aot/crossgen2/crossgen2.csproj4
-rw-r--r--src/coreclr/vm/class.h29
-rw-r--r--src/coreclr/vm/classlayoutinfo.cpp23
-rw-r--r--src/coreclr/vm/dllimport.cpp6
-rw-r--r--src/coreclr/vm/methodtable.h3
-rw-r--r--src/coreclr/vm/methodtable.inl7
-rw-r--r--src/coreclr/vm/methodtablebuilder.cpp39
-rw-r--r--src/coreclr/vm/mlinfo.cpp17
-rw-r--r--src/libraries/System.Runtime/tests/System/Runtime/ControlledExecutionTests.cs341
-rw-r--r--src/mono/mono/mini/cpu-ppc64.mdesc20
-rw-r--r--src/mono/mono/mini/mini-ppc.c42
-rw-r--r--src/tests/Interop/DisabledRuntimeMarshalling/Native_DisabledMarshalling/DisabledRuntimeMarshallingNative.cs3
-rw-r--r--src/tests/Interop/DisabledRuntimeMarshalling/PInvokeAssemblyMarshallingDisabled/PInvokes.cs7
-rw-r--r--src/tests/Interop/PInvoke/Int128/Int128Native.cpp241
-rw-r--r--src/tests/Interop/PInvoke/Int128/Int128Test.cs136
-rw-r--r--src/tests/Interop/PInvoke/Int128/Int128Test.csproj4
-rw-r--r--src/tests/Interop/PInvoke/Int128/Int128TestFieldLayout.csproj15
-rw-r--r--src/tests/Interop/PInvoke/Int128/ProgramFieldLayout.cs23
-rw-r--r--src/tests/JIT/Stress/ABI/ABIs.cs11
-rw-r--r--src/tests/JIT/Stress/ABI/Gen.cs5
-rw-r--r--src/tests/JIT/Stress/ABI/Program.cs2
-rw-r--r--src/tests/JIT/Stress/ABI/Types.cs5
-rw-r--r--src/tests/issues.targets6
-rw-r--r--src/tests/readytorun/fieldlayout/fieldlayouttests.cs4
-rw-r--r--src/workloads/workloads.csproj4
55 files changed, 1222 insertions, 321 deletions
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 28dd80f5822..14511dc3d73 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -54,77 +54,77 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
- <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.Helix.Sdk" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.ApiCompat" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.ApiCompat" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.GenAPI" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.GenAPI" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.GenFacades" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.GenFacades" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.XUnitExtensions" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.XUnitExtensions" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.XUnitConsoleRunner" Version="2.5.1-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.XUnitConsoleRunner" Version="2.5.1-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Build.Tasks.Archives" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.Build.Tasks.Archives" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Build.Tasks.Packaging" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.Build.Tasks.Packaging" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.Build.Tasks.Installers" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.Build.Tasks.Templating" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Build.Tasks.Workloads" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.Build.Tasks.Workloads" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.CodeAnalysis" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.CodeAnalysis" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Build.Tasks.TargetFramework" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.Build.Tasks.TargetFramework" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.RemoteExecutor" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.RemoteExecutor" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.VersionTools.Tasks" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.VersionTools.Tasks" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.SharedFramework.Sdk" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.SharedFramework.Sdk" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
<Dependency Name="System.ComponentModel.TypeConverter.TestData" Version="7.0.0-beta.22415.3">
<Uri>https://github.com/dotnet/runtime-assets</Uri>
@@ -250,9 +250,9 @@
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>5ebf69650b9f7b4ecab485be840b3022420f7812</Sha>
</Dependency>
- <Dependency Name="Microsoft.DotNet.PackageTesting" Version="7.0.0-beta.22416.1">
+ <Dependency Name="Microsoft.DotNet.PackageTesting" Version="7.0.0-beta.22418.4">
<Uri>https://github.com/dotnet/arcade</Uri>
- <Sha>afc901d73d7d3bd363547ddf8769efe14052bfa7</Sha>
+ <Sha>0c027eede69ba22bafca9a1955f1e00848655ece</Sha>
</Dependency>
<Dependency Name="optimization.windows_nt-x64.MIBC.Runtime" Version="1.0.0-prerelease.22415.6">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-optimization</Uri>
diff --git a/eng/Versions.props b/eng/Versions.props
index be4c1a93969..efff8024de8 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -54,22 +54,22 @@
<!-- SDK dependencies -->
<MicrosoftDotNetApiCompatTaskVersion>7.0.100-rc.1.22402.1</MicrosoftDotNetApiCompatTaskVersion>
<!-- Arcade dependencies -->
- <MicrosoftDotNetApiCompatVersion>7.0.0-beta.22416.1</MicrosoftDotNetApiCompatVersion>
- <MicrosoftDotNetBuildTasksFeedVersion>7.0.0-beta.22416.1</MicrosoftDotNetBuildTasksFeedVersion>
- <MicrosoftDotNetCodeAnalysisVersion>7.0.0-beta.22416.1</MicrosoftDotNetCodeAnalysisVersion>
- <MicrosoftDotNetGenAPIVersion>7.0.0-beta.22416.1</MicrosoftDotNetGenAPIVersion>
- <MicrosoftDotNetGenFacadesVersion>7.0.0-beta.22416.1</MicrosoftDotNetGenFacadesVersion>
- <MicrosoftDotNetXUnitExtensionsVersion>7.0.0-beta.22416.1</MicrosoftDotNetXUnitExtensionsVersion>
- <MicrosoftDotNetXUnitConsoleRunnerVersion>2.5.1-beta.22416.1</MicrosoftDotNetXUnitConsoleRunnerVersion>
- <MicrosoftDotNetBuildTasksArchivesVersion>7.0.0-beta.22416.1</MicrosoftDotNetBuildTasksArchivesVersion>
- <MicrosoftDotNetBuildTasksInstallersVersion>7.0.0-beta.22416.1</MicrosoftDotNetBuildTasksInstallersVersion>
- <MicrosoftDotNetBuildTasksPackagingVersion>7.0.0-beta.22416.1</MicrosoftDotNetBuildTasksPackagingVersion>
- <MicrosoftDotNetBuildTasksTargetFrameworkVersion>7.0.0-beta.22416.1</MicrosoftDotNetBuildTasksTargetFrameworkVersion>
- <MicrosoftDotNetBuildTasksTemplatingVersion>7.0.0-beta.22416.1</MicrosoftDotNetBuildTasksTemplatingVersion>
- <MicrosoftDotNetBuildTasksWorkloadsPackageVersion>7.0.0-beta.22416.1</MicrosoftDotNetBuildTasksWorkloadsPackageVersion>
- <MicrosoftDotNetRemoteExecutorVersion>7.0.0-beta.22416.1</MicrosoftDotNetRemoteExecutorVersion>
- <MicrosoftDotNetVersionToolsTasksVersion>7.0.0-beta.22416.1</MicrosoftDotNetVersionToolsTasksVersion>
- <MicrosoftDotNetPackageTestingVersion>7.0.0-beta.22416.1</MicrosoftDotNetPackageTestingVersion>
+ <MicrosoftDotNetApiCompatVersion>7.0.0-beta.22418.4</MicrosoftDotNetApiCompatVersion>
+ <MicrosoftDotNetBuildTasksFeedVersion>7.0.0-beta.22418.4</MicrosoftDotNetBuildTasksFeedVersion>
+ <MicrosoftDotNetCodeAnalysisVersion>7.0.0-beta.22418.4</MicrosoftDotNetCodeAnalysisVersion>
+ <MicrosoftDotNetGenAPIVersion>7.0.0-beta.22418.4</MicrosoftDotNetGenAPIVersion>
+ <MicrosoftDotNetGenFacadesVersion>7.0.0-beta.22418.4</MicrosoftDotNetGenFacadesVersion>
+ <MicrosoftDotNetXUnitExtensionsVersion>7.0.0-beta.22418.4</MicrosoftDotNetXUnitExtensionsVersion>
+ <MicrosoftDotNetXUnitConsoleRunnerVersion>2.5.1-beta.22418.4</MicrosoftDotNetXUnitConsoleRunnerVersion>
+ <MicrosoftDotNetBuildTasksArchivesVersion>7.0.0-beta.22418.4</MicrosoftDotNetBuildTasksArchivesVersion>
+ <MicrosoftDotNetBuildTasksInstallersVersion>7.0.0-beta.22418.4</MicrosoftDotNetBuildTasksInstallersVersion>
+ <MicrosoftDotNetBuildTasksPackagingVersion>7.0.0-beta.22418.4</MicrosoftDotNetBuildTasksPackagingVersion>
+ <MicrosoftDotNetBuildTasksTargetFrameworkVersion>7.0.0-beta.22418.4</MicrosoftDotNetBuildTasksTargetFrameworkVersion>
+ <MicrosoftDotNetBuildTasksTemplatingVersion>7.0.0-beta.22418.4</MicrosoftDotNetBuildTasksTemplatingVersion>
+ <MicrosoftDotNetBuildTasksWorkloadsPackageVersion>7.0.0-beta.22418.4</MicrosoftDotNetBuildTasksWorkloadsPackageVersion>
+ <MicrosoftDotNetRemoteExecutorVersion>7.0.0-beta.22418.4</MicrosoftDotNetRemoteExecutorVersion>
+ <MicrosoftDotNetVersionToolsTasksVersion>7.0.0-beta.22418.4</MicrosoftDotNetVersionToolsTasksVersion>
+ <MicrosoftDotNetPackageTestingVersion>7.0.0-beta.22418.4</MicrosoftDotNetPackageTestingVersion>
<!-- NuGet dependencies -->
<NuGetBuildTasksPackVersion>6.0.0-preview.1.102</NuGetBuildTasksPackVersion>
<!-- Installer dependencies -->
diff --git a/eng/common/sdl/sdl.ps1 b/eng/common/sdl/sdl.ps1
new file mode 100644
index 00000000000..ac196e164a4
--- /dev/null
+++ b/eng/common/sdl/sdl.ps1
@@ -0,0 +1,37 @@
+
+function Install-Gdn {
+ param(
+ [string]$Path,
+
+ # If omitted, install the latest version of Guardian, otherwise install that specific version.
+ [string]$Version
+ )
+
+ $ErrorActionPreference = 'Stop'
+ Set-StrictMode -Version 2.0
+ $disableConfigureToolsetImport = $true
+ $global:LASTEXITCODE = 0
+
+ # `tools.ps1` checks $ci to perform some actions. Since the SDL
+ # scripts don't necessarily execute in the same agent that run the
+ # build.ps1/sh script this variable isn't automatically set.
+ $ci = $true
+ . $PSScriptRoot\..\tools.ps1
+
+ $argumentList = @("install", "Microsoft.Guardian.Cli", "-Source https://securitytools.pkgs.visualstudio.com/_packaging/Guardian/nuget/v3/index.json", "-OutputDirectory $Path", "-NonInteractive", "-NoCache")
+
+ if ($Version) {
+ $argumentList += "-Version $Version"
+ }
+
+ Start-Process nuget -Verbose -ArgumentList $argumentList -NoNewWindow -Wait
+
+ $gdnCliPath = Get-ChildItem -Filter guardian.cmd -Recurse -Path $Path
+
+ if (!$gdnCliPath)
+ {
+ Write-PipelineTelemetryError -Category 'Sdl' -Message 'Failure installing Guardian'
+ }
+
+ return $gdnCliPath.FullName
+} \ No newline at end of file
diff --git a/eng/common/templates/steps/execute-sdl.yml b/eng/common/templates/steps/execute-sdl.yml
index 73245593cef..86cf578c431 100644
--- a/eng/common/templates/steps/execute-sdl.yml
+++ b/eng/common/templates/steps/execute-sdl.yml
@@ -8,29 +8,26 @@ parameters:
condition: ''
steps:
-- ${{ if ne(parameters.overrideGuardianVersion, '') }}:
- - powershell: |
- $content = Get-Content $(GuardianPackagesConfigFile)
-
- Write-Host "packages.config content was:`n$content"
-
- $content = $content.Replace('$(DefaultGuardianVersion)', '$(GuardianVersion)')
- $content | Set-Content $(GuardianPackagesConfigFile)
-
- Write-Host "packages.config content updated to:`n$content"
- displayName: Use overridden Guardian version ${{ parameters.overrideGuardianVersion }}
+- task: NuGetAuthenticate@1
+ inputs:
+ nuGetServiceConnections: GuardianConnect
- task: NuGetToolInstaller@1
displayName: 'Install NuGet.exe'
-- task: NuGetCommand@2
- displayName: 'Install Guardian'
- inputs:
- restoreSolution: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
- feedsToUse: config
- nugetConfigPath: $(Build.SourcesDirectory)\eng\common\sdl\NuGet.config
- externalFeedCredentials: GuardianConnect
- restoreDirectory: $(Build.SourcesDirectory)\.packages
+- ${{ if ne(parameters.overrideGuardianVersion, '') }}:
+ - pwsh: |
+ . $(Build.SourcesDirectory)\eng\common\sdl\sdl.ps1
+ $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts -Version ${{ parameters.overrideGuardianVersion }}
+ Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation"
+ displayName: Install Guardian (Overridden)
+
+- ${{ if eq(parameters.overrideGuardianVersion, '') }}:
+ - pwsh: |
+ . $(Build.SourcesDirectory)\eng\common\sdl\sdl.ps1
+ $guardianCliLocation = Install-Gdn -Path $(Build.SourcesDirectory)\.artifacts
+ Write-Host "##vso[task.setvariable variable=GuardianCliLocation]$guardianCliLocation"
+ displayName: Install Guardian
- ${{ if ne(parameters.overrideParameters, '') }}:
- powershell: ${{ parameters.executeAllSdlToolsScript }} ${{ parameters.overrideParameters }}
@@ -40,7 +37,7 @@ steps:
- ${{ if eq(parameters.overrideParameters, '') }}:
- powershell: ${{ parameters.executeAllSdlToolsScript }}
- -GuardianPackageName Microsoft.Guardian.Cli.$(GuardianVersion)
+ -GuardianCliLocation $(GuardianCliLocation)
-NugetPackageDirectory $(Build.SourcesDirectory)\.packages
-AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw)
${{ parameters.additionalParameters }}
diff --git a/eng/testing/tests.singlefile.targets b/eng/testing/tests.singlefile.targets
index 86a8b98d545..d307e837e62 100644
--- a/eng/testing/tests.singlefile.targets
+++ b/eng/testing/tests.singlefile.targets
@@ -26,48 +26,13 @@
<IlcBuildTasksPath>$(CoreCLRILCompilerDir)netstandard/ILCompiler.Build.Tasks.dll</IlcBuildTasksPath>
<IlcSdkPath>$(CoreCLRAotSdkDir)</IlcSdkPath>
<IlcFrameworkPath>$(NetCoreAppCurrentTestHostSharedFrameworkPath)</IlcFrameworkPath>
- <NoWarn>$(NoWarn);IL3050;IL3051;IL3052;IL3054;IL3055;IL1005;IL3002</NoWarn>
+ <NoWarn>$(NoWarn);IL1005;IL3002</NoWarn>
<TrimMode>partial</TrimMode>
- <TrimmerSingleWarn>false</TrimmerSingleWarn>
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
+ <SuppressAotAnalysisWarnings>true</SuppressAotAnalysisWarnings>
<!-- Forced by ILLink targets; we should fix the SDK -->
<SelfContained>true</SelfContained>
-
- <!-- Works around https://github.com/dotnet/runtime/issues/73926 -->
- <!-- RequiresUnreferenceCodeAttribute method called -->
- <NoWarn>$(NoWarn);IL2026;IL2116</NoWarn>
- <!-- Invalid use of DynamicallyAccessedMembersAttribute -->
- <NoWarn>$(NoWarn);IL2041;IL2042;IL2043;IL2056</NoWarn>
- <!-- Reference to removed attribute type -->
- <NoWarn>$(NoWarn);IL2045</NoWarn>
- <!-- RequiresUnreferencedCodeAttribute mismatch on virtual override -->
- <NoWarn>$(NoWarn);IL2046</NoWarn>
- <!-- COM marshalling warning -->
- <NoWarn>$(NoWarn);IL2050</NoWarn>
- <!-- Reflection intrinsics with unknown arguments -->
- <NoWarn>$(NoWarn);IL2032;IL2055;IL2057;IL2058;IL2059;IL2060;IL2061;IL2096</NoWarn>
- <!-- Unknown values passed to locations with DynamicallyAccessedMemberTypes -->
- <NoWarn>$(NoWarn);IL2062;IL2063;IL2064;IL2065;IL2066</NoWarn>
- <!-- Unsatisfied DynamicallyAccessedMembers requirements -->
- <NoWarn>$(NoWarn);IL2067;IL2068;IL2069;IL2070;IL2071;IL2072;IL2073;IL2074;IL2075;IL2076;IL2077;IL2078;IL2079;IL2080;IL2081;IL2082;IL2083;IL2084;IL2085;IL2086;IL2087;IL2088;IL2089;IL2090;IL2091</NoWarn>
- <!-- DynamicallyAccessedMembersAttribute mismatch on virtual override -->
- <NoWarn>$(NoWarn);IL2092;IL2093;IL2094;IL2095</NoWarn>
- <!-- DynamicallyAccessedMembersAttribute used on unsupported member -->
- <NoWarn>$(NoWarn);IL2097;IL2098;IL2099;IL2106</NoWarn>
- <!-- Unknown value passed to Expression.Property -->
- <NoWarn>$(NoWarn);IL2103</NoWarn>
- <!-- Multiple methods associated with state machine type or user method -->
- <NoWarn>$(NoWarn);IL2107;IL2117</NoWarn>
- <!-- Unannotated type derived from base type with RequiresUnreferencedCode -->
- <NoWarn>$(NoWarn);IL2109</NoWarn>
- <!-- Reflection access to members with DynamicallyAccessedMembers requirements -->
- <NoWarn>$(NoWarn);IL2110;IL2111;IL2114;IL2115</NoWarn>
- <!-- Reflection access to members with RequiresUnreferencedCode -->
- <NoWarn>$(NoWarn);IL2112;IL2113</NoWarn>
- <!-- Reflection access to compiler-generated code -->
- <NoWarn>$(NoWarn);IL2118;IL2119;IL2120</NoWarn>
-
</PropertyGroup>
<Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.SingleEntry.targets" Condition="'$(TestNativeAot)' == 'true'" />
diff --git a/global.json b/global.json
index 4a177769017..555895afe03 100644
--- a/global.json
+++ b/global.json
@@ -8,9 +8,9 @@
"dotnet": "7.0.100-preview.7.22377.5"
},
"msbuild-sdks": {
- "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22416.1",
- "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22416.1",
- "Microsoft.DotNet.SharedFramework.Sdk": "7.0.0-beta.22416.1",
+ "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22418.4",
+ "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22418.4",
+ "Microsoft.DotNet.SharedFramework.Sdk": "7.0.0-beta.22418.4",
"Microsoft.Build.NoTargets": "3.5.0",
"Microsoft.Build.Traversal": "3.1.6",
"Microsoft.NET.Sdk.IL": "7.0.0-rc.1.22414.6"
diff --git a/src/coreclr/dlls/mscorrc/mscorrc.rc b/src/coreclr/dlls/mscorrc/mscorrc.rc
index 892c1f1c27b..e91bb09807b 100644
--- a/src/coreclr/dlls/mscorrc/mscorrc.rc
+++ b/src/coreclr/dlls/mscorrc/mscorrc.rc
@@ -271,6 +271,7 @@ BEGIN
IDS_EE_BADMARSHAL_ABSTRACTRETCRITICALHANDLE "Returned CriticalHandles cannot be abstract."
IDS_EE_BADMARSHAL_CUSTOMMARSHALER "Custom marshalers are only allowed on classes, strings, arrays, and boxed value types."
IDS_EE_BADMARSHAL_GENERICS_RESTRICTION "Non-blittable generic types cannot be marshaled."
+ IDS_EE_BADMARSHAL_INT128_RESTRICTION "System.Int128 and System.UInt128 cannot be passed by value to unmanaged."
IDS_EE_BADMARSHAL_AUTOLAYOUT "Structures marked with [StructLayout(LayoutKind.Auto)] cannot be marshaled."
IDS_EE_BADMARSHAL_STRING_OUT "Cannot marshal a string by-value with the [Out] attribute."
IDS_EE_BADMARSHAL_MARSHAL_DISABLED "Cannot marshal managed types when the runtime marshalling system is disabled."
diff --git a/src/coreclr/dlls/mscorrc/resource.h b/src/coreclr/dlls/mscorrc/resource.h
index d2177bd56db..3245329339c 100644
--- a/src/coreclr/dlls/mscorrc/resource.h
+++ b/src/coreclr/dlls/mscorrc/resource.h
@@ -283,6 +283,7 @@
#define IDS_EE_BADMARSHAL_ABSTRACTOUTCRITICALHANDLE 0x1a63
#define IDS_EE_BADMARSHAL_RETURNCHCOMTONATIVE 0x1a64
#define IDS_EE_BADMARSHAL_CRITICALHANDLE 0x1a65
+#define IDS_EE_BADMARSHAL_INT128_RESTRICTION 0x1a66
#define IDS_EE_BADMARSHAL_ABSTRACTRETCRITICALHANDLE 0x1a6a
#define IDS_EE_CH_IN_VARIANT_NOT_SUPPORTED 0x1a6b
diff --git a/src/coreclr/inc/readytorun.h b/src/coreclr/inc/readytorun.h
index 0934f2ea627..20a14621255 100644
--- a/src/coreclr/inc/readytorun.h
+++ b/src/coreclr/inc/readytorun.h
@@ -15,10 +15,10 @@
#define READYTORUN_SIGNATURE 0x00525452 // 'RTR'
// Keep these in sync with src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
-#define READYTORUN_MAJOR_VERSION 0x0007
-#define READYTORUN_MINOR_VERSION 0x0001
+#define READYTORUN_MAJOR_VERSION 0x0008
+#define READYTORUN_MINOR_VERSION 0x0000
-#define MINIMUM_READYTORUN_MAJOR_VERSION 0x006
+#define MINIMUM_READYTORUN_MAJOR_VERSION 0x008
// R2R Version 2.1 adds the InliningInfo section
// R2R Version 2.2 adds the ProfileDataInfo section
@@ -26,6 +26,7 @@
// R2R 3.0 is not backward compatible with 2.x.
// R2R Version 6.0 changes managed layout for sequential types with any unmanaged non-blittable fields.
// R2R 6.0 is not backward compatible with 5.x or earlier.
+// R2R Version 8.0 Changes the alignment of the Int128 type
struct READYTORUN_CORE_HEADER
{
diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
index 690ef724af0..417d4567a95 100644
--- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
+++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
@@ -49,6 +49,10 @@ The .NET Foundation licenses this file to you under the MIT license.
<EventSourceSupport Condition="$(IlcDisableReflection) == 'true'">false</EventSourceSupport>
</PropertyGroup>
+ <PropertyGroup Condition="'$(SuppressAotAnalysisWarnings)' == 'true'">
+ <EnableAotAnalyzer Condition="'$(EnableAotAnalyzer)' == ''">false</EnableAotAnalyzer>
+ </PropertyGroup>
+
<PropertyGroup>
<NativeObjectExt Condition="'$(TargetOS)' == 'windows'">.obj</NativeObjectExt>
<NativeObjectExt Condition="'$(TargetOS)' != 'windows'">.o</NativeObjectExt>
@@ -241,6 +245,8 @@ The .NET Foundation licenses this file to you under the MIT license.
<IlcArg Condition="$(IlcDumpIL) == 'true'" Include="--ildump:$(NativeIntermediateOutputPath)%(ManagedBinary.Filename).il" />
<IlcArg Condition="$(NoWarn) != ''" Include='--nowarn:"$([MSBuild]::Escape($(NoWarn)))"' />
<IlcArg Condition="$(TrimmerSingleWarn) == 'true'" Include="--singlewarn" />
+ <IlcArg Condition="$(SuppressTrimAnalysisWarnings) == 'true'" Include="--notrimwarn" />
+ <IlcArg Condition="$(SuppressAotAnalysisWarnings) == 'true'" Include="--noaotwarn" />
<IlcArg Condition="$(IlcTrimMetadata) == 'false'" Include="--reflectiondata:all" />
<IlcArg Condition="'$(ControlFlowGuard)' == 'Guard' and '$(TargetOS)' == 'windows'" Include="--guard:cf" />
<IlcArg Include="@(_IlcRootedAssemblies->'--root:%(Identity)')" />
diff --git a/src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h b/src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h
index 176aef2ad10..6f77813cd06 100644
--- a/src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h
+++ b/src/coreclr/nativeaot/Runtime/inc/ModuleHeaders.h
@@ -10,8 +10,8 @@ struct ReadyToRunHeaderConstants
{
static const uint32_t Signature = 0x00525452; // 'RTR'
- static const uint32_t CurrentMajorVersion = 7;
- static const uint32_t CurrentMinorVersion = 1;
+ static const uint32_t CurrentMajorVersion = 8;
+ static const uint32_t CurrentMinorVersion = 0;
};
struct ReadyToRunHeader
diff --git a/src/coreclr/tools/Common/Compiler/Int128FieldLayoutAlgorithm.cs b/src/coreclr/tools/Common/Compiler/Int128FieldLayoutAlgorithm.cs
index 60be29fdce9..18f794a6f35 100644
--- a/src/coreclr/tools/Common/Compiler/Int128FieldLayoutAlgorithm.cs
+++ b/src/coreclr/tools/Common/Compiler/Int128FieldLayoutAlgorithm.cs
@@ -28,8 +28,11 @@ namespace ILCompiler
ComputedInstanceFieldLayout layoutFromMetadata = _fallbackAlgorithm.ComputeInstanceLayout(defType, layoutKind);
- if (defType.Context.Target.IsWindows || (defType.Context.Target.PointerSize == 4))
+ // 32bit platforms use standard metadata layout engine
+ if (defType.Context.Target.Architecture == TargetArchitecture.ARM)
{
+ layoutFromMetadata.LayoutAbiStable = false; // Int128 parameter passing ABI is unstable at this time
+ layoutFromMetadata.IsInt128OrHasInt128Fields = true;
return layoutFromMetadata;
}
@@ -42,7 +45,8 @@ namespace ILCompiler
FieldAlignment = new LayoutInt(16),
FieldSize = layoutFromMetadata.FieldSize,
Offsets = layoutFromMetadata.Offsets,
- LayoutAbiStable = true
+ LayoutAbiStable = false, // Int128 parameter passing ABI is unstable at this time
+ IsInt128OrHasInt128Fields = true
};
}
@@ -72,7 +76,7 @@ namespace ILCompiler
public static bool IsIntegerType(DefType type)
{
return type.IsIntrinsic
- && type.Namespace == "System."
+ && type.Namespace == "System"
&& ((type.Name == "Int128") || (type.Name == "UInt128"));
}
}
diff --git a/src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs b/src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
index c5fdfda3d0f..cc286f81b03 100644
--- a/src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
+++ b/src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs
@@ -14,8 +14,8 @@ namespace Internal.Runtime
{
public const uint Signature = 0x00525452; // 'RTR'
- public const ushort CurrentMajorVersion = 7;
- public const ushort CurrentMinorVersion = 1;
+ public const ushort CurrentMajorVersion = 8;
+ public const ushort CurrentMinorVersion = 0;
}
#pragma warning disable 0169
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/DefType.FieldLayout.cs b/src/coreclr/tools/Common/TypeSystem/Common/DefType.FieldLayout.cs
index 2190f9ac1a2..4c3555c198a 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/DefType.FieldLayout.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/DefType.FieldLayout.cs
@@ -68,6 +68,11 @@ namespace Internal.TypeSystem
/// True if the type transitively has any types with LayoutKind.Auto in its layout.
/// </summary>
public const int IsAutoLayoutOrHasAutoLayoutFields = 0x400;
+
+ /// <summary>
+ /// True if the type transitively has an Int128 in it or is an Int128
+ /// </summary>
+ public const int IsInt128OrHasInt128Fields = 0x800;
}
private class StaticBlockInfo
@@ -135,6 +140,20 @@ namespace Internal.TypeSystem
}
}
+ /// <summary>
+ /// Is a type Int128 or transitively have any fields of a type Int128.
+ /// </summary>
+ public virtual bool IsInt128OrHasInt128Fields
+ {
+ get
+ {
+ if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedInstanceTypeLayout))
+ {
+ ComputeInstanceLayout(InstanceLayoutKind.TypeAndFields);
+ }
+ return _fieldLayoutFlags.HasFlags(FieldLayoutFlags.IsInt128OrHasInt128Fields);
+ }
+ }
/// <summary>
/// The number of bytes required to hold a field of this type
@@ -430,6 +449,10 @@ namespace Internal.TypeSystem
{
_fieldLayoutFlags.AddFlags(FieldLayoutFlags.IsAutoLayoutOrHasAutoLayoutFields);
}
+ if (computedLayout.IsInt128OrHasInt128Fields)
+ {
+ _fieldLayoutFlags.AddFlags(FieldLayoutFlags.IsInt128OrHasInt128Fields);
+ }
if (computedLayout.Offsets != null)
{
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/FieldLayoutAlgorithm.cs b/src/coreclr/tools/Common/TypeSystem/Common/FieldLayoutAlgorithm.cs
index a19ec4b3603..53388c915b8 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/FieldLayoutAlgorithm.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/FieldLayoutAlgorithm.cs
@@ -83,6 +83,7 @@ namespace Internal.TypeSystem
public LayoutInt ByteCountAlignment;
public bool LayoutAbiStable; // Is the layout stable such that it can safely be used in function calling conventions
public bool IsAutoLayoutOrHasAutoLayoutFields;
+ public bool IsInt128OrHasInt128Fields;
/// <summary>
/// If Offsets is non-null, then all field based layout is complete.
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs b/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs
index 70b529a6060..9d291d8c372 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs
@@ -110,6 +110,7 @@ namespace Internal.TypeSystem
FieldSize = sizeAndAlignment.Size,
LayoutAbiStable = true,
IsAutoLayoutOrHasAutoLayoutFields = false,
+ IsInt128OrHasInt128Fields = false,
};
if (numInstanceFields > 0)
@@ -211,7 +212,7 @@ namespace Internal.TypeSystem
}
ref StaticsBlock block = ref GetStaticsBlockForField(ref result, field);
- SizeAndAlignment sizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType, hasLayout: false, context.Target.DefaultPackingSize, out bool _, out bool _);
+ SizeAndAlignment sizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType, hasLayout: false, context.Target.DefaultPackingSize, out bool _, out bool _, out bool _);
block.Size = LayoutInt.AlignUp(block.Size, sizeAndAlignment.Alignment, context.Target);
result.Offsets[index] = new FieldAndOffset(field, block.Size);
@@ -303,15 +304,18 @@ namespace Internal.TypeSystem
int fieldOrdinal = 0;
bool layoutAbiStable = true;
bool hasAutoLayoutField = false;
+ bool hasInt128Field = type.BaseType == null ? false : type.BaseType.IsInt128OrHasInt128Fields;
foreach (var fieldAndOffset in layoutMetadata.Offsets)
{
TypeDesc fieldType = fieldAndOffset.Field.FieldType;
- var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType.UnderlyingType, hasLayout: true, packingSize, out bool fieldLayoutAbiStable, out bool fieldHasAutoLayout);
+ var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType.UnderlyingType, hasLayout: true, packingSize, out bool fieldLayoutAbiStable, out bool fieldHasAutoLayout, out bool fieldHasInt128Field);
if (!fieldLayoutAbiStable)
layoutAbiStable = false;
if (fieldHasAutoLayout)
hasAutoLayoutField = true;
+ if (fieldHasInt128Field)
+ hasInt128Field = true;
largestAlignmentRequired = LayoutInt.Max(fieldSizeAndAlignment.Alignment, largestAlignmentRequired);
@@ -357,6 +361,7 @@ namespace Internal.TypeSystem
ComputedInstanceFieldLayout computedLayout = new ComputedInstanceFieldLayout
{
IsAutoLayoutOrHasAutoLayoutFields = hasAutoLayoutField,
+ IsInt128OrHasInt128Fields = hasInt128Field,
};
computedLayout.FieldAlignment = instanceSizeAndAlignment.Alignment;
computedLayout.FieldSize = instanceSizeAndAlignment.Size;
@@ -392,17 +397,20 @@ namespace Internal.TypeSystem
int packingSize = ComputePackingSize(type, layoutMetadata);
bool layoutAbiStable = true;
bool hasAutoLayoutField = false;
+ bool hasInt128Field = type.BaseType == null ? false : type.BaseType.IsInt128OrHasInt128Fields;
foreach (var field in type.GetFields())
{
if (field.IsStatic)
continue;
- var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(field.FieldType.UnderlyingType, hasLayout: true, packingSize, out bool fieldLayoutAbiStable, out bool fieldHasAutoLayout);
+ var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(field.FieldType.UnderlyingType, hasLayout: true, packingSize, out bool fieldLayoutAbiStable, out bool fieldHasAutoLayout, out bool fieldHasInt128Field);
if (!fieldLayoutAbiStable)
layoutAbiStable = false;
if (fieldHasAutoLayout)
hasAutoLayoutField = true;
+ if (fieldHasInt128Field)
+ hasInt128Field = true;
largestAlignmentRequirement = LayoutInt.Max(fieldSizeAndAlignment.Alignment, largestAlignmentRequirement);
@@ -424,6 +432,7 @@ namespace Internal.TypeSystem
ComputedInstanceFieldLayout computedLayout = new ComputedInstanceFieldLayout
{
IsAutoLayoutOrHasAutoLayoutFields = hasAutoLayoutField,
+ IsInt128OrHasInt128Fields = hasInt128Field,
};
computedLayout.FieldAlignment = instanceSizeAndAlignment.Alignment;
computedLayout.FieldSize = instanceSizeAndAlignment.Size;
@@ -459,6 +468,7 @@ namespace Internal.TypeSystem
int instanceValueClassFieldCount = 0;
int instanceGCPointerFieldsCount = 0;
int[] instanceNonGCPointerFieldsCount = new int[maxLog2Size + 1];
+ bool hasInt128Field = false;
foreach (var field in type.GetFields())
{
@@ -471,6 +481,8 @@ namespace Internal.TypeSystem
{
// Valuetypes which are not primitives or enums
instanceValueClassFieldCount++;
+ if (((DefType)fieldType).IsInt128OrHasInt128Fields)
+ hasInt128Field = true;
}
else if (fieldType.IsGCPointer)
{
@@ -480,7 +492,7 @@ namespace Internal.TypeSystem
{
Debug.Assert(fieldType.IsPrimitive || fieldType.IsPointer || fieldType.IsFunctionPointer || fieldType.IsEnum || fieldType.IsByRef);
- var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType, hasLayout, packingSize, out bool _, out bool _);
+ var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType, hasLayout, packingSize, out bool _, out bool _, out bool _);
instanceNonGCPointerFieldsCount[CalculateLog2(fieldSizeAndAlignment.Size.AsInt)]++;
}
}
@@ -517,7 +529,7 @@ namespace Internal.TypeSystem
TypeDesc fieldType = field.FieldType;
- var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType, hasLayout, packingSize, out bool fieldLayoutAbiStable, out bool _);
+ var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType, hasLayout, packingSize, out bool fieldLayoutAbiStable, out bool _, out bool _);
if (!fieldLayoutAbiStable)
layoutAbiStable = false;
@@ -678,7 +690,7 @@ namespace Internal.TypeSystem
for (int i = 0; i < instanceValueClassFieldsArr.Length; i++)
{
// Align the cumulative field offset to the indeterminate value
- var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(instanceValueClassFieldsArr[i].FieldType, hasLayout, packingSize, out bool fieldLayoutAbiStable, out bool _);
+ var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(instanceValueClassFieldsArr[i].FieldType, hasLayout, packingSize, out bool fieldLayoutAbiStable, out bool _, out bool _);
if (!fieldLayoutAbiStable)
layoutAbiStable = false;
@@ -729,6 +741,7 @@ namespace Internal.TypeSystem
ComputedInstanceFieldLayout computedLayout = new ComputedInstanceFieldLayout
{
IsAutoLayoutOrHasAutoLayoutFields = true,
+ IsInt128OrHasInt128Fields = hasInt128Field,
};
computedLayout.FieldAlignment = instanceSizeAndAlignment.Alignment;
computedLayout.FieldSize = instanceSizeAndAlignment.Size;
@@ -742,7 +755,7 @@ namespace Internal.TypeSystem
private static void PlaceInstanceField(FieldDesc field, bool hasLayout, int packingSize, FieldAndOffset[] offsets, ref LayoutInt instanceFieldPos, ref int fieldOrdinal, LayoutInt offsetBias)
{
- var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(field.FieldType, hasLayout, packingSize, out bool _, out bool _);
+ var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(field.FieldType, hasLayout, packingSize, out bool _, out bool _, out bool _);
instanceFieldPos = AlignUpInstanceFieldOffset(field.OwningType, instanceFieldPos, fieldSizeAndAlignment.Alignment, field.Context.Target);
offsets[fieldOrdinal] = new FieldAndOffset(field, instanceFieldPos + offsetBias);
@@ -802,11 +815,12 @@ namespace Internal.TypeSystem
return cumulativeInstanceFieldPos;
}
- private static SizeAndAlignment ComputeFieldSizeAndAlignment(TypeDesc fieldType, bool hasLayout, int packingSize, out bool layoutAbiStable, out bool fieldTypeHasAutoLayout)
+ private static SizeAndAlignment ComputeFieldSizeAndAlignment(TypeDesc fieldType, bool hasLayout, int packingSize, out bool layoutAbiStable, out bool fieldTypeHasAutoLayout, out bool fieldTypeHasInt128Field)
{
SizeAndAlignment result;
layoutAbiStable = true;
fieldTypeHasAutoLayout = true;
+ fieldTypeHasInt128Field = false;
if (fieldType.IsDefType)
{
@@ -817,6 +831,7 @@ namespace Internal.TypeSystem
result.Alignment = defType.InstanceFieldAlignment;
layoutAbiStable = defType.LayoutAbiStable;
fieldTypeHasAutoLayout = defType.IsAutoLayoutOrHasAutoLayoutFields;
+ fieldTypeHasInt128Field = defType.IsInt128OrHasInt128Fields;
}
else
{
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs
index 658302d0faa..b70749272b0 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs
@@ -434,6 +434,12 @@ namespace Internal.TypeSystem.Interop
return MarshallerKind.Invalid;
}
+ if (!isField && InteropTypes.IsInt128Type(context, type))
+ {
+ // Int128 types cannot be passed by value
+ return MarshallerKind.Invalid;
+ }
+
if (isBlittable)
{
if (nativeType != NativeTypeKind.Default && nativeType != NativeTypeKind.Struct)
@@ -887,7 +893,7 @@ namespace Internal.TypeSystem.Interop
else if (underlyingType.IsValueType)
{
var defType = (DefType)underlyingType;
- if (!defType.ContainsGCPointers && !defType.IsAutoLayoutOrHasAutoLayoutFields)
+ if (!defType.ContainsGCPointers && !defType.IsAutoLayoutOrHasAutoLayoutFields && !defType.IsInt128OrHasInt128Fields)
{
return MarshallerKind.BlittableValue;
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs b/src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs
index f69879a10ee..e6a684ba82e 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs
@@ -137,6 +137,11 @@ namespace Internal.TypeSystem.Interop
return IsCoreNamedType(context, type, "System.Runtime.Intrinsics", "Vector64`1");
}
+ public static bool IsInt128Type(TypeSystemContext context, TypeDesc type)
+ {
+ return IsCoreNamedType(context, type, "System", "Int128") || IsCoreNamedType(context, type, "System", "UInt128");
+ }
+
public static bool IsSystemRuntimeIntrinsicsVector128T(TypeSystemContext context, TypeDesc type)
{
return IsCoreNamedType(context, type, "System.Runtime.Intrinsics", "Vector128`1");
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/CompilerGeneratedNames.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/CompilerGeneratedNames.cs
index c41d5fa11d7..90584110173 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/CompilerGeneratedNames.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/CompilerGeneratedNames.cs
@@ -36,6 +36,19 @@ namespace ILCompiler.Dataflow
return typeName.Length > i + 1 && typeName[i + 1] == 'd';
}
+ internal static bool IsStateMachineCurrentField(string fieldName)
+ {
+ if (!IsGeneratedMemberName(fieldName))
+ return false;
+
+ int i = fieldName.LastIndexOf('>');
+ if (i == -1)
+ return false;
+
+ // Current field is <>2__current
+ return fieldName.Length > i + 1 && fieldName[i + 1] == '2';
+ }
+
internal static bool IsGeneratedType(string name) => IsStateMachineType(name) || IsLambdaDisplayClass(name);
internal static bool IsLambdaOrLocalFunction(string methodName) => IsLambdaMethod(methodName) || IsLocalFunction(methodName);
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/CompilerGeneratedState.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/CompilerGeneratedState.cs
index 6b6c6e36cd6..c62233bd957 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/CompilerGeneratedState.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/CompilerGeneratedState.cs
@@ -500,10 +500,17 @@ namespace ILCompiler.Dataflow
public static bool IsHoistedLocal(FieldDesc field)
{
- // Treat all fields on compiler-generated types as hoisted locals.
- // This avoids depending on the name mangling scheme for hoisted locals.
- var declaringTypeName = field.OwningType.Name;
- return CompilerGeneratedNames.IsLambdaDisplayClass(declaringTypeName) || CompilerGeneratedNames.IsStateMachineType(declaringTypeName);
+ if (CompilerGeneratedNames.IsLambdaDisplayClass(field.OwningType.Name))
+ return true;
+
+ if (CompilerGeneratedNames.IsStateMachineType(field.OwningType.Name))
+ {
+ // Don't track the "current" field which is used for state machine return values,
+ // because this can be expensive to track.
+ return !CompilerGeneratedNames.IsStateMachineCurrentField(field.Name);
+ }
+
+ return false;
}
// "Nested function" refers to lambdas and local functions.
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReferenceSource/CompilerGeneratedNames.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReferenceSource/CompilerGeneratedNames.cs
index 46e6c976478..afdb716f5af 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReferenceSource/CompilerGeneratedNames.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReferenceSource/CompilerGeneratedNames.cs
@@ -34,6 +34,19 @@ namespace Mono.Linker.Dataflow
return typeName.Length > i + 1 && typeName[i + 1] == 'd';
}
+ internal static bool IsStateMachineCurrentField (string fieldName)
+ {
+ if (!IsGeneratedMemberName (fieldName))
+ return false;
+
+ int i = fieldName.LastIndexOf ('>');
+ if (i == -1)
+ return false;
+
+ // Current field is <>2__current
+ return fieldName.Length > i + 1 && fieldName[i + 1] == '2';
+ }
+
internal static bool IsGeneratedType (string name) => IsStateMachineType (name) || IsLambdaDisplayClass (name);
internal static bool IsLambdaOrLocalFunction (string methodName) => IsLambdaMethod (methodName) || IsLocalFunction (methodName);
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReferenceSource/CompilerGeneratedState.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReferenceSource/CompilerGeneratedState.cs
index 3213f49fdc4..3033cef7015 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReferenceSource/CompilerGeneratedState.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReferenceSource/CompilerGeneratedState.cs
@@ -55,10 +55,16 @@ namespace Mono.Linker.Dataflow
public static bool IsHoistedLocal (FieldDefinition field)
{
- // Treat all fields on compiler-generated types as hoisted locals.
- // This avoids depending on the name mangling scheme for hoisted locals.
- var declaringTypeName = field.DeclaringType.Name;
- return CompilerGeneratedNames.IsLambdaDisplayClass (declaringTypeName) || CompilerGeneratedNames.IsStateMachineType (declaringTypeName);
+ if (CompilerGeneratedNames.IsLambdaDisplayClass (field.DeclaringType.Name))
+ return true;
+
+ if (CompilerGeneratedNames.IsStateMachineType (field.DeclaringType.Name)) {
+ // Don't track the "current" field which is used for state machine return values,
+ // because this can be expensive to track.
+ return !CompilerGeneratedNames.IsStateMachineCurrentField (field.Name);
+ }
+
+ return false;
}
// "Nested function" refers to lambdas and local functions.
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logger.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logger.cs
index 0482731b043..fac33d4b58c 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logger.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logger.cs
@@ -26,6 +26,7 @@ namespace ILCompiler
private readonly CompilerGeneratedState _compilerGeneratedState;
private readonly HashSet<int> _suppressedWarnings;
+ private readonly HashSet<string> _suppressedCategories;
private readonly bool _isSingleWarn;
private readonly HashSet<string> _singleWarnEnabledAssemblies;
@@ -44,7 +45,8 @@ namespace ILCompiler
IEnumerable<int> suppressedWarnings,
bool singleWarn,
IEnumerable<string> singleWarnEnabledModules,
- IEnumerable<string> singleWarnDisabledModules)
+ IEnumerable<string> singleWarnDisabledModules,
+ IEnumerable<string> suppressedCategories)
{
_logWriter = writer;
_compilerGeneratedState = ilProvider == null ? null : new CompilerGeneratedState(ilProvider, this);
@@ -53,15 +55,16 @@ namespace ILCompiler
_isSingleWarn = singleWarn;
_singleWarnEnabledAssemblies = new HashSet<string>(singleWarnEnabledModules, StringComparer.OrdinalIgnoreCase);
_singleWarnDisabledAssemblies = new HashSet<string>(singleWarnDisabledModules, StringComparer.OrdinalIgnoreCase);
+ _suppressedCategories = new HashSet<string>(suppressedCategories, StringComparer.Ordinal);
}
- public Logger(TextWriter writer, ILProvider ilProvider, bool isVerbose, IEnumerable<int> suppressedWarnings, bool singleWarn, IEnumerable<string> singleWarnEnabledModules, IEnumerable<string> singleWarnDisabledModules)
- : this(new TextLogWriter(writer), ilProvider, isVerbose, suppressedWarnings, singleWarn, singleWarnEnabledModules, singleWarnDisabledModules)
+ public Logger(TextWriter writer, ILProvider ilProvider, bool isVerbose, IEnumerable<int> suppressedWarnings, bool singleWarn, IEnumerable<string> singleWarnEnabledModules, IEnumerable<string> singleWarnDisabledModules, IEnumerable<string> suppressedCategories)
+ : this(new TextLogWriter(writer), ilProvider, isVerbose, suppressedWarnings, singleWarn, singleWarnEnabledModules, singleWarnDisabledModules, suppressedCategories)
{
}
public Logger(ILogWriter writer, ILProvider ilProvider, bool isVerbose)
- : this(writer, ilProvider, isVerbose, Array.Empty<int>(), singleWarn: false, Array.Empty<string>(), Array.Empty<string>())
+ : this(writer, ilProvider, isVerbose, Array.Empty<int>(), singleWarn: false, Array.Empty<string>(), Array.Empty<string>(), Array.Empty<string>())
{
}
@@ -141,6 +144,8 @@ namespace ILCompiler
public void LogError(TypeSystemEntity origin, DiagnosticId id, params string[] args) =>
LogError(new MessageOrigin(origin), id, args);
+ internal bool IsWarningSubcategorySuppressed(string category) => _suppressedCategories.Contains(category);
+
internal bool IsWarningSuppressed(int code, MessageOrigin origin)
{
// This is causing too much noise
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs
index 25d849a46de..8f6e4f33efd 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageContainer.cs
@@ -125,6 +125,9 @@ namespace ILCompiler.Logging
if (context.IsWarningSuppressed(code, origin))
return null;
+ if (context.IsWarningSubcategorySuppressed(subcategory))
+ return null;
+
if (TryLogSingleWarning(context, code, origin, subcategory))
return null;
@@ -139,6 +142,9 @@ namespace ILCompiler.Logging
if (context.IsWarningSuppressed((int)id, origin))
return null;
+ if (context.IsWarningSubcategorySuppressed(subcategory))
+ return null;
+
if (TryLogSingleWarning(context, (int)id, origin, subcategory))
return null;
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ArchitectureSpecificFieldLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ArchitectureSpecificFieldLayoutTests.cs
index a55aa430f2f..f9fe3b76874 100644
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ArchitectureSpecificFieldLayoutTests.cs
+++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ArchitectureSpecificFieldLayoutTests.cs
@@ -19,9 +19,16 @@ namespace TypeSystemTests
ModuleDesc _testModuleX86;
TestTypeSystemContext _contextX64;
ModuleDesc _testModuleX64;
+ TestTypeSystemContext _contextX64Windows;
+ ModuleDesc _testModuleX64Windows;
+ TestTypeSystemContext _contextX64Linux;
+ ModuleDesc _testModuleX64Linux;
TestTypeSystemContext _contextARM;
ModuleDesc _testModuleARM;
+ TestTypeSystemContext _contextARM64;
+ ModuleDesc _testModuleARM64;
+
public ArchitectureSpecificFieldLayoutTests()
{
_contextX64 = new TestTypeSystemContext(TargetArchitecture.X64);
@@ -30,6 +37,18 @@ namespace TypeSystemTests
_testModuleX64 = systemModuleX64;
+ _contextX64Linux = new TestTypeSystemContext(TargetArchitecture.X64, TargetOS.Linux);
+ var systemModuleX64Linux = _contextX64Linux.CreateModuleForSimpleName("CoreTestAssembly");
+ _contextX64Linux.SetSystemModule(systemModuleX64Linux);
+
+ _testModuleX64Linux = systemModuleX64Linux;
+
+ _contextX64Windows = new TestTypeSystemContext(TargetArchitecture.X64, TargetOS.Windows);
+ var systemModuleX64Windows = _contextX64Windows.CreateModuleForSimpleName("CoreTestAssembly");
+ _contextX64Windows.SetSystemModule(systemModuleX64Windows);
+
+ _testModuleX64Windows = systemModuleX64Windows;
+
_contextARM = new TestTypeSystemContext(TargetArchitecture.ARM);
var systemModuleARM = _contextARM.CreateModuleForSimpleName("CoreTestAssembly");
_contextARM.SetSystemModule(systemModuleARM);
@@ -41,6 +60,12 @@ namespace TypeSystemTests
_contextX86.SetSystemModule(systemModuleX86);
_testModuleX86 = systemModuleX86;
+
+ _contextARM64 = new TestTypeSystemContext(TargetArchitecture.ARM64);
+ var systemModuleARM64 = _contextARM64.CreateModuleForSimpleName("CoreTestAssembly");
+ _contextARM64.SetSystemModule(systemModuleARM64);
+
+ _testModuleARM64 = systemModuleARM64;
}
[Fact]
@@ -476,5 +501,54 @@ namespace TypeSystemTests
Assert.Equal(alignment[2], tX86.GetField("fld2").Offset.AsInt);
}
+ [Theory]
+ [InlineData("StructStructByte_Int128StructAuto", "ARM64", 16, 32)]
+ [InlineData("StructStructByte_Int128StructAuto", "ARM", 8, 24)]
+ [InlineData("StructStructByte_Int128StructAuto", "X86", 16, 32)]
+ [InlineData("StructStructByte_Int128StructAuto", "X64Linux", 16, 32)]
+ [InlineData("StructStructByte_Int128StructAuto", "X64Windows", 16, 32)]
+ [InlineData("StructStructByte_UInt128StructAuto", "ARM64", 16, 32)]
+ [InlineData("StructStructByte_UInt128StructAuto", "ARM", 8, 24)]
+ [InlineData("StructStructByte_UInt128StructAuto", "X86", 16, 32)]
+ [InlineData("StructStructByte_UInt128StructAuto", "X64Linux", 16, 32)]
+ [InlineData("StructStructByte_UInt128StructAuto", "X64Windows", 16, 32)]
+ // Variation of TestAlignmentBehavior_AutoAlignmentRules above that is able to deal with os specific behavior
+ public void TestAlignmentBehavior_AutoAlignmentRulesWithOSDependence(string wrapperType, string osArch, int alignment, int size)
+ {
+ ModuleDesc testModule;
+ switch (osArch)
+ {
+ case "ARM64":
+ testModule = _testModuleARM64;
+ break;
+ case "ARM":
+ testModule = _testModuleARM;
+ break;
+ case "X64":
+ testModule = _testModuleX64;
+ break;
+ case "X64Linux":
+ testModule = _testModuleX64Linux;
+ break;
+ case "X64Windows":
+ testModule = _testModuleX64Windows;
+ break;
+ case "X86":
+ testModule = _testModuleX86;
+ break;
+ default:
+ throw new Exception();
+ }
+
+ string _namespace = "Sequential";
+ string _type = wrapperType;
+
+ MetadataType type = testModule.GetType(_namespace, _type);
+
+ Assert.Equal(alignment, type.InstanceFieldAlignment.AsInt);
+ Assert.Equal(size, type.InstanceFieldSize.AsInt);
+ Assert.Equal(0x0, type.GetField("fld1").Offset.AsInt);
+ Assert.Equal(alignment, type.GetField("fld2").Offset.AsInt);
+ }
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InstanceFieldLayout.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InstanceFieldLayout.cs
index c360958375e..92446b5770e 100644
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InstanceFieldLayout.cs
+++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InstanceFieldLayout.cs
@@ -212,6 +212,18 @@ namespace Sequential
public StructByte fld1;
public Auto.Struct9Bytes fld2;
}
+
+ public struct StructStructByte_Int128StructAuto
+ {
+ public StructByte fld1;
+ public Auto.Int128Struct fld2;
+ }
+
+ public struct StructStructByte_UInt128StructAuto
+ {
+ public StructByte fld1;
+ public Auto.UInt128Struct fld2;
+ }
}
namespace Auto
@@ -417,6 +429,18 @@ namespace Auto
public byte fld8;
public byte fld9;
}
+
+ [StructLayout(LayoutKind.Auto)]
+ public struct UInt128Struct
+ {
+ UInt128 fld1;
+ }
+
+ [StructLayout(LayoutKind.Auto)]
+ public struct Int128Struct
+ {
+ Int128 fld1;
+ }
}
namespace IsByRefLike
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs
index d9602770b92..6935dd75d92 100644
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs
+++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs
@@ -73,6 +73,24 @@ namespace System
private readonly ref byte _value;
private readonly RuntimeTypeHandle _typeHandle;
}
+
+ [Intrinsic]
+ [StructLayout(LayoutKind.Sequential)]
+ public readonly struct Int128
+ {
+
+ private readonly ulong _lower;
+ private readonly ulong _upper;
+ }
+
+ [Intrinsic]
+ [StructLayout(LayoutKind.Sequential)]
+ public readonly struct UInt128
+ {
+
+ private readonly ulong _lower;
+ private readonly ulong _upper;
+ }
}
namespace System.Collections
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILCompiler.TypeSystem.Tests.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILCompiler.TypeSystem.Tests.csproj
index 444ce230f3f..1f6b33ff18b 100644
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILCompiler.TypeSystem.Tests.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILCompiler.TypeSystem.Tests.csproj
@@ -47,6 +47,7 @@
<Compile Include="../../Common/TypeSystem/Interop/InteropTypes.cs" Link="TypeSystem/Interop/InteropTypes.cs" />
<Compile Include="../../Common/TypeSystem/IL/HelperExtensions.cs" Link="TypeSystem/IL/HelperExtensions" />
<Compile Include="../../Common/Compiler/VectorFieldLayoutAlgorithm.cs" Link="Compiler/VectorFieldLayoutAlgorithm.cs" />
+ <Compile Include="../../Common/Compiler/Int128FieldLayoutAlgorithm.cs" Link="Compiler/Int128FieldLayoutAlgorithm.cs" />
<Compile Include="ArchitectureSpecificFieldLayoutTests.cs" />
<Compile Include="CanonicalizationTests.cs" />
<Compile Include="ConstraintsValidationTest.cs" />
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestTypeSystemContext.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestTypeSystemContext.cs
index 4842df691df..3f963c24104 100644
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestTypeSystemContext.cs
+++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestTypeSystemContext.cs
@@ -24,6 +24,8 @@ namespace TypeSystemTests
Dictionary<string, ModuleDesc> _modules = new Dictionary<string, ModuleDesc>(StringComparer.OrdinalIgnoreCase);
private VectorFieldLayoutAlgorithm _vectorFieldLayoutAlgorithm;
+ private Int128FieldLayoutAlgorithm _int128FieldLayoutAlgorithm;
+
MetadataFieldLayoutAlgorithm _metadataFieldLayout = new TestMetadataFieldLayoutAlgorithm();
MetadataRuntimeInterfacesAlgorithm _metadataRuntimeInterfacesAlgorithm = new MetadataRuntimeInterfacesAlgorithm();
ArrayOfTRuntimeInterfacesAlgorithm _arrayOfTRuntimeInterfacesAlgorithm;
@@ -31,10 +33,11 @@ namespace TypeSystemTests
public CanonicalizationMode CanonMode { get; set; } = CanonicalizationMode.RuntimeDetermined;
- public TestTypeSystemContext(TargetArchitecture arch)
- : base(new TargetDetails(arch, TargetOS.Unknown, TargetAbi.Unknown))
+ public TestTypeSystemContext(TargetArchitecture arch, TargetOS targetOS = TargetOS.Unknown)
+ : base(new TargetDetails(arch, targetOS, TargetAbi.Unknown))
{
_vectorFieldLayoutAlgorithm = new VectorFieldLayoutAlgorithm(_metadataFieldLayout, true);
+ _int128FieldLayoutAlgorithm = new Int128FieldLayoutAlgorithm(_metadataFieldLayout);
}
public ModuleDesc GetModuleForSimpleName(string simpleName)
@@ -74,6 +77,10 @@ namespace TypeSystemTests
{
return _vectorFieldLayoutAlgorithm;
}
+ else if (Int128FieldLayoutAlgorithm.IsIntegerType(type))
+ {
+ return _int128FieldLayoutAlgorithm;
+ }
return _metadataFieldLayout;
}
diff --git a/src/coreclr/tools/aot/ILCompiler/Program.cs b/src/coreclr/tools/aot/ILCompiler/Program.cs
index f33053fc898..f3c064835d8 100644
--- a/src/coreclr/tools/aot/ILCompiler/Program.cs
+++ b/src/coreclr/tools/aot/ILCompiler/Program.cs
@@ -15,9 +15,11 @@ using Internal.TypeSystem.Ecma;
using Internal.CommandLine;
+using ILCompiler.Dataflow;
+using ILLink.Shared;
+
using Debug = System.Diagnostics.Debug;
using InstructionSet = Internal.JitInterface.InstructionSet;
-using ILCompiler.Dataflow;
namespace ILCompiler
{
@@ -103,6 +105,8 @@ namespace ILCompiler
private IReadOnlyList<string> _singleWarnEnabledAssemblies = Array.Empty<string>();
private IReadOnlyList<string> _singleWarnDisabledAssemblies = Array.Empty<string>();
private bool _singleWarn;
+ private bool _noTrimWarn;
+ private bool _noAotWarn;
private string _makeReproPath;
@@ -228,6 +232,8 @@ namespace ILCompiler
syntax.DefineOption("nopreinitstatics", ref _noPreinitStatics, "Do not interpret static constructors at compile time");
syntax.DefineOptionList("nowarn", ref _suppressedWarnings, "Disable specific warning messages");
syntax.DefineOption("singlewarn", ref _singleWarn, "Generate single AOT/trimming warning per assembly");
+ syntax.DefineOption("notrimwarn", ref _noTrimWarn, "Disable warnings related to trimming");
+ syntax.DefineOption("noaotwarn", ref _noAotWarn, "Disable warnings related to AOT");
syntax.DefineOptionList("singlewarnassembly", ref _singleWarnEnabledAssemblies, "Generate single AOT/trimming warning for given assembly");
syntax.DefineOptionList("nosinglewarnassembly", ref _singleWarnDisabledAssemblies, "Expand AOT/trimming warnings for given assembly");
syntax.DefineOptionList("directpinvoke", ref _directPInvokes, "PInvoke to call directly");
@@ -768,7 +774,13 @@ namespace ILCompiler
}
ilProvider = new FeatureSwitchManager(ilProvider, featureSwitches);
- var logger = new Logger(Console.Out, ilProvider, _isVerbose, ProcessWarningCodes(_suppressedWarnings), _singleWarn, _singleWarnEnabledAssemblies, _singleWarnDisabledAssemblies);
+ var suppressedWarningCategories = new List<string>();
+ if (_noTrimWarn)
+ suppressedWarningCategories.Add(MessageSubCategory.TrimAnalysis);
+ if (_noAotWarn)
+ suppressedWarningCategories.Add(MessageSubCategory.AotAnalysis);
+
+ var logger = new Logger(Console.Out, ilProvider, _isVerbose, ProcessWarningCodes(_suppressedWarnings), _singleWarn, _singleWarnEnabledAssemblies, _singleWarnDisabledAssemblies, suppressedWarningCategories);
CompilerGeneratedState compilerGeneratedState = new CompilerGeneratedState(ilProvider, logger);
var stackTracePolicy = _emitStackTraceData ?
diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj
index 8696352abc0..0d50278228a 100644
--- a/src/coreclr/tools/aot/crossgen2/crossgen2.csproj
+++ b/src/coreclr/tools/aot/crossgen2/crossgen2.csproj
@@ -7,6 +7,10 @@
<!-- Can't use NativeAOT in source build yet https://github.com/dotnet/runtime/issues/66859 and we
don't want to ship using NativeAOT on MacOS -->
<NativeAotSupported Condition="'$(DotNetBuildFromSource)' == 'true' or '$(TargetOS)' == 'osx'">false</NativeAotSupported>
+
+ <!-- Work around https://github.com/dotnet/runtime/issues/72645 -->
+ <NativeAotSupported Condition="'$(TargetArchitecture)' == 'arm64'">false</NativeAotSupported>
+
<!-- Trimming is not currently working, but set the appropriate feature flags for NativeAOT -->
<PublishTrimmed Condition="'$(NativeAotSupported)' == 'true'">true</PublishTrimmed>
<RuntimeIdentifiers Condition="'$(RunningPublish)' != 'true' and '$(DotNetBuildFromSource)' != 'true'">linux-x64;linux-musl-x64;linux-arm;linux-musl-arm;linux-arm64;linux-musl-arm64;freebsd-x64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64;win-arm</RuntimeIdentifiers>
diff --git a/src/coreclr/vm/class.h b/src/coreclr/vm/class.h
index 1fc909efe9c..22ef2b9919c 100644
--- a/src/coreclr/vm/class.h
+++ b/src/coreclr/vm/class.h
@@ -376,7 +376,9 @@ class EEClassLayoutInfo
// The size of the struct is explicitly specified in the meta-data.
e_HAS_EXPLICIT_SIZE = 0x08,
// The type recursively has a field that is LayoutKind.Auto and not an enum.
- e_HAS_AUTO_LAYOUT_FIELD_IN_LAYOUT = 0x10
+ e_HAS_AUTO_LAYOUT_FIELD_IN_LAYOUT = 0x10,
+ // Type type recursively has a field which is an Int128
+ e_IS_OR_HAS_INT128_FIELD = 0x20,
};
BYTE m_bFlags;
@@ -426,6 +428,12 @@ class EEClassLayoutInfo
return (m_bFlags & e_HAS_AUTO_LAYOUT_FIELD_IN_LAYOUT) == e_HAS_AUTO_LAYOUT_FIELD_IN_LAYOUT;
}
+ BOOL IsInt128OrHasInt128Fields() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_bFlags & e_IS_OR_HAS_INT128_FIELD) == e_IS_OR_HAS_INT128_FIELD;
+ }
+
BYTE GetPackingSize() const
{
LIMITED_METHOD_CONTRACT;
@@ -467,6 +475,13 @@ class EEClassLayoutInfo
m_bFlags = hasAutoLayoutField ? (m_bFlags | e_HAS_AUTO_LAYOUT_FIELD_IN_LAYOUT)
: (m_bFlags & ~e_HAS_AUTO_LAYOUT_FIELD_IN_LAYOUT);
}
+
+ void SetIsInt128OrHasInt128Fields(BOOL hasInt128Field)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_bFlags = hasInt128Field ? (m_bFlags | e_IS_OR_HAS_INT128_FIELD)
+ : (m_bFlags & ~e_IS_OR_HAS_INT128_FIELD);
+ }
};
//
@@ -1410,6 +1425,9 @@ public:
BOOL HasExplicitSize();
BOOL IsAutoLayoutOrHasAutoLayoutField();
+
+ // Only accurate on non-auto layout types
+ BOOL IsInt128OrHasInt128Fields();
static void GetBestFitMapping(MethodTable * pMT, BOOL *pfBestFitMapping, BOOL *pfThrowOnUnmappableChar);
@@ -2105,6 +2123,15 @@ inline BOOL EEClass::IsAutoLayoutOrHasAutoLayoutField()
return !HasLayout() || GetLayoutInfo()->HasAutoLayoutField();
}
+inline BOOL EEClass::IsInt128OrHasInt128Fields()
+{
+ // The name of this type is a slight misnomer as it doesn't detect Int128 fields on
+ // auto layout types, but since we only need this for interop scenarios, it works out.
+ LIMITED_METHOD_CONTRACT;
+ // If this type is not auto
+ return HasLayout() && GetLayoutInfo()->IsInt128OrHasInt128Fields();
+}
+
//==========================================================================
// These routines manage the prestub (a bootstrapping stub that all
// FunctionDesc's are initialized with.)
diff --git a/src/coreclr/vm/classlayoutinfo.cpp b/src/coreclr/vm/classlayoutinfo.cpp
index 34b04dcd6f7..a37d7a06521 100644
--- a/src/coreclr/vm/classlayoutinfo.cpp
+++ b/src/coreclr/vm/classlayoutinfo.cpp
@@ -328,6 +328,16 @@ namespace
return FALSE;
}
+ BOOL TypeHasInt128Field(CorElementType corElemType, TypeHandle pNestedType)
+ {
+ if (corElemType == ELEMENT_TYPE_VALUETYPE)
+ {
+ _ASSERTE(!pNestedType.IsNull());
+ return pNestedType.GetMethodTable()->IsInt128OrHasInt128Fields();
+ }
+ return FALSE;
+ }
+
#ifdef UNIX_AMD64_ABI
void SystemVAmd64CheckForPassNativeStructInRegister(MethodTable* pMT, EEClassNativeLayoutInfo* pNativeLayoutInfo)
{
@@ -454,6 +464,7 @@ namespace
const SigTypeContext* pTypeContext,
BOOL* fDisqualifyFromManagedSequential,
BOOL* fHasAutoLayoutField,
+ BOOL* fHasInt128Field,
LayoutRawFieldInfo* pFieldInfoArrayOut,
BOOL* pIsBlittableOut,
ULONG* cInstanceFields
@@ -532,6 +543,7 @@ namespace
pFieldInfoArrayOut->m_placement = GetFieldPlacementInfo(corElemType, typeHandleMaybe);
*fDisqualifyFromManagedSequential |= TypeHasGCPointers(corElemType, typeHandleMaybe);
*fHasAutoLayoutField |= TypeHasAutoLayoutField(corElemType, typeHandleMaybe);
+ *fHasInt128Field |= TypeHasInt128Field(corElemType, typeHandleMaybe);
if (!IsFieldBlittable(pModule, fd, fsig.GetArgProps(), pTypeContext, nativeTypeFlags))
*pIsBlittableOut = FALSE;
@@ -625,6 +637,7 @@ VOID EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing(
// function exits.
BOOL fDisqualifyFromManagedSequential;
BOOL hasAutoLayoutField = FALSE;
+ BOOL hasInt128Field = FALSE;
// Check if this type might be ManagedSequential. Only valuetypes marked Sequential can be
// ManagedSequential. Other issues checked below might also disqualify the type.
@@ -639,9 +652,12 @@ VOID EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing(
fDisqualifyFromManagedSequential = TRUE;
}
- if (pParentMT && !pParentMT->IsValueTypeClass() && pParentMT->IsAutoLayoutOrHasAutoLayoutField())
+ if (pParentMT && !pParentMT->IsValueTypeClass())
{
- hasAutoLayoutField = TRUE;
+ if (pParentMT->IsAutoLayoutOrHasAutoLayoutField())
+ hasAutoLayoutField = TRUE;
+ if (pParentMT->IsInt128OrHasInt128Fields())
+ hasInt128Field = TRUE;
}
@@ -692,6 +708,7 @@ VOID EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing(
pTypeContext,
&fDisqualifyFromManagedSequential,
&hasAutoLayoutField,
+ &hasInt128Field,
pInfoArrayOut,
&isBlittable,
&cInstanceFields
@@ -706,6 +723,8 @@ VOID EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing(
pEEClassLayoutInfoOut->SetHasAutoLayoutField(hasAutoLayoutField);
+ pEEClassLayoutInfoOut->SetIsInt128OrHasInt128Fields(hasInt128Field);
+
S_UINT32 cbSortArraySize = S_UINT32(cTotalFields) * S_UINT32(sizeof(LayoutRawFieldInfo*));
if (cbSortArraySize.IsOverflow())
{
diff --git a/src/coreclr/vm/dllimport.cpp b/src/coreclr/vm/dllimport.cpp
index 23948003544..de49ed7b178 100644
--- a/src/coreclr/vm/dllimport.cpp
+++ b/src/coreclr/vm/dllimport.cpp
@@ -3326,6 +3326,12 @@ BOOL NDirect::MarshalingRequired(
{
TypeHandle hndArgType = arg.GetTypeHandleThrowing(pModule, &emptyTypeContext);
+ if (hndArgType.GetMethodTable()->IsInt128OrHasInt128Fields())
+ {
+ // Int128 cannot be marshalled by value at this time
+ return TRUE;
+ }
+
// When the runtime runtime marshalling system is disabled, we don't support
// any types that contain gc pointers, but all "unmanaged" types are treated as blittable
// as long as they aren't auto-layout and don't have any auto-layout fields.
diff --git a/src/coreclr/vm/methodtable.h b/src/coreclr/vm/methodtable.h
index 515cc554b4f..07792d5fbf3 100644
--- a/src/coreclr/vm/methodtable.h
+++ b/src/coreclr/vm/methodtable.h
@@ -1487,6 +1487,9 @@ public:
inline BOOL IsAutoLayoutOrHasAutoLayoutField();
+ // Only accurate on types which are not auto layout
+ inline BOOL IsInt128OrHasInt128Fields();
+
UINT32 GetNativeSize();
DWORD GetBaseSize()
diff --git a/src/coreclr/vm/methodtable.inl b/src/coreclr/vm/methodtable.inl
index adcdbd33469..8f8f8178e26 100644
--- a/src/coreclr/vm/methodtable.inl
+++ b/src/coreclr/vm/methodtable.inl
@@ -949,6 +949,13 @@ inline BOOL MethodTable::IsAutoLayoutOrHasAutoLayoutField()
}
//==========================================================================================
+inline BOOL MethodTable::IsInt128OrHasInt128Fields()
+{
+ LIMITED_METHOD_CONTRACT;
+ return HasLayout() && GetClass()->IsInt128OrHasInt128Fields();
+}
+
+//==========================================================================================
inline DWORD MethodTable::GetPerInstInfoSize()
{
LIMITED_METHOD_DAC_CONTRACT;
diff --git a/src/coreclr/vm/methodtablebuilder.cpp b/src/coreclr/vm/methodtablebuilder.cpp
index ecd1e9d2291..b0c0c1ce749 100644
--- a/src/coreclr/vm/methodtablebuilder.cpp
+++ b/src/coreclr/vm/methodtablebuilder.cpp
@@ -9907,21 +9907,6 @@ void MethodTableBuilder::CheckForSystemTypes()
return;
}
-#if defined(UNIX_AMD64_ABI) || defined(TARGET_ARM64)
- else if (strcmp(nameSpace, g_SystemNS) == 0)
- {
- EEClassLayoutInfo* pLayout = pClass->GetLayoutInfo();
-
- // These types correspond to fundamental data types in the underlying ABIs:
- // * Int128: __int128
- // * UInt128: unsigned __int128
-
- if ((strcmp(name, g_Int128Name) == 0) || (strcmp(name, g_UInt128Name) == 0))
- {
- pLayout->m_ManagedLargestAlignmentRequirementOfAllMembers = 16; // sizeof(__int128)
- }
- }
-#endif // UNIX_AMD64_ABI || TARGET_ARM64
}
if (g_pNullableClass != NULL)
@@ -10005,6 +9990,30 @@ void MethodTableBuilder::CheckForSystemTypes()
{
pMT->SetInternalCorElementType (ELEMENT_TYPE_I);
}
+ else if ((strcmp(name, g_Int128Name) == 0) || (strcmp(name, g_UInt128Name) == 0))
+ {
+ EEClassLayoutInfo* pLayout = pClass->GetLayoutInfo();
+ pLayout->SetIsInt128OrHasInt128Fields(TRUE);
+#ifdef TARGET_ARM
+ // No such type exists for the Procedure Call Standard for ARM. We will default
+ // to the same alignment as __m128, which is supported by the ABI.
+
+ pLayout->m_ManagedLargestAlignmentRequirementOfAllMembers = 8;
+#elif defined(TARGET_64BIT) || defined(TARGET_X86)
+
+ // These types correspond to fundamental data types in the underlying ABIs:
+ // * Int128: __int128
+ // * UInt128: unsigned __int128
+ //
+ // This behavior matches the ABI standard on various Unix platforms
+ // On Windows, no standard for Int128 has been established yet,
+ // although applying 16 byte alignment is consistent with treatment of 128 bit SSE types
+ // even on X86
+ pLayout->m_ManagedLargestAlignmentRequirementOfAllMembers = 16; // sizeof(__int128)
+#else
+#error Unknown architecture
+#endif // TARGET_64BIT
+ }
}
else
{
diff --git a/src/coreclr/vm/mlinfo.cpp b/src/coreclr/vm/mlinfo.cpp
index 2665a46d12f..2ca3596ac92 100644
--- a/src/coreclr/vm/mlinfo.cpp
+++ b/src/coreclr/vm/mlinfo.cpp
@@ -1131,6 +1131,11 @@ namespace
*errorResIDOut = IDS_EE_BADMARSHAL_AUTOLAYOUT;
return MarshalInfo::MARSHAL_TYPE_UNKNOWN;
}
+ if (pMT->IsInt128OrHasInt128Fields())
+ {
+ *errorResIDOut = IDS_EE_BADMARSHAL_INT128_RESTRICTION;
+ return MarshalInfo::MARSHAL_TYPE_UNKNOWN;
+ }
*pMTOut = pMT;
return MarshalInfo::MARSHAL_TYPE_BLITTABLEVALUECLASS;
}
@@ -2283,6 +2288,18 @@ MarshalInfo::MarshalInfo(Module* pModule,
IfFailGoto(E_FAIL, lFail);
}
+ // * Int128: Represents the 128 bit integer ABI primitive type which requires currently unimplemented handling
+ // * UInt128: Represents the 128 bit integer ABI primitive type which requires currently unimplemented handling
+ // The field layout is correct, so field scenarios work, but these should not be passed by value as parameters
+ if (!IsFieldScenario() && !m_byref)
+ {
+ if (m_pMT->IsInt128OrHasInt128Fields())
+ {
+ m_resID = IDS_EE_BADMARSHAL_INT128_RESTRICTION;
+ IfFailGoto(E_FAIL, lFail);
+ }
+ }
+
if (!m_pMT->HasLayout())
{
m_resID = IDS_EE_BADMARSHAL_AUTOLAYOUT;
diff --git a/src/libraries/System.Runtime/tests/System/Runtime/ControlledExecutionTests.cs b/src/libraries/System.Runtime/tests/System/Runtime/ControlledExecutionTests.cs
index 469e3cfd60b..8aa28ad6652 100644
--- a/src/libraries/System.Runtime/tests/System/Runtime/ControlledExecutionTests.cs
+++ b/src/libraries/System.Runtime/tests/System/Runtime/ControlledExecutionTests.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System.Threading;
+using System.Threading.Tasks;
using Xunit;
// Disable warnings for ControlledExecution.Run
@@ -9,208 +10,312 @@ using Xunit;
namespace System.Runtime.Tests
{
- public class ControlledExecutionTests
+ public sealed class ControlledExecutionTests
{
- private bool _startedExecution, _caughtException, _finishedExecution;
+ private volatile bool _readyForCancellation;
+ private bool _caughtException, _finishedExecution;
private Exception _exception;
- private CancellationTokenSource _cts;
private volatile int _counter;
- // Tests cancellation on timeout. The ThreadAbortException must be mapped to OperationCanceledException.
+ // Tests that the Run method finishes normally if no cancellation is requested
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoRuntime), nameof(PlatformDetection.IsNotNativeAot))]
- [ActiveIssue("https://github.com/dotnet/runtime/issues/72703", TestPlatforms.AnyUnix)]
- public void CancelOnTimeout()
+ public void RunWithoutCancelling()
{
var cts = new CancellationTokenSource();
- cts.CancelAfter(200);
- RunTest(LengthyAction, cts.Token);
+ RunTest(Test, cts.Token);
+
+ Assert.True(_finishedExecution);
+ Assert.Null(_exception);
+
+ void Test()
+ {
+ _finishedExecution = true;
+ }
+ }
+
+ // Tests that a nested invocation of the Run method throws an InvalidOperationException
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoRuntime), nameof(PlatformDetection.IsNotNativeAot))]
+ public void TestNestedRunInvocation()
+ {
+ bool nestedExecution = false;
+
+ var cts = new CancellationTokenSource();
+ RunTest(Test, cts.Token);
+
+ Assert.False(nestedExecution);
+ Assert.IsType<InvalidOperationException>(_exception);
+
+ void Test()
+ {
+ ControlledExecution.Run(() => nestedExecution = true, cts.Token);
+ }
+ }
+
+ // Tests that an infinite loop may be aborted and that the ThreadAbortException is translated
+ // to an OperationCanceledException.
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoRuntime), nameof(PlatformDetection.IsNotNativeAot))]
+ public void CancelOutsideOfTryCatchFinally()
+ {
+ var cts = new CancellationTokenSource();
+ Task.Run(() => CancelWhenTestIsReady(cts));
+ RunTest(Test, cts.Token);
- Assert.True(_startedExecution);
- Assert.True(_caughtException);
Assert.False(_finishedExecution);
Assert.IsType<OperationCanceledException>(_exception);
+
+ void Test()
+ {
+ _readyForCancellation = true;
+ RunInfiniteLoop();
+ _finishedExecution = true;
+ }
}
- // Tests that catch blocks are not aborted. The action catches the ThreadAbortException and throws an exception of a different type.
+ // Tests that an infinite loop may be aborted, that the ThreadAbortException is automatically rethrown,
+ // and that it is eventually translated to an OperationCanceledException.
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoRuntime), nameof(PlatformDetection.IsNotNativeAot))]
- public void CancelOnTimeout_ThrowFromCatch()
+ public void CancelInTryAndExitCatchNormally()
{
var cts = new CancellationTokenSource();
- cts.CancelAfter(200);
- RunTest(LengthyAction_ThrowFromCatch, cts.Token);
+ Task.Run(() => CancelWhenTestIsReady(cts));
+ RunTest(Test, cts.Token);
- Assert.True(_startedExecution);
Assert.True(_caughtException);
Assert.False(_finishedExecution);
- Assert.IsType<TimeoutException>(_exception);
+ Assert.IsType<OperationCanceledException>(_exception);
+
+ void Test()
+ {
+ try
+ {
+ _readyForCancellation = true;
+ RunInfiniteLoop();
+ }
+ catch
+ {
+ // Swallow all exceptions to verify that the ThreadAbortException is automatically rethrown
+ _caughtException = true;
+ }
+
+ if (!PlatformDetection.IsWindows)
+ {
+ // Rethrowing a ThreadAbortException at the end of catch blocks is not implemented, so force it
+ // here by calling native code (https://github.com/dotnet/runtime/issues/72703).
+ Thread.Sleep(0);
+ }
+
+ _finishedExecution = true;
+ }
}
- // Tests that finally blocks are not aborted. The action throws an exception from a finally block.
+ // Tests that catch blocks are not aborted. The catch block swallows the ThreadAbortException and throws a different exception.
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoRuntime), nameof(PlatformDetection.IsNotNativeAot))]
- public void CancelOnTimeout_ThrowFromFinally()
+ public void CancelInTryAndThrowFromCatch()
{
var cts = new CancellationTokenSource();
- cts.CancelAfter(200);
- RunTest(LengthyAction_ThrowFromFinally, cts.Token);
+ Task.Run(() => CancelWhenTestIsReady(cts));
+ RunTest(Test, cts.Token);
+
+ Assert.True(_caughtException);
+ Assert.IsType<TestException>(_exception);
- Assert.True(_startedExecution);
- Assert.IsType<TimeoutException>(_exception);
+ void Test()
+ {
+ try
+ {
+ _readyForCancellation = true;
+ RunInfiniteLoop();
+ }
+ catch
+ {
+ _caughtException = true;
+ // The catch block must not be aborted
+ Thread.Sleep(200);
+ throw new TestException();
+ }
+ }
}
- // Tests that finally blocks are not aborted. The action throws an exception from a try block.
+ // Tests that finally blocks are not aborted. The finally block exits normally.
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoRuntime), nameof(PlatformDetection.IsNotNativeAot))]
- public void CancelOnTimeout_Finally()
+ public void CancelInFinallyThatSleeps()
{
var cts = new CancellationTokenSource();
- cts.CancelAfter(200);
- RunTest(LengthyAction_Finally, cts.Token);
+ Task.Run(() => CancelWhenTestIsReady(cts));
+ RunTest(Test, cts.Token);
- Assert.True(_startedExecution);
Assert.True(_finishedExecution);
- Assert.IsType<TimeoutException>(_exception);
+ Assert.IsType<TestException>(_exception);
+
+ void Test()
+ {
+ try
+ {
+ // Make sure to run the non-inlined finally
+ throw new TestException();
+ }
+ finally
+ {
+ _readyForCancellation = true;
+ WaitUntilAbortIsRequested();
+ // The finally block must not be aborted
+ Thread.Sleep(200);
+ _finishedExecution = true;
+ }
+ }
+ }
+
+ // Tests that finally blocks are not aborted. The finally block throws an exception.
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoRuntime), nameof(PlatformDetection.IsNotNativeAot))]
+ public void CancelInFinallyThatSleepsAndThrows()
+ {
+ var cts = new CancellationTokenSource();
+ Task.Run(() => CancelWhenTestIsReady(cts));
+ RunTest(Test, cts.Token);
+
+ Assert.IsType<TestException>(_exception);
+
+ void Test()
+ {
+ try
+ {
+ // Make sure to run the non-inlined finally
+ throw new Exception();
+ }
+ finally
+ {
+ _readyForCancellation = true;
+ WaitUntilAbortIsRequested();
+ // The finally block must not be aborted
+ Thread.Sleep(200);
+ throw new TestException();
+ }
+ }
}
- // Tests cancellation before calling the Run method
+ // Tests cancellation before calling the Run method. The action must never start.
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoRuntime), nameof(PlatformDetection.IsNotNativeAot))]
public void CancelBeforeRun()
{
var cts = new CancellationTokenSource();
cts.Cancel();
- Thread.Sleep(100);
- RunTest(LengthyAction, cts.Token);
+ RunTest(Test, cts.Token);
+ Assert.False(_finishedExecution);
Assert.IsType<OperationCanceledException>(_exception);
+
+ void Test()
+ {
+ _finishedExecution = true;
+ }
}
// Tests cancellation by the action itself
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoRuntime), nameof(PlatformDetection.IsNotNativeAot))]
- public void CancelItself()
+ public void CancelItselfOutsideOfTryCatchFinally()
{
- _cts = new CancellationTokenSource();
- RunTest(Action_CancelItself, _cts.Token);
+ var cts = new CancellationTokenSource();
+ RunTest(Test, cts.Token);
- Assert.True(_startedExecution);
Assert.False(_finishedExecution);
- Assert.IsType<AggregateException>(_exception);
- Assert.IsType<ThreadAbortException>(_exception.InnerException);
- }
-
- private void RunTest(Action action, CancellationToken cancellationToken)
- {
- _startedExecution = _caughtException = _finishedExecution = false;
- _exception = null;
+ // CancellationTokenSource.Cancel catches the ThreadAbortException; however, it is rethrown at the end
+ // of the catch block.
+ Assert.IsType<OperationCanceledException>(_exception);
- try
+ void Test()
{
- ControlledExecution.Run(action, cancellationToken);
- }
- catch (Exception e)
- {
- _exception = e;
+ cts.Cancel();
+ _finishedExecution = true;
}
}
- private void LengthyAction()
+ // Tests cancellation by the action itself. Finally blocks must be executed except the one that triggered cancellation.
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoRuntime), nameof(PlatformDetection.IsNotNativeAot))]
+ public void CancelItselfFromFinally()
{
- _startedExecution = true;
- // Redirection via thread suspension is supported on Windows only.
- // Make a call in the loop to allow redirection on other platforms.
- bool sleep = !PlatformDetection.IsWindows;
+ bool finishedContainingFinally = false;
- try
+ var cts = new CancellationTokenSource();
+ RunTest(Test, cts.Token);
+
+ Assert.False(finishedContainingFinally);
+ Assert.True(_finishedExecution);
+ // CancellationTokenSource.Cancel catches the ThreadAbortException and wraps it into an AggregateException
+ // at the end of the method's execution. The ThreadAbortException is not rethrown at the end of the catch
+ // block, because the Cancel method is called from a finally block.
+ Assert.IsType<AggregateException>(_exception);
+ Assert.IsType<ThreadAbortException>(_exception.InnerException);
+
+ void Test()
{
- for (_counter = 0; _counter < int.MaxValue; _counter++)
+ try
{
- if ((_counter & 0xfffff) == 0 && sleep)
+ try
+ {
+ // Make sure to run the non-inlined finally
+ throw new Exception();
+ }
+ finally
{
- Thread.Sleep(0);
+ // When cancelling itself, the containing finally block must be aborted
+ cts.Cancel();
+ finishedContainingFinally = true;
}
}
+ finally
+ {
+ _finishedExecution = true;
+ }
}
- catch
- {
- // Swallow all exceptions to verify that the exception is automatically rethrown
- _caughtException = true;
- }
-
- _finishedExecution = true;
}
- private void LengthyAction_ThrowFromCatch()
+ private void RunTest(Action action, CancellationToken cancellationToken)
{
- _startedExecution = true;
- bool sleep = !PlatformDetection.IsWindows;
+ _readyForCancellation = _caughtException = _finishedExecution = false;
+ _exception = null;
+ _counter = 0;
try
{
- for (_counter = 0; _counter < int.MaxValue; _counter++)
- {
- if ((_counter & 0xfffff) == 0 && sleep)
- {
- Thread.Sleep(0);
- }
- }
+ ControlledExecution.Run(action, cancellationToken);
}
- catch
+ catch (Exception e)
{
- _caughtException = true;
- // The catch block must not be aborted
- Thread.Sleep(100);
- throw new TimeoutException();
+ _exception = e;
}
-
- _finishedExecution = true;
}
- private void LengthyAction_ThrowFromFinally()
+ private void CancelWhenTestIsReady(CancellationTokenSource cancellationTokenSource)
{
- _startedExecution = true;
-
- try
+ // Wait until the execution is ready to be canceled
+ while (!_readyForCancellation)
{
- // Make sure to run the non-inlined finally
- throw new Exception();
- }
- finally
- {
- // The finally block must not be aborted
- Thread.Sleep(400);
- throw new TimeoutException();
+ Thread.Sleep(10);
}
+ cancellationTokenSource.Cancel();
}
- private void LengthyAction_Finally()
+ private static void WaitUntilAbortIsRequested()
{
- _startedExecution = true;
-
- try
- {
- // Make sure to run the non-inlined finally
- throw new TimeoutException();
- }
- finally
+ while ((Thread.CurrentThread.ThreadState & ThreadState.AbortRequested) == 0)
{
- // The finally block must not be aborted
- Thread.Sleep(400);
- _finishedExecution = true;
+ Thread.Sleep(10);
}
}
- private void Action_CancelItself()
+ private void RunInfiniteLoop()
{
- _startedExecution = true;
-
- try
+ while (true)
{
- // Make sure to run the non-inlined finally
- throw new TimeoutException();
- }
- finally
- {
- // The finally block must be aborted
- _cts.Cancel();
- _finishedExecution = true;
+ if ((++_counter & 0xfffff) == 0)
+ {
+ Thread.Sleep(0);
+ }
}
}
+
+ private sealed class TestException : Exception
+ {
+ }
}
}
diff --git a/src/mono/mono/mini/cpu-ppc64.mdesc b/src/mono/mono/mini/cpu-ppc64.mdesc
index d2437a34fda..77d99656d72 100644
--- a/src/mono/mono/mini/cpu-ppc64.mdesc
+++ b/src/mono/mono/mini/cpu-ppc64.mdesc
@@ -45,18 +45,18 @@
#
# See the code in mini-x86.c for more details on how the specifiers are used.
#
-tailcall: len:124 clob:c
+tailcall: len:152 clob:c
tailcall_parameter: len:0 # PowerPC outputs a nice fixed size memcpy loop for larger stack_usage, so 0.
memory_barrier: len:4
nop: len:4
relaxed_nop: len:4
-break: len:40
+break: len:44
seq_point: len:48
il_seq_point: len:0
-call: dest:a clob:c len:36
+call: dest:a clob:c len:40
br: len:4
-throw: src1:i len:40
-rethrow: src1:i len:40
+throw: src1:i len:44
+rethrow: src1:i len:44
ckfinite: dest:f src1:f
ppc_check_finite: src1:i len:16
add_ovf_carry: dest:i src1:i src2:i len:16
@@ -77,16 +77,16 @@ fcompare: src1:f src2:f len:12
arglist: src1:i len:12
setlret: src1:i src2:i len:12
check_this: src1:b len:4
-voidcall: len:36 clob:c
+voidcall: len:40 clob:c
voidcall_reg: src1:i len:16 clob:c
voidcall_membase: src1:b len:16 clob:c
-fcall: dest:g len:36 clob:c
+fcall: dest:g len:40 clob:c
fcall_reg: dest:g src1:i len:16 clob:c
fcall_membase: dest:g src1:b len:16 clob:c
-lcall: dest:a len:36 clob:c
+lcall: dest:a len:40 clob:c
lcall_reg: dest:a src1:i len:16 clob:c
lcall_membase: dest:a src1:b len:16 clob:c
-vcall: len:16 clob:c
+vcall: len:20 clob:c
vcall_reg: src1:i len:16 clob:c
vcall_membase: src1:b len:12 clob:c
call_reg: dest:a src1:i len:16 clob:c
@@ -404,7 +404,7 @@ int_max_un: dest:i src1:i src2:i len:8 clob:1
#long_conv_to_ovf_i4_2: dest:i src1:i src2:i len:30
-vcall2: len:36 clob:c
+vcall2: len:40 clob:c
vcall2_reg: src1:i len:16 clob:c
vcall2_membase: src1:b len:16 clob:c
diff --git a/src/mono/mono/mini/mini-ppc.c b/src/mono/mono/mini/mini-ppc.c
index 93abd63562f..cf8f045f992 100644
--- a/src/mono/mono/mini/mini-ppc.c
+++ b/src/mono/mono/mini/mini-ppc.c
@@ -5142,8 +5142,8 @@ mono_arch_emit_prolog (MonoCompile *cfg)
int soffset = 0;
int cur_reg;
int size = 0;
- g_assert (ppc_is_imm16 (inst->inst_offset));
- g_assert (ppc_is_imm16 (inst->inst_offset + ainfo->vtregs * sizeof (target_mgreg_t)));
+ g_assert (ppc_is_imm32 (inst->inst_offset));
+ g_assert (ppc_is_imm32 (inst->inst_offset + ainfo->vtregs * sizeof (target_mgreg_t)));
/* FIXME: what if there is no class? */
if (sig->pinvoke && !sig->marshalling_disabled && mono_class_from_mono_type_internal (inst->inst_vtype))
size = mono_class_native_size (mono_class_from_mono_type_internal (inst->inst_vtype), NULL);
@@ -5171,21 +5171,39 @@ mono_arch_emit_prolog (MonoCompile *cfg)
(sizeof (target_mgreg_t) - ainfo->bytes) * 8);
ppc_stptr (code, ppc_r0, doffset, inst->inst_basereg);
#else
- if (mono_class_native_size (inst->klass, NULL) == 1) {
- ppc_stb (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
- } else if (mono_class_native_size (inst->klass, NULL) == 2) {
- ppc_sth (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
- } else if (mono_class_native_size (inst->klass, NULL) == 4) { // WDS -- maybe <=4?
- ppc_stw (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
- } else {
- ppc_stptr (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); // WDS -- Better way?
+ if (ppc_is_imm16 (inst->inst_offset)) {
+ if (mono_class_native_size (inst->klass, NULL) == 1) {
+ ppc_stb (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
+ } else if (mono_class_native_size (inst->klass, NULL) == 2) {
+ ppc_sth (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
+ } else if (mono_class_native_size (inst->klass, NULL) == 4) { // WDS -- maybe <=4?
+ ppc_stw (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg);
+ } else {
+ ppc_stptr (code, ainfo->reg + cur_reg, doffset, inst->inst_basereg); // WDS -- Better way?
+ }
+ }
+ else if (ppc_is_imm32 (inst->inst_offset)) {
+ ppc_addis (code, ppc_r12, inst->inst_basereg, ppc_ha(doffset));
+ ppc_stptr (code, ainfo->reg + cur_reg, doffset, ppc_r12);
+ }
+ else {
+ g_assert_not_reached();
}
#endif
} else
#endif
{
- ppc_stptr (code, ainfo->reg + cur_reg, doffset,
- inst->inst_basereg);
+ if (ppc_is_imm16 (inst->inst_offset)) {
+ ppc_stptr (code, ainfo->reg + cur_reg, doffset,
+ inst->inst_basereg);
+ }
+ else if (ppc_is_imm32 (inst->inst_offset)) {
+ ppc_addis (code, ppc_r12, inst->inst_basereg, ppc_ha(doffset));
+ ppc_stptr (code, ainfo->reg + cur_reg, doffset, ppc_r12);
+ }
+ else {
+ g_assert_not_reached();
+ }
}
}
soffset += sizeof (target_mgreg_t);
diff --git a/src/tests/Interop/DisabledRuntimeMarshalling/Native_DisabledMarshalling/DisabledRuntimeMarshallingNative.cs b/src/tests/Interop/DisabledRuntimeMarshalling/Native_DisabledMarshalling/DisabledRuntimeMarshallingNative.cs
index ed9b121bef6..8a0408768a3 100644
--- a/src/tests/Interop/DisabledRuntimeMarshalling/Native_DisabledMarshalling/DisabledRuntimeMarshallingNative.cs
+++ b/src/tests/Interop/DisabledRuntimeMarshalling/Native_DisabledMarshalling/DisabledRuntimeMarshallingNative.cs
@@ -156,6 +156,9 @@ public unsafe class DisabledRuntimeMarshallingNative
[DllImport(nameof(DisabledRuntimeMarshallingNative), EntryPoint = "Invalid")]
public static extern void CallWithVarargs(__arglist);
+ [DllImport(nameof(DisabledRuntimeMarshallingNative), EntryPoint = "Invalid")]
+ public static extern void CallWithInt128(Int128 i);
+
[DllImport(nameof(DisabledRuntimeMarshallingNative))]
public static extern delegate* unmanaged<StructWithShortAndBool, short, bool, bool> GetStructWithShortAndBoolCallback();
diff --git a/src/tests/Interop/DisabledRuntimeMarshalling/PInvokeAssemblyMarshallingDisabled/PInvokes.cs b/src/tests/Interop/DisabledRuntimeMarshalling/PInvokeAssemblyMarshallingDisabled/PInvokes.cs
index 4fa7315d430..21b0716948d 100644
--- a/src/tests/Interop/DisabledRuntimeMarshalling/PInvokeAssemblyMarshallingDisabled/PInvokes.cs
+++ b/src/tests/Interop/DisabledRuntimeMarshalling/PInvokeAssemblyMarshallingDisabled/PInvokes.cs
@@ -148,4 +148,11 @@ public class PInvokes
{
Assert.Equal((byte)ByteEnum.Value, DisabledRuntimeMarshallingNative.GetEnumUnderlyingValue(ByteEnum.Value));
}
+
+ [Fact]
+ [SkipOnMono("Blocking this on CoreCLR should be good enough.")]
+ public static void Int128_NotSupported()
+ {
+ Assert.Throws<MarshalDirectiveException>(() => DisabledRuntimeMarshallingNative.CallWithInt128(default(Int128)));
+ }
}
diff --git a/src/tests/Interop/PInvoke/Int128/Int128Native.cpp b/src/tests/Interop/PInvoke/Int128/Int128Native.cpp
index 28f70bca06f..9cd68311421 100644
--- a/src/tests/Interop/PInvoke/Int128/Int128Native.cpp
+++ b/src/tests/Interop/PInvoke/Int128/Int128Native.cpp
@@ -11,14 +11,29 @@
#elif defined(__SIZEOF_INT128__)
typedef __int128 Int128;
#else
- typedef struct {
+struct
+#if defined(_M_ARM64) || defined(_M_AMD64) || defined(_M_IX86)
+alignas(16)
+#endif
+Int128 {
uint64_t lower;
uint64_t upper;
- } Int128;
+ };
#endif
static Int128 Int128Value = { };
+struct StructWithInt128
+{
+ int8_t messUpPadding;
+ Int128 value;
+};
+
+struct StructJustInt128
+{
+ Int128 value;
+};
+
extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE GetInt128(uint64_t upper, uint64_t lower)
{
Int128 result;
@@ -41,6 +56,24 @@ extern "C" DLL_EXPORT void STDMETHODCALLTYPE GetInt128Out(uint64_t upper, uint64
*pValue = value;
}
+extern "C" DLL_EXPORT uint64_t STDMETHODCALLTYPE GetInt128Lower(Int128 value)
+{
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ return (uint64_t)value;
+#else
+ return value.lower;
+#endif
+}
+
+extern "C" DLL_EXPORT uint64_t STDMETHODCALLTYPE GetInt128Lower_S(StructJustInt128 value)
+{
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ return (uint64_t)value.value;
+#else
+ return value.value.lower;
+#endif
+}
+
extern "C" DLL_EXPORT const Int128* STDMETHODCALLTYPE GetInt128Ptr(uint64_t upper, uint64_t lower)
{
GetInt128Out(upper, lower, &Int128Value);
@@ -62,6 +95,210 @@ extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE AddInt128(Int128 lhs, Int128 rhs)
return result;
}
+// Test that struct alignment behavior matches with the standard OS compiler
+extern "C" DLL_EXPORT void STDMETHODCALLTYPE AddStructWithInt128_ByRef(StructWithInt128 *pLhs, StructWithInt128 *pRhs)
+{
+ StructWithInt128 result = {};
+ StructWithInt128 lhs = *pLhs;
+ StructWithInt128 rhs = *pRhs;
+
+ result.messUpPadding = lhs.messUpPadding;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result.value = lhs.value + rhs.value;
+#else
+ result.value.lower = lhs.value.lower + rhs.value.lower;
+ uint64_t carry = (result.value.lower < lhs.value.lower) ? 1 : 0;
+ result.value.upper = lhs.value.upper + rhs.value.upper + carry;
+#endif
+
+ *pLhs = result;
+}
+
+extern "C" DLL_EXPORT StructWithInt128 STDMETHODCALLTYPE AddStructWithInt128(StructWithInt128 lhs, StructWithInt128 rhs)
+{
+ StructWithInt128 result = {};
+ result.messUpPadding = lhs.messUpPadding;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result.value = lhs.value + rhs.value;
+#else
+ result.value.lower = lhs.value.lower + rhs.value.lower;
+ uint64_t carry = (result.value.lower < lhs.value.lower) ? 1 : 0;
+ result.value.upper = lhs.value.upper + rhs.value.upper + carry;
+#endif
+
+ return result;
+}
+
+extern "C" DLL_EXPORT StructWithInt128 STDMETHODCALLTYPE AddStructWithInt128_1(int64_t dummy1, StructWithInt128 lhs, StructWithInt128 rhs)
+{
+ StructWithInt128 result = {};
+ result.messUpPadding = lhs.messUpPadding;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result.value = lhs.value + rhs.value;
+#else
+ result.value.lower = lhs.value.lower + rhs.value.lower;
+ uint64_t carry = (result.value.lower < lhs.value.lower) ? 1 : 0;
+ result.value.upper = lhs.value.upper + rhs.value.upper + carry;
+#endif
+
+ return result;
+}
+
+extern "C" DLL_EXPORT StructWithInt128 STDMETHODCALLTYPE AddStructWithInt128_9(int64_t dummy1, int64_t dummy2, int64_t dummy3, int64_t dummy4, int64_t dummy5, int64_t dummy6, int64_t dummy7, int64_t dummy8, int64_t dummy9, StructWithInt128 lhs, StructWithInt128 rhs)
+{
+ StructWithInt128 result = {};
+ result.messUpPadding = lhs.messUpPadding;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result.value = lhs.value + rhs.value;
+#else
+ result.value.lower = lhs.value.lower + rhs.value.lower;
+ uint64_t carry = (result.value.lower < lhs.value.lower) ? 1 : 0;
+ result.value.upper = lhs.value.upper + rhs.value.upper + carry;
+#endif
+
+ return result;
+}
+
+extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE AddInt128_1(int64_t dummy1, Int128 lhs, Int128 rhs)
+{
+ Int128 result;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result = lhs + rhs;
+#else
+ result.lower = lhs.lower + rhs.lower;
+ uint64_t carry = (result.lower < lhs.lower) ? 1 : 0;
+ result.upper = lhs.upper + rhs.upper + carry;
+#endif
+
+ return result;
+}
+
+extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE AddInt128_2(int64_t dummy1, int64_t dummy2, Int128 lhs, Int128 rhs)
+{
+ Int128 result;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result = lhs + rhs;
+#else
+ result.lower = lhs.lower + rhs.lower;
+ uint64_t carry = (result.lower < lhs.lower) ? 1 : 0;
+ result.upper = lhs.upper + rhs.upper + carry;
+#endif
+
+ return result;
+}
+
+extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE AddInt128_3(int64_t dummy1, int64_t dummy2, int64_t dummy3, Int128 lhs, Int128 rhs)
+{
+ Int128 result;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result = lhs + rhs;
+#else
+ result.lower = lhs.lower + rhs.lower;
+ uint64_t carry = (result.lower < lhs.lower) ? 1 : 0;
+ result.upper = lhs.upper + rhs.upper + carry;
+#endif
+
+ return result;
+}
+
+extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE AddInt128_4(int64_t dummy1, int64_t dummy2, int64_t dummy3, int64_t dummy4, Int128 lhs, Int128 rhs)
+{
+ Int128 result;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result = lhs + rhs;
+#else
+ result.lower = lhs.lower + rhs.lower;
+ uint64_t carry = (result.lower < lhs.lower) ? 1 : 0;
+ result.upper = lhs.upper + rhs.upper + carry;
+#endif
+
+ return result;
+}
+
+extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE AddInt128_5(int64_t dummy1, int64_t dummy2, int64_t dummy3, int64_t dummy4, int64_t dummy5, Int128 lhs, Int128 rhs)
+{
+ Int128 result;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result = lhs + rhs;
+#else
+ result.lower = lhs.lower + rhs.lower;
+ uint64_t carry = (result.lower < lhs.lower) ? 1 : 0;
+ result.upper = lhs.upper + rhs.upper + carry;
+#endif
+
+ return result;
+}
+
+extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE AddInt128_6(int64_t dummy1, int64_t dummy2, int64_t dummy3, int64_t dummy4, int64_t dummy5, int64_t dummy6, Int128 lhs, Int128 rhs)
+{
+ Int128 result;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result = lhs + rhs;
+#else
+ result.lower = lhs.lower + rhs.lower;
+ uint64_t carry = (result.lower < lhs.lower) ? 1 : 0;
+ result.upper = lhs.upper + rhs.upper + carry;
+#endif
+
+ return result;
+}
+
+extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE AddInt128_7(int64_t dummy1, int64_t dummy2, int64_t dummy3, int64_t dummy4, int64_t dummy5, int64_t dummy6, int64_t dummy7, Int128 lhs, Int128 rhs)
+{
+ Int128 result;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result = lhs + rhs;
+#else
+ result.lower = lhs.lower + rhs.lower;
+ uint64_t carry = (result.lower < lhs.lower) ? 1 : 0;
+ result.upper = lhs.upper + rhs.upper + carry;
+#endif
+
+ return result;
+}
+
+extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE AddInt128_8(int64_t dummy1, int64_t dummy2, int64_t dummy3, int64_t dummy4, int64_t dummy5, int64_t dummy6, int64_t dummy7, int64_t dummy8, Int128 lhs, Int128 rhs)
+{
+ Int128 result;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result = lhs + rhs;
+#else
+ result.lower = lhs.lower + rhs.lower;
+ uint64_t carry = (result.lower < lhs.lower) ? 1 : 0;
+ result.upper = lhs.upper + rhs.upper + carry;
+#endif
+
+ return result;
+}
+
+extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE AddInt128_9(int64_t dummy1, int64_t dummy2, int64_t dummy3, int64_t dummy4, int64_t dummy5, int64_t dummy6, int64_t dummy7, int64_t dummy8, int64_t dummy9, Int128 lhs, Int128 rhs)
+{
+ Int128 result;
+
+#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
+ result = lhs + rhs;
+#else
+ result.lower = lhs.lower + rhs.lower;
+ uint64_t carry = (result.lower < lhs.lower) ? 1 : 0;
+ result.upper = lhs.upper + rhs.upper + carry;
+#endif
+
+ return result;
+}
+
+
extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE AddInt128s(const Int128* pValues, uint32_t count)
{
Int128 result = {};
diff --git a/src/tests/Interop/PInvoke/Int128/Int128Test.cs b/src/tests/Interop/PInvoke/Int128/Int128Test.cs
index 5a9ddd5bb21..c6a8c378d6f 100644
--- a/src/tests/Interop/PInvoke/Int128/Int128Test.cs
+++ b/src/tests/Interop/PInvoke/Int128/Int128Test.cs
@@ -5,6 +5,20 @@ using System;
using System.Runtime.InteropServices;
using Xunit;
+
+struct StructJustInt128
+{
+ public StructJustInt128(Int128 val) { value = val; }
+ public Int128 value;
+}
+
+struct StructWithInt128
+{
+ public StructWithInt128(Int128 val) { value = val; messUpPadding = 0x10; }
+ public byte messUpPadding;
+ public Int128 value;
+}
+
unsafe partial class Int128Native
{
[DllImport(nameof(Int128Native))]
@@ -17,6 +31,15 @@ unsafe partial class Int128Native
public static extern void GetInt128Out(ulong upper, ulong lower, out Int128 value);
[DllImport(nameof(Int128Native))]
+ public static extern void GetInt128Out(ulong upper, ulong lower, out StructJustInt128 value);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern ulong GetInt128Lower_S(StructJustInt128 value);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern ulong GetInt128Lower(Int128 value);
+
+ [DllImport(nameof(Int128Native))]
public static extern Int128* GetInt128Ptr(ulong upper, ulong lower);
[DllImport(nameof(Int128Native), EntryPoint = "GetInt128Ptr")]
@@ -25,6 +48,47 @@ unsafe partial class Int128Native
[DllImport(nameof(Int128Native))]
public static extern Int128 AddInt128(Int128 lhs, Int128 rhs);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern void AddStructWithInt128_ByRef(ref StructWithInt128 lhs, ref StructWithInt128 rhs);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern StructWithInt128 AddStructWithInt128(StructWithInt128 lhs, StructWithInt128 rhs);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern StructWithInt128 AddStructWithInt128_1(long dummy1, StructWithInt128 lhs, StructWithInt128 rhs);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern StructWithInt128 AddStructWithInt128_9(long dummy1, long dummy2, long dummy3, long dummy4, long dummy5, long dummy6, long dummy7, long dummy8, long dummy9, StructWithInt128 lhs, StructWithInt128 rhs);
+
+ // Test alignment and proper register usage for Int128 with various amounts of other registers in use. These tests are designed to stress the calling convention of Arm64 and Unix X64.
+ [DllImport(nameof(Int128Native))]
+ public static extern Int128 AddInt128_1(long dummy1, Int128 lhs, Int128 rhs);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern Int128 AddInt128_2(long dummy1, long dummy2, Int128 lhs, Int128 rhs);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern Int128 AddInt128_3(long dummy1, long dummy2, long dummy3, Int128 lhs, Int128 rhs);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern Int128 AddInt128_4(long dummy1, long dummy2, long dummy3, long dummy4, Int128 lhs, Int128 rhs);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern Int128 AddInt128_5(long dummy1, long dummy2, long dummy3, long dummy4, long dummy5, Int128 lhs, Int128 rhs);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern Int128 AddInt128_6(long dummy1, long dummy2, long dummy3, long dummy4, long dummy5, long dummy6, Int128 lhs, Int128 rhs);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern Int128 AddInt128_7(long dummy1, long dummy2, long dummy3, long dummy4, long dummy5, long dummy6, long dummy7, Int128 lhs, Int128 rhs);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern Int128 AddInt128_8(long dummy1, long dummy2, long dummy3, long dummy4, long dummy5, long dummy6, long dummy7, long dummy8, Int128 lhs, Int128 rhs);
+
+ [DllImport(nameof(Int128Native))]
+ public static extern Int128 AddInt128_9(long dummy1, long dummy2, long dummy3, long dummy4, long dummy5, long dummy6, long dummy7, long dummy8, long dummy9, Int128 lhs, Int128 rhs);
+
[DllImport(nameof(Int128Native))]
public static extern Int128 AddInt128s(Int128* pValues, int count);
@@ -37,10 +101,14 @@ unsafe partial class Int128Native
unsafe partial class Int128Native
{
- private static void TestInt128()
+ public static void TestInt128FieldLayout()
{
- Int128 value1 = Int128Native.GetInt128(1, 2);
- Assert.Equal(new Int128(1, 2), value1);
+ // This test checks that the alignment rules of Int128 structs match the native compiler
+ StructWithInt128 lhs = new StructWithInt128(new Int128(11, 12));
+ StructWithInt128 rhs = new StructWithInt128(new Int128(13, 14));
+
+ Int128Native.AddStructWithInt128_ByRef(ref lhs, ref rhs);
+ Assert.Equal(new StructWithInt128(new Int128(24, 26)), lhs);
Int128 value2;
Int128Native.GetInt128Out(3, 4, &value2);
@@ -49,6 +117,28 @@ unsafe partial class Int128Native
Int128Native.GetInt128Out(5, 6, out Int128 value3);
Assert.Equal(new Int128(5, 6), value3);
+ StructJustInt128 value4;
+ Int128Native.GetInt128Out(7, 8, out value4);
+ Assert.Equal(new StructJustInt128(new Int128(7, 8)), value4);
+
+ // Until we implement the correct abi for Int128, validate that we don't marshal to native
+
+ // Checking return value
+ Assert.Throws<System.Runtime.InteropServices.MarshalDirectiveException>(() => GetInt128(0, 1));
+
+ // Checking input value as Int128 itself
+ Assert.Throws<System.Runtime.InteropServices.MarshalDirectiveException>(() => GetInt128Lower(default(Int128)));
+
+ // Checking input value as structure wrapping Int128
+ Assert.Throws<System.Runtime.InteropServices.MarshalDirectiveException>(() => GetInt128Lower_S(default(StructJustInt128)));
+ }
+
+ private static void TestInt128()
+ {
+ Int128 value1 = Int128Native.GetInt128(1, 2);
+ Assert.Equal(new Int128(1, 2), value1);
+
+
Int128* value4 = Int128Native.GetInt128Ptr(7, 8);
Assert.Equal(new Int128(7, 8), *value4);
@@ -77,5 +167,45 @@ unsafe partial class Int128Native
Int128 value9 = Int128Native.AddInt128s(in values[0], values.Length);
Assert.Equal(new Int128(95, 100), value9);
+
+ // Test ABI alignment issues on Arm64 and Unix X64, both enregistered and while spilled to the stack
+ Int128 value10 = Int128Native.AddInt128_1(1, new Int128(25, 26), new Int128(27, 28));
+ Assert.Equal(new Int128(52, 54), value10);
+
+ Int128 value11 = Int128Native.AddInt128_2(1, 2, new Int128(25, 26), new Int128(27, 28));
+ Assert.Equal(new Int128(52, 54), value11);
+
+ Int128 value12 = Int128Native.AddInt128_3(1, 2, 3, new Int128(25, 26), new Int128(27, 28));
+ Assert.Equal(new Int128(52, 54), value12);
+
+ Int128 value13 = Int128Native.AddInt128_4(1, 2, 3, 4, new Int128(25, 26), new Int128(27, 28));
+ Assert.Equal(new Int128(52, 54), value13);
+
+ Int128 value14 = Int128Native.AddInt128_5(1, 2, 3, 4, 5, new Int128(25, 26), new Int128(27, 28));
+ Assert.Equal(new Int128(52, 54), value14);
+
+ Int128 value15 = Int128Native.AddInt128_6(1, 2, 3, 4, 5, 6, new Int128(25, 26), new Int128(27, 28));
+ Assert.Equal(new Int128(52, 54), value15);
+
+ Int128 value16 = Int128Native.AddInt128_7(1, 2, 3, 4, 5, 6, 7, new Int128(25, 26), new Int128(27, 28));
+ Assert.Equal(new Int128(52, 54), value16);
+
+ Int128 value17 = Int128Native.AddInt128_8(1, 2, 3, 4, 5, 6, 7, 8, new Int128(25, 26), new Int128(27, 28));
+ Assert.Equal(new Int128(52, 54), value17);
+
+ Int128 value18 = Int128Native.AddInt128_9(1, 2, 3, 4, 5, 6, 7, 8, 9, new Int128(25, 26), new Int128(27, 28));
+ Assert.Equal(new Int128(52, 54), value18);
+
+ // Test alignment within a structure
+ StructWithInt128 value19 = Int128Native.AddStructWithInt128(new StructWithInt128(new Int128(29, 30)), new StructWithInt128(new Int128(31, 32)));
+ Assert.Equal(new StructWithInt128(new Int128(60, 62)), value19);
+
+ // Test abi register alignment within a structure
+ StructWithInt128 value20 = Int128Native.AddStructWithInt128_1(1, new StructWithInt128(new Int128(29, 30)), new StructWithInt128(new Int128(31, 32)));
+ Assert.Equal(new StructWithInt128(new Int128(60, 62)), value20);
+
+ // Test abi alignment when spilled to the stack
+ StructWithInt128 value21 = Int128Native.AddStructWithInt128_9(1, 2, 3, 4, 5, 6, 7, 8, 9, new StructWithInt128(new Int128(29, 30)), new StructWithInt128(new Int128(31, 32)));
+ Assert.Equal(new StructWithInt128(new Int128(60, 62)), value21);
}
}
diff --git a/src/tests/Interop/PInvoke/Int128/Int128Test.csproj b/src/tests/Interop/PInvoke/Int128/Int128Test.csproj
index 42fc09c10b7..e13c49fe94c 100644
--- a/src/tests/Interop/PInvoke/Int128/Int128Test.csproj
+++ b/src/tests/Interop/PInvoke/Int128/Int128Test.csproj
@@ -6,7 +6,9 @@
<OutputType>exe</OutputType>
</PropertyGroup>
<ItemGroup>
- <Compile Include="*.cs" />
+ <Compile Include="Int128Test.cs" />
+ <Compile Include="UInt128Test.cs" />
+ <Compile Include="Program.cs" />
</ItemGroup>
<ItemGroup>
<CMakeProjectReference Include="CMakeLists.txt" />
diff --git a/src/tests/Interop/PInvoke/Int128/Int128TestFieldLayout.csproj b/src/tests/Interop/PInvoke/Int128/Int128TestFieldLayout.csproj
new file mode 100644
index 00000000000..449dc00c211
--- /dev/null
+++ b/src/tests/Interop/PInvoke/Int128/Int128TestFieldLayout.csproj
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <DebugType>embedded</DebugType>
+ <OutputType>exe</OutputType>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="Int128Test.cs" />
+ <Compile Include="ProgramFieldLayout.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <CMakeProjectReference Include="CMakeLists.txt" />
+ </ItemGroup>
+</Project>
diff --git a/src/tests/Interop/PInvoke/Int128/ProgramFieldLayout.cs b/src/tests/Interop/PInvoke/Int128/ProgramFieldLayout.cs
new file mode 100644
index 00000000000..5a31288c5d3
--- /dev/null
+++ b/src/tests/Interop/PInvoke/Int128/ProgramFieldLayout.cs
@@ -0,0 +1,23 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Runtime.InteropServices;
+
+unsafe partial class Int128NativeFieldLayout
+{
+ public static int Main(string[] args)
+ {
+ try
+ {
+ Console.WriteLine("Testing Int128");
+ Int128Native.TestInt128FieldLayout();
+ }
+ catch (System.Exception ex)
+ {
+ Console.WriteLine(ex);
+ return 0;
+ }
+ return 100;
+ }
+}
diff --git a/src/tests/JIT/Stress/ABI/ABIs.cs b/src/tests/JIT/Stress/ABI/ABIs.cs
index a9c85f864aa..3ad1eed8d7c 100644
--- a/src/tests/JIT/Stress/ABI/ABIs.cs
+++ b/src/tests/JIT/Stress/ABI/ABIs.cs
@@ -47,14 +47,14 @@ namespace ABIStress
new[]
{
typeof(byte), typeof(short), typeof(int), typeof(long),
- typeof(float), typeof(double),
+ typeof(float), typeof(double), typeof(Int128),
typeof(Vector<int>), typeof(Vector128<int>), typeof(Vector256<int>),
typeof(S1P), typeof(S2P), typeof(S2U), typeof(S3U),
typeof(S4P), typeof(S4U), typeof(S5U), typeof(S6U),
typeof(S7U), typeof(S8P), typeof(S8U), typeof(S9U),
typeof(S10U), typeof(S11U), typeof(S12U), typeof(S13U),
typeof(S14U), typeof(S15U), typeof(S16U), typeof(S17U),
- typeof(S31U), typeof(S32U),
+ typeof(S31U), typeof(S32U), typeof(I128_1), typeof(I128_2)
};
public CallingConvention[] PInvokeConventions { get; } = { CallingConvention.Cdecl, CallingConvention.StdCall, };
@@ -107,12 +107,13 @@ namespace ABIStress
typeof(byte), typeof(short), typeof(int), typeof(long),
typeof(float), typeof(double),
typeof(Vector<int>), typeof(Vector128<int>), typeof(Vector256<int>),
+ typeof(Int128),
typeof(S1P), typeof(S2P), typeof(S2U), typeof(S3U),
typeof(S4P), typeof(S4U), typeof(S5U), typeof(S6U),
typeof(S7U), typeof(S8P), typeof(S8U), typeof(S9U),
typeof(S10U), typeof(S11U), typeof(S12U), typeof(S13U),
typeof(S14U), typeof(S15U), typeof(S16U), typeof(S17U),
- typeof(S31U), typeof(S32U),
+ typeof(S31U), typeof(S32U), typeof(I128_1), typeof(I128_2)
};
public CallingConvention[] PInvokeConventions { get; } = { CallingConvention.Cdecl };
@@ -135,14 +136,14 @@ namespace ABIStress
new[]
{
typeof(byte), typeof(short), typeof(int), typeof(long),
- typeof(float), typeof(double),
+ typeof(float), typeof(double), typeof(Int128),
typeof(Vector<int>), typeof(Vector128<int>), typeof(Vector256<int>),
typeof(S1P), typeof(S2P), typeof(S2U), typeof(S3U),
typeof(S4P), typeof(S4U), typeof(S5U), typeof(S6U),
typeof(S7U), typeof(S8P), typeof(S8U), typeof(S9U),
typeof(S10U), typeof(S11U), typeof(S12U), typeof(S13U),
typeof(S14U), typeof(S15U), typeof(S16U),
- typeof(Hfa1), typeof(Hfa2),
+ typeof(Hfa1), typeof(Hfa2), typeof(I128_1)
};
public CallingConvention[] PInvokeConventions { get; } = { CallingConvention.Cdecl };
diff --git a/src/tests/JIT/Stress/ABI/Gen.cs b/src/tests/JIT/Stress/ABI/Gen.cs
index a7d0d0efbe5..ddb7c1215c8 100644
--- a/src/tests/JIT/Stress/ABI/Gen.cs
+++ b/src/tests/JIT/Stress/ABI/Gen.cs
@@ -48,6 +48,9 @@ namespace ABIStress
if (type == typeof(double))
return (double)rand.Next();
+ if (type == typeof(Int128))
+ return new Int128((ulong)(long)GenConstant(typeof(long), null, rand), (ulong)(long)GenConstant(typeof(long), null, rand));
+
if (type == typeof(Vector<int>))
return GenConstantVector<Vector<int>, int>(rand);
@@ -173,6 +176,8 @@ namespace ABIStress
il.Emit(OpCodes.Ldc_R4, (float)val);
else if (ty == typeof(double))
il.Emit(OpCodes.Ldc_R8, (double)val);
+ else if (ty == typeof(Int128))
+ EmitLoadBlittable(il, (Int128)val);
else if (ty == typeof(Vector<int>))
EmitLoadBlittable(il, (Vector<int>)val);
else if (ty == typeof(Vector128<int>))
diff --git a/src/tests/JIT/Stress/ABI/Program.cs b/src/tests/JIT/Stress/ABI/Program.cs
index 8eab812a574..1c1c00c6483 100644
--- a/src/tests/JIT/Stress/ABI/Program.cs
+++ b/src/tests/JIT/Stress/ABI/Program.cs
@@ -344,6 +344,7 @@ namespace ABIStress
typeof(byte), typeof(short), typeof(int), typeof(long),
typeof(float), typeof(double),
typeof(Vector<int>), typeof(Vector128<int>), typeof(Vector256<int>),
+ typeof(Int128),
typeof(S1P), typeof(S2P), typeof(S2U), typeof(S3U),
typeof(S4P), typeof(S4U), typeof(S5U), typeof(S6U),
typeof(S7U), typeof(S8P), typeof(S8U), typeof(S9U),
@@ -351,6 +352,7 @@ namespace ABIStress
typeof(S14U), typeof(S15U), typeof(S16U), typeof(S17U),
typeof(S31U), typeof(S32U),
typeof(Hfa1), typeof(Hfa2),
+ typeof(I128_1), typeof(I128_2),
}.Select(t => new TypeEx(t)).ToArray();
private static readonly IAbi s_abi = SelectAbi();
diff --git a/src/tests/JIT/Stress/ABI/Types.cs b/src/tests/JIT/Stress/ABI/Types.cs
index a24c47154de..140ae76762b 100644
--- a/src/tests/JIT/Stress/ABI/Types.cs
+++ b/src/tests/JIT/Stress/ABI/Types.cs
@@ -61,6 +61,8 @@ namespace ABIStress
public struct S32U { public byte F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30, F31; public S32U(byte f0, byte f1, byte f2, byte f3, byte f4, byte f5, byte f6, byte f7, byte f8, byte f9, byte f10, byte f11, byte f12, byte f13, byte f14, byte f15, byte f16, byte f17, byte f18, byte f19, byte f20, byte f21, byte f22, byte f23, byte f24, byte f25, byte f26, byte f27, byte f28, byte f29, byte f30, byte f31) => (F0, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30, F31) = (f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31); }
public struct Hfa1 { public float F0, F1; public Hfa1(float f0, float f1) => (F0, F1) = (f0, f1); }
public struct Hfa2 { public double F0, F1, F2, F3; public Hfa2(double f0, double f1, double f2, double f3) => (F0, F1, F2, F3) = (f0, f1, f2, f3); }
+ public struct I128_1 { public Int128 F0; public I128_1(Int128 f0) => F0 = f0; }
+ public struct I128_2 { public byte F0; public Int128 F1; public I128_2(byte f0, Int128 f1) => (F0, F1) = (f0, f1); }
internal static class TypeExtensions
{
@@ -78,7 +80,8 @@ namespace ABIStress
t == typeof(S14U) || t == typeof(S15U) ||
t == typeof(S16U) || t == typeof(S17U) ||
t == typeof(S31U) || t == typeof(S32U) ||
- t == typeof(Hfa1) || t == typeof(Hfa2);
+ t == typeof(Hfa1) || t == typeof(Hfa2) ||
+ t == typeof(I128_1) || t == typeof(I128_2);
}
}
}
diff --git a/src/tests/issues.targets b/src/tests/issues.targets
index 9d00498e97d..aa379a245e5 100644
--- a/src/tests/issues.targets
+++ b/src/tests/issues.targets
@@ -8,6 +8,9 @@
<ExcludeList Include="$(XunitTestBinBase)/Regressions/coreclr/GitHub_22888/test22888/*">
<Issue>https://github.com/dotnet/runtime/issues/13703</Issue>
</ExcludeList>
+ <ExcludeList Include="$(XunitTestBinBase)/Interop/PInvoke/Int128/Int128Test/*">
+ <Issue>https://github.com/dotnet/runtime/issues/74209</Issue>
+ </ExcludeList>
</ItemGroup>
<!-- All OS/Arch CoreCLR excludes -->
@@ -1421,6 +1424,9 @@
<!-- Known failures for mono runtime on *all* architectures/operating systems in *all* runtime modes -->
<ItemGroup Condition="'$(RuntimeFlavor)' == 'mono'" >
+ <ExcludeList Include="$(XunitTestBinBase)/Interop/PInvoke/Int128/Int128TestFieldLayout/*">
+ <Issue>https://github.com/dotnet/runtime/issues/74223</Issue>
+ </ExcludeList>
<ExcludeList Include = "$(XUnitTestBinBase)/JIT/Directed/Arrays/nintindexoutofrange/**">
<Issue>https://github.com/dotnet/runtime/issues/71656</Issue>
</ExcludeList>
diff --git a/src/tests/readytorun/fieldlayout/fieldlayouttests.cs b/src/tests/readytorun/fieldlayout/fieldlayouttests.cs
index 690f6ff9426..9b421859653 100644
--- a/src/tests/readytorun/fieldlayout/fieldlayouttests.cs
+++ b/src/tests/readytorun/fieldlayout/fieldlayouttests.cs
@@ -193,6 +193,8 @@ class SequentialTest
static Sequential.StructStructByte_Struct5BytesAuto _fld11;
static Sequential.StructStructByte_Struct8BytesAuto _fld12;
static Sequential.StructStructByte_Struct9BytesAuto _fld13;
+ static Sequential.StructStructByte_Int128StructAuto _fld14;
+ static Sequential.StructStructByte_UInt128StructAuto _fld15;
public static void Test()
{
@@ -232,6 +234,8 @@ class SequentialTest
_fld11.fld2 = default(Auto.Struct5Bytes);
_fld12.fld2 = default(Auto.Struct8Bytes);
_fld13.fld2 = default(Auto.Struct9Bytes);
+ _fld14.fld2 = default(Auto.Int128Struct);
+ _fld15.fld2 = default(Auto.UInt128Struct);
}
}
diff --git a/src/workloads/workloads.csproj b/src/workloads/workloads.csproj
index 573e8844c7a..1acaa7ea235 100644
--- a/src/workloads/workloads.csproj
+++ b/src/workloads/workloads.csproj
@@ -79,8 +79,8 @@
<!-- Shorten package names to avoid long path issues in Visual Studio -->
<ItemGroup>
<!-- These need to be in order - matching rules will try in order. -->
- <ShortNames Include="Microsoft.NET.Workload.Mono.ToolChain.Manifest">
- <Replacement>MonoToolChainManifest</Replacement>
+ <ShortNames Include="Microsoft.NET.Workload.Mono.ToolChain.">
+ <Replacement>Mono</Replacement>
</ShortNames>
<ShortNames Include="microsoft.netcore.app.runtime;Microsoft.NETCore.App.Runtime;microsoft.net.runtime;Microsoft.NET.Runtime">
<Replacement>Microsoft</Replacement>