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

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2018-09-11 15:36:29 +0300
committerGitHub <noreply@github.com>2018-09-11 15:36:29 +0300
commitcaba8d453641ee905acfcb86391eebaa2465f611 (patch)
treedbb300a6edc4baee419fc6a817ac9d77c3f584c1
parentcc2b5096c1015ef3f84607b4fad3aa0090c1129d (diff)
parente17d570ba2836c923e1292519e27e576bee47461 (diff)
Merge pull request #6320 from dotnet/master
Merge master to nmirror
-rw-r--r--BuildToolsVersion.txt2
-rw-r--r--NuGet.config1
-rw-r--r--buildscripts/build-managed.cmd6
-rw-r--r--dependencies.props4
-rw-r--r--dir.props7
-rw-r--r--dir.targets15
-rw-r--r--init-tools.cmd40
-rwxr-xr-xinit-tools.sh3
-rw-r--r--src/BuildIntegration/Microsoft.NETCore.Native.targets2
-rw-r--r--src/Common/test-runtime/XUnit.Runtime.depproj89
-rw-r--r--src/ILCompiler.Compiler/tests/ILCompiler.Compiler.Tests.Assets/ILCompiler.Compiler.Tests.Assets.csproj2
-rw-r--r--src/ILCompiler.Compiler/tests/ILCompiler.Compiler.Tests.csproj9
-rw-r--r--src/ILCompiler.DependencyAnalysisFramework/tests/DependencyAnalysisFrameworkTests.cs16
-rw-r--r--src/ILCompiler.DependencyAnalysisFramework/tests/ILCompiler.DependencyAnalysisFramework.Tests.csproj9
-rw-r--r--src/ILCompiler.MetadataTransform/tests/ExplicitScopeTests.cs4
-rw-r--r--src/ILCompiler.MetadataTransform/tests/ILCompiler.MetadataTransform.Tests.csproj9
-rw-r--r--src/ILCompiler.MetadataTransform/tests/ILMetadataAssembly/ILMetadataAssembly.ilproj2
-rw-r--r--src/ILCompiler.MetadataTransform/tests/PrimaryMetadataAssembly/PrimaryMetadataAssembly.csproj2
-rw-r--r--src/ILCompiler.MetadataTransform/tests/SampleMetadataAssembly/SampleMetadataAssembly.csproj2
-rw-r--r--src/ILCompiler.MetadataTransform/tests/SampleWinRTMetadataAssembly/SampleWinRTMetadataAssembly.csproj2
-rw-r--r--src/ILCompiler.MetadataTransform/tests/SimpleTests.cs2
-rw-r--r--src/ILCompiler.MetadataTransform/tests/WindowsWinRTMetadataAssembly/WindowsWinRTMetadataAssembly.csproj2
-rw-r--r--src/ILCompiler.TypeSystem/tests/CoreTestAssembly/CoreTestAssembly.csproj2
-rw-r--r--src/ILCompiler.TypeSystem/tests/GCPointerMapTests.cs16
-rw-r--r--src/ILCompiler.TypeSystem/tests/GenericTypeAndMethodTests.cs40
-rw-r--r--src/ILCompiler.TypeSystem/tests/ILTestAssembly/ILTestAssembly.ilproj2
-rw-r--r--src/ILCompiler.TypeSystem/tests/TypeSystem.Tests.csproj10
-rw-r--r--src/ILCompiler.TypeSystem/tests/UniversalGenericFieldLayoutTests.cs4
-rw-r--r--src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs76
-rw-r--r--src/ILVerification/tests/ILMethodTester.cs2
-rw-r--r--src/ILVerification/tests/ILTests/AccessTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/AccessTestsExtern.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/AccessTestsFriend.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ArrayTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/BasicArithmeticTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/BranchingTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/CallTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/CastingTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ComparisonTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/DelegateTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ExceptionRegionTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/FieldTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/FtnTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ILTests.targets17
-rw-r--r--src/ILVerification/tests/ILTests/LoadStoreIndirectTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/NewobjTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/PrefixTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ReturnTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ShiftTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ThisStateTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILTests/ValueTypeTests.ilproj3
-rw-r--r--src/ILVerification/tests/ILVerification.Tests.csproj15
-rw-r--r--src/ILVerification/tests/TestDataLoader.cs18
-rw-r--r--src/ILVerify/README.md12
-rw-r--r--src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs44
-rw-r--r--src/System.Private.CoreLib/shared/System/Guid.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/MemoryExtensions.Fast.cs14
-rw-r--r--src/System.Private.CoreLib/shared/System/MemoryExtensions.cs54
-rw-r--r--src/System.Private.CoreLib/shared/System/Number.Formatting.cs62
-rw-r--r--src/System.Private.CoreLib/shared/System/Number.NumberBuffer.cs20
-rw-r--r--src/System.Private.CoreLib/shared/System/Reflection/SignatureConstructedGenericType.cs20
-rw-r--r--src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs66
-rw-r--r--src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx2.cs882
-rw-r--r--src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Pclmulqdq.PlatformNotSupported.cs4
-rw-r--r--src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Pclmulqdq.cs4
-rw-r--r--src/System.Private.CoreLib/shared/System/SpanHelpers.Byte.cs94
-rw-r--r--src/System.Private.CoreLib/shared/System/SpanHelpers.Char.cs113
-rw-r--r--src/System.Private.CoreLib/shared/System/SpanHelpers.T.cs64
-rw-r--r--src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs13
-rw-r--r--src/System.Private.CoreLib/shared/System/Type.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/Version.cs2
-rw-r--r--src/System.Private.CoreLib/src/System/Number.Unix.cs7
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/CustomAttributeData.cs2
-rw-r--r--src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILImporter.Interpreter.cs97
-rw-r--r--src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILInterpreter.cs18
-rw-r--r--src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/StackItem.cs105
-rw-r--r--src/System.Private.Reflection.Metadata/tests/System.Private.Reflection.Metadata.Tests.csproj9
-rw-r--r--src/dirs.proj3
-rw-r--r--tests/TopN.CoreFX.Windows.issues.json4
-rwxr-xr-xtests/runtest.sh9
-rw-r--r--tests/src/Simple/HelloWasm/Program.cs205
81 files changed, 2014 insertions, 409 deletions
diff --git a/BuildToolsVersion.txt b/BuildToolsVersion.txt
index 810057496..c42edc75e 100644
--- a/BuildToolsVersion.txt
+++ b/BuildToolsVersion.txt
@@ -1 +1 @@
-2.2.0-preview1-02908-01
+3.0.0-preview1-03205-01 \ No newline at end of file
diff --git a/NuGet.config b/NuGet.config
index 57feb087b..d93431bd1 100644
--- a/NuGet.config
+++ b/NuGet.config
@@ -2,6 +2,7 @@
<configuration>
<packageSources>
<clear/>
+ <add key="dotnetfeed" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<add key="myget.org dotnet-buildtools" value="https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json" />
<add key="myget.org dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="myget.org dotnet-corefxlab" value="https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json" />
diff --git a/buildscripts/build-managed.cmd b/buildscripts/build-managed.cmd
index c052aef78..14a6b9d2e 100644
--- a/buildscripts/build-managed.cmd
+++ b/buildscripts/build-managed.cmd
@@ -55,7 +55,7 @@ IF ERRORLEVEL 1 exit /b %ERRORLEVEL%
call "!VS%__VSProductVersion%COMNTOOLS!\VsDevCmd.bat"
echo Commencing build of managed components for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
-%_msbuildexe% /ConsoleLoggerParameters:ForceNoAlign "%__ProjectDir%\build.proj" %__ExtraMsBuildParams% /p:RepoPath="%__ProjectDir%" /p:RepoLocalBuild="true" /p:NuPkgRid=%__NugetRuntimeId% /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=normal;LogFile="%__BuildLog%"
+"%__DotNetCliPath%\dotnet.exe" msbuild /ConsoleLoggerParameters:ForceNoAlign "%__ProjectDir%\build.proj" %__ExtraMsBuildParams% /p:RepoPath="%__ProjectDir%" /p:RepoLocalBuild="true" /p:NuPkgRid=%__NugetRuntimeId% /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=normal;LogFile="%__BuildLog%"
IF NOT ERRORLEVEL 1 (
findstr /ir /c:".*Warning(s)" /c:".*Error(s)" /c:"Time Elapsed.*" "%__BuildLog%"
goto AfterILCompilerBuild
@@ -71,14 +71,14 @@ set __GenRespFiles=0
if not exist "%__ObjDir%\ryujit.rsp" set __GenRespFiles=1
if not exist "%__ObjDir%\cpp.rsp" set __GenRespFiles=1
if "%__GenRespFiles%"=="1" (
- %_msbuildexe% /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%__BinDir%" /p:Configuration=%__BuildType% /t:Clean,IlcCompile "%__ProjectDir%\src\ILCompiler\repro\repro.csproj"
+ "%__DotNetCliPath%\dotnet.exe" msbuild /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%__BinDir%" /p:Configuration=%__BuildType% /t:Clean,IlcCompile "%__ProjectDir%\src\ILCompiler\repro\repro.csproj"
call :CopyResponseFile "%__ObjDir%\repro\native\repro.ilc.rsp" "%__ObjDir%\ryujit.rsp"
set __ExtraArgs=/p:NativeCodeGen=cpp
if /i "%__BuildType%"=="debug" (
set __ExtraArgs=!__ExtraArgs! "/p:AdditionalCppCompilerFlags=/MTd"
)
- %_msbuildexe% /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%__BinDir%" /p:Configuration=%__BuildType% /t:Clean,IlcCompile "%__ProjectDir%\src\ILCompiler\repro\repro.csproj" !__ExtraArgs!
+ "%__DotNetCliPath%\dotnet.exe" msbuild /ConsoleLoggerParameters:ForceNoAlign "/p:IlcPath=%__BinDir%" /p:Configuration=%__BuildType% /t:Clean,IlcCompile "%__ProjectDir%\src\ILCompiler\repro\repro.csproj" !__ExtraArgs!
call :CopyResponseFile "%__ObjDir%\repro\native\repro.ilc.rsp" "%__ObjDir%\cpp.rsp"
)
:AfterVsDevGenerateRespFiles
diff --git a/dependencies.props b/dependencies.props
index b78843d3a..578a74329 100644
--- a/dependencies.props
+++ b/dependencies.props
@@ -6,6 +6,8 @@
<CoreFxUapVersion>4.7.0-preview1-26831-01</CoreFxUapVersion>
<MicrosoftNETCoreNativeVersion>3.0.0-preview1-26831-01</MicrosoftNETCoreNativeVersion>
<MicrosoftNETCoreAppPackageVersion>2.1.0</MicrosoftNETCoreAppPackageVersion>
- <XunitNetcoreExtensionsVersion>1.0.1-prerelease-02104-02</XunitNetcoreExtensionsVersion>
+ <MicrosoftDotNetTestSdkVersion>15.8.0</MicrosoftDotNetTestSdkVersion>
+ <XUnitPackageVersion>2.4.1-pre.build.4059</XUnitPackageVersion>
+ <MicrosoftDotNetXUnitExtensionsVersion>2.4.0-beta.18420.3</MicrosoftDotNetXUnitExtensionsVersion>
</PropertyGroup>
</Project>
diff --git a/dir.props b/dir.props
index bfdbe3218..9ff9c1446 100644
--- a/dir.props
+++ b/dir.props
@@ -149,7 +149,7 @@
</PropertyGroup>
<ItemGroup>
- <SupplementalTestData Include="$(RuntimePath)*.dll" />
+ <SupplementalTestData Include="$(RuntimePath)*" />
</ItemGroup>
<!-- initialize all the targets variables to false as they should only be set below -->
@@ -263,6 +263,11 @@
<SkipTests Condition="'$(SkipTests)'=='' and ('$(OsEnvironment)'=='Windows_NT' and '$(TargetsWindows)'!='true')">true</SkipTests>
</PropertyGroup>
+ <PropertyGroup>
+ <!-- On Windows fallback to ILAsm from the framework for now -->
+ <IlasmToolPath Condition="'$(OSEnvironment)'=='Windows_NT'">%WINDIR%\Microsoft.NET\Framework\v4.0.30319\ilasm.exe</IlasmToolPath>
+ </PropertyGroup>
+
<!-- Use Roslyn Compilers to build -->
<Import Project="$(RoslynPropsFile)" Condition="Exists('$(RoslynPropsFile)')" />
</Project>
diff --git a/dir.targets b/dir.targets
index 8d8b5e3f2..bb03d1d58 100644
--- a/dir.targets
+++ b/dir.targets
@@ -36,6 +36,21 @@
</PackageReference>
</ItemGroup>
+ <!-- Set default references for netstandard2.0 -->
+ <PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
+ <NuGetTargetMoniker>.NETStandard,Version=v2.0</NuGetTargetMoniker>
+ <TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>
+ <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+ </PropertyGroup>
+ <ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
+ <PackageReference Include="NETStandard.Library">
+ <Version>2.0.3</Version>
+ </PackageReference>
+ </ItemGroup>
+ <ImportGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
+ <Import Project="$(PackagesDir)netstandard.library\2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('$(PackagesDir)netstandard.library\2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
+ </ImportGroup>
+
<!-- Set non-empty TargetFrameworkIdentifier to avoid defaulting to .NETPortable -->
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == ''">
<TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>
diff --git a/init-tools.cmd b/init-tools.cmd
index 281875020..7c5fbfa12 100644
--- a/init-tools.cmd
+++ b/init-tools.cmd
@@ -2,20 +2,21 @@
setlocal
set INIT_TOOLS_LOG=%~dp0init-tools.log
-if [%PACKAGES_DIR%]==[] set PACKAGES_DIR=%~dp0packages\
+if [%PACKAGES_DIR%]==[] set PACKAGES_DIR=%~dp0packages
if [%TOOLRUNTIME_DIR%]==[] set TOOLRUNTIME_DIR=%~dp0Tools
set DOTNET_PATH=%TOOLRUNTIME_DIR%\dotnetcli\
if [%DOTNET_CMD%]==[] set DOTNET_CMD=%DOTNET_PATH%dotnet.exe
if [%BUILDTOOLS_SOURCE%]==[] set BUILDTOOLS_SOURCE=https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json
set /P BUILDTOOLS_VERSION=< "%~dp0BuildToolsVersion.txt"
-set BUILD_TOOLS_PATH=%PACKAGES_DIR%Microsoft.DotNet.BuildTools\%BUILDTOOLS_VERSION%\lib\
+set BUILD_TOOLS_PATH=%PACKAGES_DIR%\Microsoft.DotNet.BuildTools\%BUILDTOOLS_VERSION%\lib
set INIT_TOOLS_RESTORE_PROJECT=%~dp0init-tools.msbuild
-set BUILD_TOOLS_SEMAPHORE=%TOOLRUNTIME_DIR%\%BUILDTOOLS_VERSION%\init-tools.completed
+set BUILD_TOOLS_SEMAPHORE_DIR=%TOOLRUNTIME_DIR%\%BUILDTOOLS_VERSION%
+set BUILD_TOOLS_SEMAPHORE=%BUILD_TOOLS_SEMAPHORE_DIR%\init-tools.completed
:: if force option is specified then clean the tool runtime and build tools package directory to force it to get recreated
if [%1]==[force] (
if exist "%TOOLRUNTIME_DIR%" rmdir /S /Q "%TOOLRUNTIME_DIR%"
- if exist "%PACKAGES_DIR%Microsoft.DotNet.BuildTools" rmdir /S /Q "%PACKAGES_DIR%Microsoft.DotNet.BuildTools"
+ if exist "%PACKAGES_DIR%\Microsoft.DotNet.BuildTools" rmdir /S /Q "%PACKAGES_DIR%\Microsoft.DotNet.BuildTools"
)
:: If semaphore exists do nothing
@@ -26,6 +27,21 @@ if exist "%BUILD_TOOLS_SEMAPHORE%" (
if exist "%TOOLRUNTIME_DIR%" rmdir /S /Q "%TOOLRUNTIME_DIR%"
+if exist "%DotNetBuildToolsDir%" (
+ echo Using tools from '%DotNetBuildToolsDir%'.
+ mklink /j "%TOOLRUNTIME_DIR%" "%DotNetBuildToolsDir%"
+
+ if not exist "%DOTNET_CMD%" (
+ echo ERROR: Ensure that '%DotNetBuildToolsDir%' contains the .NET Core SDK at '%DOTNET_PATH%'
+ exit /b 1
+ )
+
+ echo Done initializing tools.
+ if NOT exist "%BUILD_TOOLS_SEMAPHORE_DIR%" mkdir "%BUILD_TOOLS_SEMAPHORE_DIR%"
+ echo Using tools from '%DotNetBuildToolsDir%'. > "%BUILD_TOOLS_SEMAPHORE%"
+ exit /b 0
+)
+
echo Running %0 > "%INIT_TOOLS_LOG%"
set /p DOTNET_VERSION=< "%~dp0DotnetCLIVersion.txt"
@@ -37,7 +53,7 @@ set DOTNET_ZIP_NAME=dotnet-sdk-%DOTNET_VERSION%-win-x64.zip
set DOTNET_REMOTE_PATH=https://dotnetcli.azureedge.net/dotnet/Sdk/%DOTNET_VERSION%/%DOTNET_ZIP_NAME%
set DOTNET_LOCAL_PATH=%DOTNET_PATH%%DOTNET_ZIP_NAME%
echo Installing '%DOTNET_REMOTE_PATH%' to '%DOTNET_LOCAL_PATH%' >> "%INIT_TOOLS_LOG%"
-powershell -NoProfile -ExecutionPolicy unrestricted -Command "$retryCount = 0; $success = $false; do { try { (New-Object Net.WebClient).DownloadFile('%DOTNET_REMOTE_PATH%', '%DOTNET_LOCAL_PATH%'); $success = $true; } catch { if ($retryCount -ge 6) { throw; } else { $retryCount++; Start-Sleep -Seconds (5 * $retryCount); } } } while ($success -eq $false); Add-Type -Assembly 'System.IO.Compression.FileSystem' -ErrorVariable AddTypeErrors; if ($AddTypeErrors.Count -eq 0) { [System.IO.Compression.ZipFile]::ExtractToDirectory('%DOTNET_LOCAL_PATH%', '%DOTNET_PATH%') } else { (New-Object -com shell.application).namespace('%DOTNET_PATH%').CopyHere((new-object -com shell.application).namespace('%DOTNET_LOCAL_PATH%').Items(),16) }" >> "%INIT_TOOLS_LOG%"
+powershell -NoProfile -ExecutionPolicy unrestricted -Command "$retryCount = 0; $success = $false; $proxyCredentialsRequired = $false; do { try { $wc = New-Object Net.WebClient; if ($proxyCredentialsRequired) { [Net.WebRequest]::DefaultWebProxy.Credentials = [Net.CredentialCache]::DefaultNetworkCredentials; } $wc.DownloadFile('%DOTNET_REMOTE_PATH%', '%DOTNET_LOCAL_PATH%'); $success = $true; } catch { if ($retryCount -ge 6) { throw; } else { $we = $_.Exception.InnerException -as [Net.WebException]; $proxyCredentialsRequired = ($we -ne $null -and ([Net.HttpWebResponse]$we.Response).StatusCode -eq [Net.HttpStatusCode]::ProxyAuthenticationRequired); Start-Sleep -Seconds (5 * $retryCount); $retryCount++; } } } while ($success -eq $false); Add-Type -Assembly 'System.IO.Compression.FileSystem' -ErrorVariable AddTypeErrors; if ($AddTypeErrors.Count -eq 0) { [System.IO.Compression.ZipFile]::ExtractToDirectory('%DOTNET_LOCAL_PATH%', '%DOTNET_PATH%') } else { (New-Object -com shell.application).namespace('%DOTNET_PATH%').CopyHere((new-object -com shell.application).namespace('%DOTNET_LOCAL_PATH%').Items(),16) }" >> "%INIT_TOOLS_LOG%"
if NOT exist "%DOTNET_LOCAL_PATH%" (
echo ERROR: Could not install dotnet cli correctly. 1>&2
goto :error
@@ -47,9 +63,9 @@ if NOT exist "%DOTNET_LOCAL_PATH%" (
if exist "%BUILD_TOOLS_PATH%" goto :afterbuildtoolsrestore
echo Restoring BuildTools version %BUILDTOOLS_VERSION%...
-echo Running: "%DOTNET_CMD%" restore "%INIT_TOOLS_RESTORE_PROJECT%" --no-cache --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" /p:BuildToolsPackageVersion=%BUILDTOOLS_VERSION% >> "%INIT_TOOLS_LOG%"
-call "%DOTNET_CMD%" restore "%INIT_TOOLS_RESTORE_PROJECT%" --no-cache --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" /p:BuildToolsPackageVersion=%BUILDTOOLS_VERSION% >> "%INIT_TOOLS_LOG%"
-if NOT exist "%BUILD_TOOLS_PATH%init-tools.cmd" (
+echo Running: "%DOTNET_CMD%" restore "%INIT_TOOLS_RESTORE_PROJECT%" --no-cache --packages "%PACKAGES_DIR%" --source "%BUILDTOOLS_SOURCE%" /p:BuildToolsPackageVersion=%BUILDTOOLS_VERSION% /p:ToolsDir=%TOOLRUNTIME_DIR% >> "%INIT_TOOLS_LOG%"
+call "%DOTNET_CMD%" restore "%INIT_TOOLS_RESTORE_PROJECT%" --no-cache --packages "%PACKAGES_DIR%" --source "%BUILDTOOLS_SOURCE%" /p:BuildToolsPackageVersion=%BUILDTOOLS_VERSION% /p:ToolsDir=%TOOLRUNTIME_DIR% >> "%INIT_TOOLS_LOG%"
+if NOT exist "%BUILD_TOOLS_PATH%\init-tools.cmd" (
echo ERROR: Could not restore build tools correctly. 1>&2
goto :error
)
@@ -57,19 +73,17 @@ if NOT exist "%BUILD_TOOLS_PATH%init-tools.cmd" (
:afterbuildtoolsrestore
echo Initializing BuildTools...
-echo Running: "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> "%INIT_TOOLS_LOG%"
-call "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> "%INIT_TOOLS_LOG%"
+echo Running: "%BUILD_TOOLS_PATH%\init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> "%INIT_TOOLS_LOG%"
+call "%BUILD_TOOLS_PATH%\init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" "%PACKAGES_DIR%" >> "%INIT_TOOLS_LOG%"
set INIT_TOOLS_ERRORLEVEL=%ERRORLEVEL%
if not [%INIT_TOOLS_ERRORLEVEL%]==[0] (
echo ERROR: An error occured when trying to initialize the tools. 1>&2
goto :error
)
-rem CoreRT does not use special copy of the shared runtime for testing
-copy /Y %TOOLRUNTIME_DIR%\csc.runtimeconfig.json %TOOLRUNTIME_DIR%\xunit.console.netcore.runtimeconfig.json
-
:: Create semaphore file
echo Done initializing tools.
+if NOT exist "%BUILD_TOOLS_SEMAPHORE_DIR%" mkdir "%BUILD_TOOLS_SEMAPHORE_DIR%"
echo Init-Tools.cmd completed for BuildTools Version: %BUILDTOOLS_VERSION% > "%BUILD_TOOLS_SEMAPHORE%"
exit /b 0
diff --git a/init-tools.sh b/init-tools.sh
index 06c4b1569..bb7362a08 100755
--- a/init-tools.sh
+++ b/init-tools.sh
@@ -148,9 +148,6 @@ if [ ! -e $__INIT_TOOLS_DONE_MARKER ]; then
Tools/crossgen.sh $__scriptpath/Tools $__PKG_RID
- # CoreRT does not use special copy of the shared runtime for testing
- cp $__TOOLRUNTIME_DIR/csc.runtimeconfig.json $__TOOLRUNTIME_DIR/xunit.console.netcore.runtimeconfig.json
-
mkdir -p $__INIT_TOOLS_DONE_MARKER_DIR
touch $__INIT_TOOLS_DONE_MARKER
diff --git a/src/BuildIntegration/Microsoft.NETCore.Native.targets b/src/BuildIntegration/Microsoft.NETCore.Native.targets
index 79f3a61b7..66af195d0 100644
--- a/src/BuildIntegration/Microsoft.NETCore.Native.targets
+++ b/src/BuildIntegration/Microsoft.NETCore.Native.targets
@@ -250,7 +250,7 @@ See the LICENSE file in the project root for more information.
<PropertyGroup>
<EmccArgs>&quot;$(NativeObject)&quot; -o &quot;$(NativeBinary)&quot; -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 --emrun </EmccArgs>
- <EmccArgs Condition="'$(Platform)'=='wasm'">$(EmccArgs) &quot;$(IlcPath)/sdk/libPortableRuntime.bc&quot; &quot;$(IlcPath)/sdk/libbootstrappercpp.bc&quot; &quot;$(IlcPath)/sdk/libSystem.Private.CoreLib.Native.bc&quot; </EmccArgs>
+ <EmccArgs Condition="'$(Platform)'=='wasm'">$(EmccArgs) &quot;$(IlcPath)/sdk/libPortableRuntime.bc&quot; &quot;$(IlcPath)/sdk/libbootstrappercpp.bc&quot; &quot;$(IlcPath)/sdk/libSystem.Private.CoreLib.Native.bc&quot; </EmccArgs>
<EmccArgs Condition="'$(Configuration)'=='Release'">$(EmccArgs) -O2 --llvm-lto 2</EmccArgs>
<EmccArgs Condition="'$(Configuration)'=='Debug'">$(EmccArgs) -g3</EmccArgs>
</PropertyGroup>
diff --git a/src/Common/test-runtime/XUnit.Runtime.depproj b/src/Common/test-runtime/XUnit.Runtime.depproj
index de12bce81..0d3b67d6e 100644
--- a/src/Common/test-runtime/XUnit.Runtime.depproj
+++ b/src/Common/test-runtime/XUnit.Runtime.depproj
@@ -8,29 +8,90 @@
<TargetFramework>netcoreapp2.1</TargetFramework>
<RidSpecificAssets>true</RidSpecificAssets>
<OutputPath>$(RuntimePath)</OutputPath>
+ <XUnitRunnerPackageId>xunit.runner.console</XUnitRunnerPackageId>
+ <XUnitRunner>xunit.console</XUnitRunner>
+ <XUnitTestAdapterPackageId>xunit.runner.visualstudio</XUnitTestAdapterPackageId>
+ <XUnitAdapter>xunit.runner.visualstudio.dotnetcore.testadapter</XUnitAdapter>
+ <TestPlatformHostPackageId>microsoft.testplatform.testhost</TestPlatformHostPackageId>
+ <TestPlatformHost>testhost</TestPlatformHost>
+ <!-- In case the project language is not set -->
+ <Language Condition="'$(Language)' == ''">unknown</Language>
<!-- Don't warn if some dependencies were rolled forward -->
<NoWarn>$(NoWarn);NU1603</NoWarn>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="xunit.console.netcore">
- <Version>1.0.3-prerelease-00921-01</Version>
+ <PackageReference Include="xunit">
+ <Version>$(XUnitPackageVersion)</Version>
</PackageReference>
- <PackageReference Include="Microsoft.DotNet.BuildTools.TestSuite">
- <Version>$(XunitNetcoreExtensionsVersion)</Version>
+ <PackageReference Include="$(XUnitRunnerPackageId)">
+ <Version>$(XUnitPackageVersion)</Version>
</PackageReference>
- <PackageReference Include="Microsoft.xunit.netcore.extensions">
- <Version>$(XunitNetcoreExtensionsVersion)</Version>
+ <PackageReference Include="Microsoft.DotNet.XUnitExtensions">
+ <Version>$(MicrosoftDotNetXUnitExtensionsVersion)</Version>
+ </PackageReference>
+ <PackageReference Include="$(XUnitTestAdapterPackageId)">
+ <Version>$(XUnitPackageVersion)</Version>
+ </PackageReference>
+ <PackageReference Include="Microsoft.NET.Test.Sdk">
+ <Version>$(MicrosoftDotNetTestSdkVersion)</Version>
+ </PackageReference>
+ <PackageReference Include="Microsoft.TestPlatform.ObjectModel">
+ <Version>$(MicrosoftDotNetTestSdkVersion)</Version>
+ </PackageReference>
+ <PackageReference Include="$(TestPlatformHostPackageId)">
+ <Version>$(MicrosoftDotNetTestSdkVersion)</Version>
+ </PackageReference>
+ <PackageReference Include="Microsoft.Extensions.DependencyModel">
+ <Version>2.0.4</Version>
+ </PackageReference>
+ <PackageReference Include="Newtonsoft.Json">
+ <Version>9.0.1</Version>
</PackageReference>
</ItemGroup>
+ <Target Name="AddTestPlatformDependenciesNetCore" BeforeTargets="ResolveReferences">
+ <Error Condition="!Exists('$(PackagesDir)$(XUnitRunnerPackageId)\$(XUnitPackageVersion)\tools\netcoreapp2.0\$(XUnitRunner).dll')"
+ Text="Error: looks the package $(PackagesDir)$(XUnitRunnerPackageId)\$(XUnitPackageVersion) not restored or missing $(XUnitRunner).dll."
+ />
+ <Error Condition="!Exists('$(PackagesDir)$(XUnitTestAdapterPackageId)\$(XUnitPackageVersion)\build\netcoreapp1.0\$(XUnitAdapter).dll')"
+ Text="Error: looks the package $(PackagesDir)$(XUnitTestAdapterPackageId)\$(XUnitPackageVersion) not restored or missing $(XUnitAdapter).dll."
+ />
+ <Error Condition="!Exists('$(PackagesDir)$(TestPlatformHostPackageId)\$(MicrosoftDotNetTestSdkVersion)\lib\netstandard1.5\$(TestPlatformHost).dll')"
+ Text="Error: looks the package $(PackagesDir)$(TestPlatformHostPackageId)\$(MicrosoftDotNetTestSdkVersion) not restored or missing $(TestPlatformHost).dll."
+ />
+ <ItemGroup>
+ <ReferenceCopyLocalPaths Include="$(PackagesDir)$(XUnitRunnerPackageId)\$(XUnitPackageVersion)\tools\netcoreapp2.0\*.*">
+ <Private>false</Private>
+ <NuGetPackageId>$(XUnitRunnerPackageId)</NuGetPackageId>
+ <NuGetPackageVersion>$(XUnitPackageVersion)</NuGetPackageVersion>
+ </ReferenceCopyLocalPaths>
+ <ReferenceCopyLocalPaths Include="$(PackagesDir)$(XUnitTestAdapterPackageId)\$(XUnitPackageVersion)\build\netcoreapp1.0\*.*">
+ <Private>false</Private>
+ <NuGetPackageId>$(XUnitTestAdapterPackageId)</NuGetPackageId>
+ <NuGetPackageVersion>$(XUnitPackageVersion)</NuGetPackageVersion>
+ </ReferenceCopyLocalPaths>
+ <ReferenceCopyLocalPaths Include="$(PackagesDir)$(TestPlatformHostPackageId)\$(MicrosoftDotNetTestSdkVersion)\lib\netstandard1.5\$(TestPlatformHost).dll">
+ <Private>false</Private>
+ <NuGetPackageId>$(TestPlatformHostPackageId)</NuGetPackageId>
+ <NuGetPackageVersion>$(MicrosoftDotNetTestSdkVersion)</NuGetPackageVersion>
+ </ReferenceCopyLocalPaths>
+ </ItemGroup>
+ </Target>
<ItemGroup>
- <PackageToInclude Include="xunit.abstractions"/>
- <PackageToInclude Include="xunit.assert"/>
- <PackageToInclude Include="xunit.extensibility.core"/>
- <PackageToInclude Include="xunit.extensibility.execution"/>
- <PackageToInclude Include="xunit.runner.utility"/>
- <PackageToInclude Include="Microsoft.xunit.netcore.extensions"/>
- <PackageToInclude Include="xunit.console.netcore" />
- </ItemGroup>
+ <!-- xunit core -->
+ <PackageToInclude Include="xunit.abstractions" />
+ <PackageToInclude Include="xunit.assert" />
+ <PackageToInclude Include="xunit.extensibility.core" />
+ <PackageToInclude Include="xunit.extensibility.execution" />
+ <PackageToInclude Include="xunit.runner.utility" />
+ <PackageToInclude Include="Microsoft.DotNet.XUnitExtensions" />
+
+ <!-- test sdk -->
+ <PackageToInclude Include="Microsoft.NET.Test.Sdk" />
+ <PackageToInclude Include="Microsoft.TestPlatform.TestHost" />
+ <PackageToInclude Include="Microsoft.TestPlatform.ObjectModel" />
+ <PackageToInclude Include="Microsoft.Extensions.DependencyModel" />
+ <PackageToInclude Include="Newtonsoft.Json" />
+ </ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
diff --git a/src/ILCompiler.Compiler/tests/ILCompiler.Compiler.Tests.Assets/ILCompiler.Compiler.Tests.Assets.csproj b/src/ILCompiler.Compiler/tests/ILCompiler.Compiler.Tests.Assets/ILCompiler.Compiler.Tests.Assets.csproj
index 44d852d96..a463d125f 100644
--- a/src/ILCompiler.Compiler/tests/ILCompiler.Compiler.Tests.Assets/ILCompiler.Compiler.Tests.Assets.csproj
+++ b/src/ILCompiler.Compiler/tests/ILCompiler.Compiler.Tests.Assets/ILCompiler.Compiler.Tests.Assets.csproj
@@ -4,7 +4,7 @@
<OutputType>Library</OutputType>
<AssemblyName>ILCompiler.Compiler.Tests.Assets</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
- <RunTestsForProject>false</RunTestsForProject>
+ <SkipTestRun>true</SkipTestRun>
</PropertyGroup>
<ItemGroup>
diff --git a/src/ILCompiler.Compiler/tests/ILCompiler.Compiler.Tests.csproj b/src/ILCompiler.Compiler/tests/ILCompiler.Compiler.Tests.csproj
index 6e2a7f7f4..797bb79fe 100644
--- a/src/ILCompiler.Compiler/tests/ILCompiler.Compiler.Tests.csproj
+++ b/src/ILCompiler.Compiler/tests/ILCompiler.Compiler.Tests.csproj
@@ -4,11 +4,14 @@
<OutputType>Library</OutputType>
<AssemblyName>ILCompiler.Compiler.Tests</AssemblyName>
<RootNamespace>ILCompiler.Compiler.Tests</RootNamespace>
- <TargetFramework>netstandard1.3</TargetFramework>
+ <TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.DotNet.BuildTools.TestSuite">
- <Version>$(XunitNetcoreExtensionsVersion)</Version>
+ <PackageReference Include="xunit">
+ <Version>$(XUnitPackageVersion)</Version>
+ </PackageReference>
+ <PackageReference Include="Microsoft.DotNet.XUnitExtensions">
+ <Version>$(MicrosoftDotNetXUnitExtensionsVersion)</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
diff --git a/src/ILCompiler.DependencyAnalysisFramework/tests/DependencyAnalysisFrameworkTests.cs b/src/ILCompiler.DependencyAnalysisFramework/tests/DependencyAnalysisFrameworkTests.cs
index 390299940..3b9cfc80e 100644
--- a/src/ILCompiler.DependencyAnalysisFramework/tests/DependencyAnalysisFrameworkTests.cs
+++ b/src/ILCompiler.DependencyAnalysisFramework/tests/DependencyAnalysisFrameworkTests.cs
@@ -50,8 +50,8 @@ namespace ILCompiler.DependencyAnalysisFramework.Tests
testGraph.AddRoot("A", "A is root");
List<string> results = testGraph.AnalysisResults;
- Assert.True(results.Contains("A"));
- Assert.True(results.Contains("B"));
+ Assert.Contains("A", results);
+ Assert.Contains("B", results);
});
}
@@ -64,9 +64,9 @@ namespace ILCompiler.DependencyAnalysisFramework.Tests
testGraph.AddRoot("A", "A is root");
List<string> results = testGraph.AnalysisResults;
- Assert.True(results.Contains("A"));
- Assert.False(results.Contains("B"));
- Assert.False(results.Contains("C"));
+ Assert.Contains("A", results);
+ Assert.DoesNotContain("B", results);
+ Assert.DoesNotContain("C", results);
Assert.True(results.Count == 1);
});
}
@@ -81,9 +81,9 @@ namespace ILCompiler.DependencyAnalysisFramework.Tests
testGraph.AddRoot("C", "C is root");
List<string> results = testGraph.AnalysisResults;
- Assert.True(results.Contains("A"));
- Assert.True(results.Contains("B"));
- Assert.True(results.Contains("C"));
+ Assert.Contains("A", results);
+ Assert.Contains("B", results);
+ Assert.Contains("C", results);
Assert.True(results.Count == 3);
});
}
diff --git a/src/ILCompiler.DependencyAnalysisFramework/tests/ILCompiler.DependencyAnalysisFramework.Tests.csproj b/src/ILCompiler.DependencyAnalysisFramework/tests/ILCompiler.DependencyAnalysisFramework.Tests.csproj
index 37f6e2a40..a352c7c0c 100644
--- a/src/ILCompiler.DependencyAnalysisFramework/tests/ILCompiler.DependencyAnalysisFramework.Tests.csproj
+++ b/src/ILCompiler.DependencyAnalysisFramework/tests/ILCompiler.DependencyAnalysisFramework.Tests.csproj
@@ -4,7 +4,7 @@
<OutputType>Library</OutputType>
<AssemblyName>ILCompiler.DependencyAnalysisFramework.Tests</AssemblyName>
<RootNamespace>ILCompiler.DependencyAnalysisFramework.Tests</RootNamespace>
- <TargetFramework>netstandard1.3</TargetFramework>
+ <TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\src\ILCompiler.DependencyAnalysisFramework.csproj" />
@@ -13,8 +13,11 @@
<PackageReference Include="System.Collections.Immutable">
<Version>1.3.1</Version>
</PackageReference>
- <PackageReference Include="Microsoft.DotNet.BuildTools.TestSuite">
- <Version>$(XunitNetcoreExtensionsVersion)</Version>
+ <PackageReference Include="xunit">
+ <Version>$(XUnitPackageVersion)</Version>
+ </PackageReference>
+ <PackageReference Include="Microsoft.DotNet.XUnitExtensions">
+ <Version>$(MicrosoftDotNetXUnitExtensionsVersion)</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
diff --git a/src/ILCompiler.MetadataTransform/tests/ExplicitScopeTests.cs b/src/ILCompiler.MetadataTransform/tests/ExplicitScopeTests.cs
index 6745b23ee..dad6f4e73 100644
--- a/src/ILCompiler.MetadataTransform/tests/ExplicitScopeTests.cs
+++ b/src/ILCompiler.MetadataTransform/tests/ExplicitScopeTests.cs
@@ -57,7 +57,7 @@ namespace MetadataTransformTests
return scope;
}
- public void CheckTypeDefinitionForProperWinRTHome(TypeDefinition typeDefinition, string module)
+ private void CheckTypeDefinitionForProperWinRTHome(TypeDefinition typeDefinition, string module)
{
ScopeDefinition scope = GetScopeDefinitionOfType(typeDefinition);
Assert.Equal(module, scope.Name.Value);
@@ -66,7 +66,7 @@ namespace MetadataTransformTests
}
- public void CheckTypeReferenceForProperWinRTHome(TypeReference typeReference, string module)
+ private void CheckTypeReferenceForProperWinRTHome(TypeReference typeReference, string module)
{
ScopeReference scope = GetScopeReferenceOfType(typeReference);
Assert.Equal(module, scope.Name.Value);
diff --git a/src/ILCompiler.MetadataTransform/tests/ILCompiler.MetadataTransform.Tests.csproj b/src/ILCompiler.MetadataTransform/tests/ILCompiler.MetadataTransform.Tests.csproj
index 9de4e1df7..1a3d8e52a 100644
--- a/src/ILCompiler.MetadataTransform/tests/ILCompiler.MetadataTransform.Tests.csproj
+++ b/src/ILCompiler.MetadataTransform/tests/ILCompiler.MetadataTransform.Tests.csproj
@@ -4,11 +4,14 @@
<OutputType>Library</OutputType>
<AssemblyName>ILCompiler.MetadataTransform.Tests</AssemblyName>
<RootNamespace>MetadataTransformTests</RootNamespace>
- <TargetFramework>netstandard1.3</TargetFramework>
+ <TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.DotNet.BuildTools.TestSuite">
- <Version>$(XunitNetcoreExtensionsVersion)</Version>
+ <PackageReference Include="xunit">
+ <Version>$(XUnitPackageVersion)</Version>
+ </PackageReference>
+ <PackageReference Include="Microsoft.DotNet.XUnitExtensions">
+ <Version>$(MicrosoftDotNetXUnitExtensionsVersion)</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
diff --git a/src/ILCompiler.MetadataTransform/tests/ILMetadataAssembly/ILMetadataAssembly.ilproj b/src/ILCompiler.MetadataTransform/tests/ILMetadataAssembly/ILMetadataAssembly.ilproj
index 8e383e067..63712c1f4 100644
--- a/src/ILCompiler.MetadataTransform/tests/ILMetadataAssembly/ILMetadataAssembly.ilproj
+++ b/src/ILCompiler.MetadataTransform/tests/ILMetadataAssembly/ILMetadataAssembly.ilproj
@@ -5,7 +5,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<AssemblyName>ILMetadataAssembly</AssemblyName>
- <RunTestsForProject>false</RunTestsForProject>
+ <SkipTestRun>true</SkipTestRun>
</PropertyGroup>
<ItemGroup>
diff --git a/src/ILCompiler.MetadataTransform/tests/PrimaryMetadataAssembly/PrimaryMetadataAssembly.csproj b/src/ILCompiler.MetadataTransform/tests/PrimaryMetadataAssembly/PrimaryMetadataAssembly.csproj
index 82b325adf..a64f83430 100644
--- a/src/ILCompiler.MetadataTransform/tests/PrimaryMetadataAssembly/PrimaryMetadataAssembly.csproj
+++ b/src/ILCompiler.MetadataTransform/tests/PrimaryMetadataAssembly/PrimaryMetadataAssembly.csproj
@@ -5,7 +5,7 @@
<AssemblyName>PrimaryMetadataAssembly</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<IsCoreAssembly>true</IsCoreAssembly>
- <RunTestsForProject>false</RunTestsForProject>
+ <SkipTestRun>true</SkipTestRun>
</PropertyGroup>
<ItemGroup>
<Compile Include="Platform.cs" />
diff --git a/src/ILCompiler.MetadataTransform/tests/SampleMetadataAssembly/SampleMetadataAssembly.csproj b/src/ILCompiler.MetadataTransform/tests/SampleMetadataAssembly/SampleMetadataAssembly.csproj
index 04ff2298d..796a387b6 100644
--- a/src/ILCompiler.MetadataTransform/tests/SampleMetadataAssembly/SampleMetadataAssembly.csproj
+++ b/src/ILCompiler.MetadataTransform/tests/SampleMetadataAssembly/SampleMetadataAssembly.csproj
@@ -4,7 +4,7 @@
<OutputType>Library</OutputType>
<AssemblyName>SampleMetadataAssembly</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
- <RunTestsForProject>false</RunTestsForProject>
+ <SkipTestRun>true</SkipTestRun>
</PropertyGroup>
<ItemGroup>
diff --git a/src/ILCompiler.MetadataTransform/tests/SampleWinRTMetadataAssembly/SampleWinRTMetadataAssembly.csproj b/src/ILCompiler.MetadataTransform/tests/SampleWinRTMetadataAssembly/SampleWinRTMetadataAssembly.csproj
index 514982407..e228feb1f 100644
--- a/src/ILCompiler.MetadataTransform/tests/SampleWinRTMetadataAssembly/SampleWinRTMetadataAssembly.csproj
+++ b/src/ILCompiler.MetadataTransform/tests/SampleWinRTMetadataAssembly/SampleWinRTMetadataAssembly.csproj
@@ -4,7 +4,7 @@
<OutputType>Library</OutputType>
<AssemblyName>SampleWinRTMetadataAssembly</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
- <RunTestsForProject>false</RunTestsForProject>
+ <SkipTestRun>true</SkipTestRun>
</PropertyGroup>
<ItemGroup>
diff --git a/src/ILCompiler.MetadataTransform/tests/SimpleTests.cs b/src/ILCompiler.MetadataTransform/tests/SimpleTests.cs
index b1d6d06a6..e3035321e 100644
--- a/src/ILCompiler.MetadataTransform/tests/SimpleTests.cs
+++ b/src/ILCompiler.MetadataTransform/tests/SimpleTests.cs
@@ -10,6 +10,8 @@ using Cts = Internal.TypeSystem;
using Xunit;
+#pragma warning disable xUnit2013 // Do not use Assert.Equal() to check for collection size
+
namespace MetadataTransformTests
{
public class SimpleTests
diff --git a/src/ILCompiler.MetadataTransform/tests/WindowsWinRTMetadataAssembly/WindowsWinRTMetadataAssembly.csproj b/src/ILCompiler.MetadataTransform/tests/WindowsWinRTMetadataAssembly/WindowsWinRTMetadataAssembly.csproj
index d6f36ace1..05853a005 100644
--- a/src/ILCompiler.MetadataTransform/tests/WindowsWinRTMetadataAssembly/WindowsWinRTMetadataAssembly.csproj
+++ b/src/ILCompiler.MetadataTransform/tests/WindowsWinRTMetadataAssembly/WindowsWinRTMetadataAssembly.csproj
@@ -4,7 +4,7 @@
<OutputType>Library</OutputType>
<AssemblyName>WindowsWinRTMetadataAssembly</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
- <RunTestsForProject>false</RunTestsForProject>
+ <SkipTestRun>true</SkipTestRun>
</PropertyGroup>
<ItemGroup>
diff --git a/src/ILCompiler.TypeSystem/tests/CoreTestAssembly/CoreTestAssembly.csproj b/src/ILCompiler.TypeSystem/tests/CoreTestAssembly/CoreTestAssembly.csproj
index 447bf566f..efdb81aa4 100644
--- a/src/ILCompiler.TypeSystem/tests/CoreTestAssembly/CoreTestAssembly.csproj
+++ b/src/ILCompiler.TypeSystem/tests/CoreTestAssembly/CoreTestAssembly.csproj
@@ -5,7 +5,7 @@
<AssemblyName>CoreTestAssembly</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<IsCoreAssembly>true</IsCoreAssembly>
- <RunTestsForProject>false</RunTestsForProject>
+ <SkipTestRun>true</SkipTestRun>
</PropertyGroup>
<ItemGroup>
<Compile Include="Canonicalization.cs" />
diff --git a/src/ILCompiler.TypeSystem/tests/GCPointerMapTests.cs b/src/ILCompiler.TypeSystem/tests/GCPointerMapTests.cs
index 2ae1d2edf..7193a800b 100644
--- a/src/ILCompiler.TypeSystem/tests/GCPointerMapTests.cs
+++ b/src/ILCompiler.TypeSystem/tests/GCPointerMapTests.cs
@@ -35,19 +35,19 @@ namespace TypeSystemTests
{
var map = GCPointerMap.FromInstanceLayout(classWithArrayFields);
- Assert.Equal(map.Size, 3);
+ Assert.Equal(3, map.Size);
Assert.Equal("011", map.ToString());
}
{
var map = GCPointerMap.FromInstanceLayout(classWithStringField);
- Assert.Equal(map.Size, 4);
+ Assert.Equal(4, map.Size);
Assert.Equal("0010", map.ToString());
}
{
var map = GCPointerMap.FromInstanceLayout(mixedStruct);
- Assert.Equal(map.Size, 5);
+ Assert.Equal(5, map.Size);
Assert.Equal("01001", map.ToString());
}
@@ -60,19 +60,19 @@ namespace TypeSystemTests
{
var map = GCPointerMap.FromInstanceLayout(doubleMixedStructLayout);
- Assert.Equal(map.Size, 10);
+ Assert.Equal(10, map.Size);
Assert.Equal("0100101001", map.ToString());
}
{
var map = GCPointerMap.FromInstanceLayout(explicitlyFarPointer);
- Assert.Equal(map.Size, 117);
+ Assert.Equal(117, map.Size);
Assert.Equal("100000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000001001", map.ToString());
}
{
var map = GCPointerMap.FromInstanceLayout(struct32GcPointers);
- Assert.Equal(map.Size, 32);
+ Assert.Equal(32, map.Size);
Assert.Equal("11111111111111111111111111111111", map.ToString());
}
}
@@ -82,7 +82,7 @@ namespace TypeSystemTests
{
MetadataType mixedStaticClass = _testModule.GetType("GCPointerMap", "MixedStaticClass");
var map = GCPointerMap.FromStaticLayout(mixedStaticClass);
- Assert.Equal(map.Size, 12);
+ Assert.Equal(12, map.Size);
Assert.Equal("010100101001", map.ToString());
}
@@ -91,7 +91,7 @@ namespace TypeSystemTests
{
MetadataType mixedThreadStaticClass = _testModule.GetType("GCPointerMap", "MixedThreadStaticClass");
var map = GCPointerMap.FromThreadStaticLayout(mixedThreadStaticClass);
- Assert.Equal(map.Size, 14);
+ Assert.Equal(14, map.Size);
Assert.Equal("00010010100110", map.ToString());
}
}
diff --git a/src/ILCompiler.TypeSystem/tests/GenericTypeAndMethodTests.cs b/src/ILCompiler.TypeSystem/tests/GenericTypeAndMethodTests.cs
index 66698ff0b..ddfe97e26 100644
--- a/src/ILCompiler.TypeSystem/tests/GenericTypeAndMethodTests.cs
+++ b/src/ILCompiler.TypeSystem/tests/GenericTypeAndMethodTests.cs
@@ -33,8 +33,7 @@ namespace TypeSystemTests
// Verify that we get just type definitions.
Assert.NotNull(t);
Assert.True(t.IsTypeDefinition);
- Assert.NotNull(t.Instantiation);
- Assert.Equal(t.Instantiation.Length, 1);
+ Assert.Equal(1, t.Instantiation.Length);
Assert.True(t.Instantiation[0].IsTypeDefinition);
// Verify that we got a method definition
@@ -50,14 +49,13 @@ namespace TypeSystemTests
// Verify properties of the instantiated type
Assert.NotNull(instantiatedType);
Assert.False(instantiatedType.IsTypeDefinition);
- Assert.NotNull(instantiatedType.Instantiation);
- Assert.Equal(instantiatedType.Instantiation.Length, 1);
- Assert.Equal(instantiatedType.Instantiation[0], _context.GetWellKnownType(WellKnownType.Int32));
+ Assert.Equal(1, instantiatedType.Instantiation.Length);
+ Assert.Equal(_context.GetWellKnownType(WellKnownType.Int32), instantiatedType.Instantiation[0]);
// Verify that we get an instantiated method with the proper signature
MethodDesc fooInstantiatedMethod = instantiatedType.GetMethods().First(m => m.Name == "Foo");
Assert.False(fooInstantiatedMethod.IsTypicalMethodDefinition);
- Assert.Equal(fooInstantiatedMethod.Signature.ReturnType, _context.GetWellKnownType(WellKnownType.Int32));
+ Assert.Equal(_context.GetWellKnownType(WellKnownType.Int32), fooInstantiatedMethod.Signature.ReturnType);
Assert.Same(fooInstantiatedMethod.GetTypicalMethodDefinition(), fooMethod);
// This is not a generic method, so they should be the same
Assert.Same(fooInstantiatedMethod.GetMethodDefinition(), fooInstantiatedMethod);
@@ -137,16 +135,16 @@ namespace TypeSystemTests
InstantiatedType genericOfIntString = genericOpenType.MakeInstantiatedType(intType, stringType);
InstantiatedType genericOfIntObject = genericOpenType.MakeInstantiatedType(intType, objectType);
- Assert.Equal(true, genericOfCharObject.IsConstructedOverType(new TypeDesc[] { charType }));
- Assert.Equal(true, genericOfCharObject.IsConstructedOverType(new TypeDesc[] { objectType }));
- Assert.Equal(false, genericOfCharObject.IsConstructedOverType(new TypeDesc[] { intType }));
- Assert.Equal(false, genericOfCharObject.IsConstructedOverType(new TypeDesc[] { stringType }));
- Assert.Equal(false, genericOfCharObject.IsConstructedOverType(new TypeDesc[] { genericOpenType }));
+ Assert.True(genericOfCharObject.IsConstructedOverType(new TypeDesc[] { charType }));
+ Assert.True(genericOfCharObject.IsConstructedOverType(new TypeDesc[] { objectType }));
+ Assert.False(genericOfCharObject.IsConstructedOverType(new TypeDesc[] { intType }));
+ Assert.False(genericOfCharObject.IsConstructedOverType(new TypeDesc[] { stringType }));
+ Assert.False(genericOfCharObject.IsConstructedOverType(new TypeDesc[] { genericOpenType }));
- Assert.Equal(true, genericOfCharString.IsConstructedOverType(new TypeDesc[] { charType }));
- Assert.Equal(false, genericOfCharString.IsConstructedOverType(new TypeDesc[] { objectType }));
- Assert.Equal(false, genericOfCharString.IsConstructedOverType(new TypeDesc[] { intType }));
- Assert.Equal(true, genericOfCharString.IsConstructedOverType(new TypeDesc[] { stringType }));
+ Assert.True(genericOfCharString.IsConstructedOverType(new TypeDesc[] { charType }));
+ Assert.False(genericOfCharString.IsConstructedOverType(new TypeDesc[] { objectType }));
+ Assert.False(genericOfCharString.IsConstructedOverType(new TypeDesc[] { intType }));
+ Assert.True(genericOfCharString.IsConstructedOverType(new TypeDesc[] { stringType }));
// Test direct replacement
TypeDesc testDirectReplaceAllTypes = genericOfCharObject.ReplaceTypesInConstructionOfType(new TypeDesc[] { charType, objectType }, new TypeDesc[] { intType, stringType });
@@ -197,8 +195,8 @@ namespace TypeSystemTests
TypeDesc testReplaceTypeInPointer = charPointer.ReplaceTypesInConstructionOfType(new TypeDesc[] { charType }, new TypeDesc[] { intType });
Assert.Equal(intPointer, testReplaceTypeInPointer);
- Assert.Equal(true, charPointer.IsConstructedOverType(new TypeDesc[] { charType }));
- Assert.Equal(false, charPointer.IsConstructedOverType(new TypeDesc[] { intType }));
+ Assert.True(charPointer.IsConstructedOverType(new TypeDesc[] { charType }));
+ Assert.False(charPointer.IsConstructedOverType(new TypeDesc[] { intType }));
// Test byref
TypeDesc charByRef = _context.GetByRefType(charType);
@@ -206,13 +204,13 @@ namespace TypeSystemTests
TypeDesc testReplaceTypeInByRef = charByRef.ReplaceTypesInConstructionOfType(new TypeDesc[] { charType }, new TypeDesc[] { intType });
Assert.Equal(intByRef, testReplaceTypeInByRef);
- Assert.Equal(true, charByRef.IsConstructedOverType(new TypeDesc[] { charType }));
- Assert.Equal(false, charByRef.IsConstructedOverType(new TypeDesc[] { intType }));
+ Assert.True(charByRef.IsConstructedOverType(new TypeDesc[] { charType }));
+ Assert.False(charByRef.IsConstructedOverType(new TypeDesc[] { intType }));
// Test replace type entirely
TypeDesc testReplaceTypeEntirely = charByRef.ReplaceTypesInConstructionOfType(new TypeDesc[] { charByRef }, new TypeDesc[] { intByRef });
Assert.Equal(intByRef, testReplaceTypeEntirely);
- Assert.Equal(true, charByRef.IsConstructedOverType(new TypeDesc[] { charByRef }));
+ Assert.True(charByRef.IsConstructedOverType(new TypeDesc[] { charByRef }));
}
[Fact]
@@ -273,4 +271,4 @@ namespace TypeSystemTests
Assert.Equal(getMethodOnMDCharArray, testArrayMethodCase);
}
}
-} \ No newline at end of file
+}
diff --git a/src/ILCompiler.TypeSystem/tests/ILTestAssembly/ILTestAssembly.ilproj b/src/ILCompiler.TypeSystem/tests/ILTestAssembly/ILTestAssembly.ilproj
index 5d65099c4..bce9574f9 100644
--- a/src/ILCompiler.TypeSystem/tests/ILTestAssembly/ILTestAssembly.ilproj
+++ b/src/ILCompiler.TypeSystem/tests/ILTestAssembly/ILTestAssembly.ilproj
@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<AssemblyName>ILTestAssembly</AssemblyName>
- <RunTestsForProject>false</RunTestsForProject>
+ <SkipTestRun>true</SkipTestRun>
</PropertyGroup>
<ItemGroup>
diff --git a/src/ILCompiler.TypeSystem/tests/TypeSystem.Tests.csproj b/src/ILCompiler.TypeSystem/tests/TypeSystem.Tests.csproj
index 3c4e78516..cd4d34c18 100644
--- a/src/ILCompiler.TypeSystem/tests/TypeSystem.Tests.csproj
+++ b/src/ILCompiler.TypeSystem/tests/TypeSystem.Tests.csproj
@@ -4,16 +4,16 @@
<OutputType>Library</OutputType>
<AssemblyName>TypeSystem.Tests</AssemblyName>
<RootNamespace>TypeSystem.Tests</RootNamespace>
- <TargetFramework>netstandard1.3</TargetFramework>
+ <TargetFramework>netstandard2.0</TargetFramework>
<!-- Don't warn if some dependencies were rolled forward -->
<NoWarn>$(NoWarn);NU1603</NoWarn>
</PropertyGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.DotNet.BuildTools.TestSuite">
- <Version>$(XunitNetcoreExtensionsVersion)</Version>
+ <PackageReference Include="xunit">
+ <Version>$(XUnitPackageVersion)</Version>
</PackageReference>
- <PackageReference Include="Microsoft.xunit.netcore.extensions">
- <Version>$(XunitNetcoreExtensionsVersion)</Version>
+ <PackageReference Include="Microsoft.DotNet.XUnitExtensions">
+ <Version>$(MicrosoftDotNetXUnitExtensionsVersion)</Version>
</PackageReference>
<PackageReference Include="System.Reflection.Metadata">
<Version>1.4.2</Version>
diff --git a/src/ILCompiler.TypeSystem/tests/UniversalGenericFieldLayoutTests.cs b/src/ILCompiler.TypeSystem/tests/UniversalGenericFieldLayoutTests.cs
index d55fb8cf8..8258cadf9 100644
--- a/src/ILCompiler.TypeSystem/tests/UniversalGenericFieldLayoutTests.cs
+++ b/src/ILCompiler.TypeSystem/tests/UniversalGenericFieldLayoutTests.cs
@@ -268,7 +268,7 @@ namespace TypeSystemTests
Assert.Equal(LayoutInt.Indeterminate, genOfUUU.GetFields().ElementAt(2).Offset);
}
- public void TestIndeterminatedNestedStructFieldPerContext(TypeSystemContext context, ModuleDesc testModule, out InstantiatedType genOfIntNestedInt, out InstantiatedType genOfLongNestedInt)
+ private void TestIndeterminatedNestedStructFieldPerContext(TypeSystemContext context, ModuleDesc testModule, out InstantiatedType genOfIntNestedInt, out InstantiatedType genOfLongNestedInt)
{
// Given a struct with all field universal, what is the layout?
MetadataType tGen = testModule.GetType("GenericTypes", "GenStruct`3");
@@ -310,7 +310,7 @@ namespace TypeSystemTests
Assert.Equal(LayoutInt.Indeterminate, genOfLongNestedInt.InstanceByteAlignment);
}
- public void AssertClassIndeterminateSize(TypeSystemContext context, MetadataType type, LayoutInt expectedIndeterminateByteAlignment)
+ private void AssertClassIndeterminateSize(TypeSystemContext context, MetadataType type, LayoutInt expectedIndeterminateByteAlignment)
{
Assert.Equal(context.Target.LayoutPointerSize, type.InstanceFieldAlignment);
Assert.Equal(context.Target.LayoutPointerSize, type.InstanceFieldSize);
diff --git a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
index 2701adb4b..e828d6d97 100644
--- a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
+++ b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
@@ -54,6 +54,7 @@ namespace Internal.IL
private readonly byte[] _ilBytes;
private MethodDebugInformation _debugInformation;
private LLVMMetadataRef _debugFunction;
+ private TypeDesc _constrainedType = null;
/// <summary>
/// Stack of values pushed onto the IL stack: locals, arguments, values, function pointer, ...
@@ -503,6 +504,10 @@ namespace Internal.IL
private void EndImportingInstruction()
{
+ // If this was constrained used in a call, it's already been cleared,
+ // but if it was on some other instruction, it shoudln't carry forward
+ _constrainedType = null;
+
// Reset the debug position so it doesn't end up applying to the wrong instructions
LLVM.SetCurrentDebugLocation(_builder, default(LLVMValueRef));
}
@@ -1198,7 +1203,7 @@ namespace Internal.IL
}
}
- if (callee.IsPInvoke || (callee.IsInternalCall && callee.HasCustomAttribute("System.Runtime", "RuntimeImportAttribute")))
+ if (callee.IsRawPInvoke() || (callee.IsInternalCall && callee.HasCustomAttribute("System.Runtime", "RuntimeImportAttribute")))
{
ImportRawPInvoke(callee);
return;
@@ -1267,12 +1272,6 @@ namespace Internal.IL
}
}
- // we don't really have virtual call support, but we'll treat it as direct for now
- if (opcode != ILOpcode.call && opcode != ILOpcode.callvirt && opcode != ILOpcode.newobj)
- {
- throw new NotImplementedException();
- }
-
if (opcode == ILOpcode.newobj && callee.OwningType.IsDelegate)
{
FunctionPointerEntry functionPointer = ((FunctionPointerEntry)_stack.Peek());
@@ -1284,10 +1283,12 @@ namespace Internal.IL
}
}
- HandleCall(callee, callee.Signature, opcode);
+ TypeDesc localConstrainedType = _constrainedType;
+ _constrainedType = null;
+ HandleCall(callee, callee.Signature, opcode, localConstrainedType);
}
- private LLVMValueRef LLVMFunctionForMethod(MethodDesc callee, StackEntry thisPointer, bool isCallVirt)
+ private LLVMValueRef LLVMFunctionForMethod(MethodDesc callee, StackEntry thisPointer, bool isCallVirt, TypeDesc constrainedType)
{
string calleeName = _compilation.NameMangler.GetMangledMethodName(callee).ToString();
@@ -1321,17 +1322,23 @@ namespace Internal.IL
isValueTypeCall = true;
}
}
- if (callee.OwningType.IsInterface)
+
+ if(constrainedType != null && constrainedType.IsValueType)
{
- // For value types, devirtualize the call
- if (isValueTypeCall)
+ isValueTypeCall = true;
+ }
+
+ if (isValueTypeCall)
+ {
+ if (constrainedType != null)
+ {
+ targetMethod = constrainedType.TryResolveConstraintMethodApprox(callee.OwningType, callee, out _);
+ }
+ else if (callee.OwningType.IsInterface)
{
targetMethod = parameterType.ResolveInterfaceMethodTarget(callee);
}
- }
- else
- {
- if (isValueTypeCall)
+ else
{
targetMethod = parameterType.FindVirtualFunctionTargetMethodOnObjectType(callee);
}
@@ -1584,7 +1591,7 @@ namespace Internal.IL
return false;
}
- private void HandleCall(MethodDesc callee, MethodSignature signature, ILOpcode opcode = ILOpcode.call, LLVMValueRef calliTarget = default(LLVMValueRef))
+ private void HandleCall(MethodDesc callee, MethodSignature signature, ILOpcode opcode = ILOpcode.call, TypeDesc constrainedType = null, LLVMValueRef calliTarget = default(LLVMValueRef))
{
var parameterCount = signature.Length + (signature.IsStatic ? 0 : 1);
// The last argument is the top of the stack. We need to reverse them and store starting at the first argument
@@ -1593,10 +1600,34 @@ namespace Internal.IL
{
argumentValues[argumentValues.Length - i - 1] = _stack.Pop();
}
- PushNonNull(HandleCall(callee, signature, argumentValues, opcode, calliTarget));
+
+ if (constrainedType != null)
+ {
+ if (signature.IsStatic)
+ {
+ // Constrained call on static method
+ ThrowHelper.ThrowInvalidProgramException(ExceptionStringID.InvalidProgramSpecific, _method);
+ }
+ StackEntry thisByRef = argumentValues[0];
+ if (thisByRef.Kind != StackValueKind.ByRef)
+ {
+ // Constrained call without byref
+ ThrowHelper.ThrowInvalidProgramException(ExceptionStringID.InvalidProgramSpecific, _method);
+ }
+
+ // If this is a constrained call and the 'this' pointer is a reference type, it's a byref,
+ // dereference it before calling.
+ if (!constrainedType.IsValueType)
+ {
+ TypeDesc objectType = thisByRef.Type.GetParameterType();
+ argumentValues[0] = new LoadExpressionEntry(StackValueKind.ObjRef, "thisPtr", thisByRef.ValueAsType(objectType, _builder), objectType);
+ }
+ }
+
+ PushNonNull(HandleCall(callee, signature, argumentValues, opcode, constrainedType, calliTarget));
}
- private ExpressionEntry HandleCall(MethodDesc callee, MethodSignature signature, StackEntry[] argumentValues, ILOpcode opcode = ILOpcode.call, LLVMValueRef calliTarget = default(LLVMValueRef), TypeDesc forcedReturnType = null)
+ private ExpressionEntry HandleCall(MethodDesc callee, MethodSignature signature, StackEntry[] argumentValues, ILOpcode opcode = ILOpcode.call, TypeDesc constrainedType = null, LLVMValueRef calliTarget = default(LLVMValueRef), TypeDesc forcedReturnType = null)
{
if (opcode == ILOpcode.callvirt && callee.IsVirtual)
{
@@ -1687,7 +1718,7 @@ namespace Internal.IL
}
else
{
- fn = LLVMFunctionForMethod(callee, signature.IsStatic ? null : argumentValues[0], opcode == ILOpcode.callvirt);
+ fn = LLVMFunctionForMethod(callee, signature.IsStatic ? null : argumentValues[0], opcode == ILOpcode.callvirt, constrainedType);
}
LLVMValueRef llvmReturn = LLVM.BuildCall(_builder, fn, llvmArgs.ToArray(), string.Empty);
@@ -1955,7 +1986,7 @@ namespace Internal.IL
private void ImportCalli(int token)
{
MethodSignature methodSignature = (MethodSignature)_methodIL.GetObject(token);
- HandleCall(null, methodSignature, ILOpcode.calli, ((ExpressionEntry)_stack.Pop()).ValueAsType(LLVM.PointerType(GetLLVMSignatureForMethod(methodSignature), 0), _builder));
+ HandleCall(null, methodSignature, ILOpcode.calli, calliTarget: ((ExpressionEntry)_stack.Pop()).ValueAsType(LLVM.PointerType(GetLLVMSignatureForMethod(methodSignature), 0), _builder));
}
private void ImportLdFtn(int token, ILOpcode opCode)
@@ -1967,7 +1998,7 @@ namespace Internal.IL
StackEntry thisPointer = _stack.Pop();
if (method.IsVirtual)
{
- targetLLVMFunction = LLVMFunctionForMethod(method, thisPointer, true);
+ targetLLVMFunction = LLVMFunctionForMethod(method, thisPointer, true, null);
AddVirtualMethodReference(method);
}
}
@@ -2652,6 +2683,7 @@ namespace Internal.IL
private void ImportConstrainedPrefix(int token)
{
+ _constrainedType = (TypeDesc)_methodIL.GetObject(token);
}
private void ImportNoPrefix(byte mask)
diff --git a/src/ILVerification/tests/ILMethodTester.cs b/src/ILVerification/tests/ILMethodTester.cs
index eb92c3dcb..871045ed0 100644
--- a/src/ILVerification/tests/ILMethodTester.cs
+++ b/src/ILVerification/tests/ILMethodTester.cs
@@ -20,7 +20,7 @@ namespace ILVerification.Tests
void TestMethodsWithValidIL(ValidILTestCase validIL)
{
var results = Verify(validIL);
- Assert.Equal(0, results.Count());
+ Assert.Empty(results);
}
[Theory(DisplayName = "")]
diff --git a/src/ILVerification/tests/ILTests/AccessTests.ilproj b/src/ILVerification/tests/ILTests/AccessTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/AccessTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/AccessTestsExtern.ilproj b/src/ILVerification/tests/ILTests/AccessTestsExtern.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/AccessTestsExtern.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/AccessTestsFriend.ilproj b/src/ILVerification/tests/ILTests/AccessTestsFriend.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/AccessTestsFriend.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ArrayTests.ilproj b/src/ILVerification/tests/ILTests/ArrayTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ArrayTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/BasicArithmeticTests.ilproj b/src/ILVerification/tests/ILTests/BasicArithmeticTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/BasicArithmeticTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/BranchingTests.ilproj b/src/ILVerification/tests/ILTests/BranchingTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/BranchingTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/CallTests.ilproj b/src/ILVerification/tests/ILTests/CallTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/CallTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/CastingTests.ilproj b/src/ILVerification/tests/ILTests/CastingTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/CastingTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ComparisonTests.ilproj b/src/ILVerification/tests/ILTests/ComparisonTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ComparisonTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/DelegateTests.ilproj b/src/ILVerification/tests/ILTests/DelegateTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/DelegateTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ExceptionRegionTests.ilproj b/src/ILVerification/tests/ILTests/ExceptionRegionTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ExceptionRegionTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/FieldTests.ilproj b/src/ILVerification/tests/ILTests/FieldTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/FieldTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/FtnTests.ilproj b/src/ILVerification/tests/ILTests/FtnTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/FtnTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ILTests.targets b/src/ILVerification/tests/ILTests/ILTests.targets
new file mode 100644
index 000000000..22983bd3a
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ILTests.targets
@@ -0,0 +1,17 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+
+ <PropertyGroup>
+ <OutputType>Library</OutputType>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <OutputPath>$(BaseOutputPath)$(OSPlatformConfig)/ILVerification.Tests/Tests</OutputPath>
+ <SkipTestRun>true</SkipTestRun>
+ <SkipSigning>true</SkipSigning>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Compile Include="$(MSBuildProjectName).il" />
+ </ItemGroup>
+
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/LoadStoreIndirectTests.ilproj b/src/ILVerification/tests/ILTests/LoadStoreIndirectTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/LoadStoreIndirectTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/NewobjTests.ilproj b/src/ILVerification/tests/ILTests/NewobjTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/NewobjTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/PrefixTests.ilproj b/src/ILVerification/tests/ILTests/PrefixTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/PrefixTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ReturnTests.ilproj b/src/ILVerification/tests/ILTests/ReturnTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ReturnTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ShiftTests.ilproj b/src/ILVerification/tests/ILTests/ShiftTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ShiftTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ThisStateTests.ilproj b/src/ILVerification/tests/ILTests/ThisStateTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ThisStateTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILTests/ValueTypeTests.ilproj b/src/ILVerification/tests/ILTests/ValueTypeTests.ilproj
new file mode 100644
index 000000000..8e8765d14
--- /dev/null
+++ b/src/ILVerification/tests/ILTests/ValueTypeTests.ilproj
@@ -0,0 +1,3 @@
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="ILTests.targets" />
+</Project>
diff --git a/src/ILVerification/tests/ILVerification.Tests.csproj b/src/ILVerification/tests/ILVerification.Tests.csproj
index cb585d1ea..237655ccc 100644
--- a/src/ILVerification/tests/ILVerification.Tests.csproj
+++ b/src/ILVerification/tests/ILVerification.Tests.csproj
@@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Library</OutputType>
- <TargetFramework>netstandard1.5</TargetFramework>
+ <TargetFramework>netstandard2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
@@ -14,10 +14,8 @@
</ItemGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170427-09" />
- <PackageReference Include="xunit" Version="2.2.0" />
- <PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
- <PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
+ <PackageReference Include="xunit" Version="$(XUnitPackageVersion)" />
+ <PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
<ItemGroup>
@@ -25,6 +23,13 @@
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="ILTests\*.ilproj">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ <OutputItemType>Content</OutputItemType>
+ </ProjectReference>
+ </ItemGroup>
+
+ <ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
diff --git a/src/ILVerification/tests/TestDataLoader.cs b/src/ILVerification/tests/TestDataLoader.cs
index a91132b91..4184a5f6f 100644
--- a/src/ILVerification/tests/TestDataLoader.cs
+++ b/src/ILVerification/tests/TestDataLoader.cs
@@ -20,19 +20,17 @@ namespace ILVerification.Tests
{
/// <summary>
/// Parses the methods in the test assemblies.
- /// It loads all assemblies from the test folder defined in <code>TestDataLoader.TESTASSEMBLYPATH</code>
+ /// It loads all assemblies from the test folder defined in <code>TestDataLoader.TestAssemblyPath</code>
/// This class feeds the xunit Theories
/// </summary>
class TestDataLoader
{
/// <summary>
- /// The folder with the binaries which are compiled from the test driver IL Code
- /// Currently the test .il code is built manually, but the plan is to have a ProjectReference and automatically build the .il files.
- /// See: https://github.com/dotnet/corert/pull/3725#discussion_r118820770
+ /// The folder with the test binaries
/// </summary>
- public static string TESTASSEMBLYPATH = @"..\..\..\ILTests\";
+ private const string TestAssemblyPath = @"Tests\";
- private const string SPECIALTEST_PREFIX = "special.";
+ private const string SpecialTestPrefix = "special.";
/// <summary>
/// Returns all methods that contain valid IL code based on the following naming convention:
@@ -129,11 +127,11 @@ namespace ILVerification.Tests
private static MethodDefinitionHandle HandleSpecialTests(string[] methodParams, EcmaMethod method)
{
- if (!methodParams[0].StartsWith(SPECIALTEST_PREFIX))
+ if (!methodParams[0].StartsWith(SpecialTestPrefix))
return method.Handle;
// Cut off special prefix
- var specialParams = methodParams[0].Substring(SPECIALTEST_PREFIX.Length);
+ var specialParams = methodParams[0].Substring(SpecialTestPrefix.Length);
// Get friendly name / special name
int delimiter = specialParams.IndexOf('.');
@@ -152,7 +150,7 @@ namespace ILVerification.Tests
private static IEnumerable<string> GetAllTestDlls()
{
- foreach (var item in Directory.GetFiles(TESTASSEMBLYPATH))
+ foreach (var item in Directory.GetFiles(TestAssemblyPath))
{
if (item.ToLower().EndsWith(".dll"))
{
@@ -167,7 +165,7 @@ namespace ILVerification.Tests
foreach (var fileName in GetAllTestDlls())
{
- simpleNameToPathMap.Add(Path.GetFileNameWithoutExtension(fileName), TESTASSEMBLYPATH + fileName);
+ simpleNameToPathMap.Add(Path.GetFileNameWithoutExtension(fileName), TestAssemblyPath + fileName);
}
Assembly coreAssembly = typeof(object).GetTypeInfo().Assembly;
diff --git a/src/ILVerify/README.md b/src/ILVerify/README.md
index 60aa79f48..286c70d50 100644
--- a/src/ILVerify/README.md
+++ b/src/ILVerify/README.md
@@ -27,18 +27,6 @@ The code is split into three projects:
To test the ILVerification library we have small methods checked in as .il files testing specific verification scenarios. These tests live under [src/ILVerification/tests/ILTests](../ILVerification/tests/ILTests). Tests are grouped into .il files based on functionalities they test. There is no strict policy here, the goal is to have a few dozen .il files instead of thousands containing each only a single method.
-Currently the IL files are NOT compiled automatically. You have to compile manually (We want to automate this step later):
-
-```
-ilasm [filename.il] /dll /ERROR
-```
-
-Note: if you run the tests and get an error similar to this then it means that the .il files were not compiled, or none of them contained methods that follow the naming convention described below:
-
-```
-Result Message: System.InvalidOperationException : No data found for ILVerify.Tests.ILMethodTester.TestMethodsWithInvalidIL
-```
-
The test project itself is under [src/ILVerification/tests](../ILVerification/tests)
Method names in the .il files must follow the following naming convention:
diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs
index 1f8c0b06a..b309eb5aa 100644
--- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs
+++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs
@@ -18,12 +18,12 @@
//
// PRINCIPLE: EventSource - ETW decoupling
//
-// Conceptually and EventSouce is something takes event logging data from the source methods
-// To the EventListener that can subscribe them. Note that CONCEPTUALLY EVENTSOURCES DON'T
-// KNOW ABOUT ETW!. The MODEL of the system is that there is a special EventListener Which
+// Conceptually an EventSouce is something that takes event logging data from the source methods
+// to the EventListener that can subscribe to them. Note that CONCEPTUALLY EVENTSOURCES DON'T
+// KNOW ABOUT ETW!. The MODEL of the system is that there is a special EventListener which
// we will call the EtwEventListener, that forwards commands from ETW to EventSources and
-// listeners to the EventSources and forwards on those events to ETW. THus the model should
-// be that you DON'T NEED ETW.
+// listens to EventSources and forwards on those events to ETW. Thus the model should
+// be that you DON'T NEED ETW.
//
// Now in actual practice, EventSouce have rather intimate knowledge of ETW and send events
// to it directly, but this can be VIEWED AS AN OPTIMIZATION.
@@ -33,20 +33,20 @@
// There are two ways for event Data to enter the system
// 1) WriteEvent* and friends. This is called the 'contract' based approach because
// you write a method per event which forms a contract that is know at compile time.
-// In this scheme each event is given an EVENTID (small integer). which is its identity
+// In this scheme each event is given an EVENTID (small integer), which is its identity
// 2) Write<T> methods. This is called the 'dynamic' approach because new events
// can be created on the fly. Event identity is determined by the event NAME, and these
// are not quite as efficient at runtime since you have at least a hash table lookup
// on every event write.
//
-// EventSource-EventListener transfer fully support both ways of writing events (either contract
-// based (WriteEvent*) or dynamic (Write<T>). Both way fully support the same set of data
-// types. It is suggested, however, that you use the contract based approach when the event scheme
+// EventSource-EventListener transfer fully supports both ways of writing events (either contract
+// based (WriteEvent*) or dynamic (Write<T>)). Both ways fully support the same set of data
+// types. It is recommended, however, that you use the contract based approach when the event scheme
// is known at compile time (that is whenever possible). It is more efficient, but more importantly
// it makes the contract very explicit, and centralizes all policy about logging. These are good
-// things. The Write<T> API is really meant for more ad-hoc
+// things. The Write<T> API is really meant for more ad-hoc cases.
//
-// Allowed Data.
+// Allowed Data:
//
// Note that EventSource-EventListeners have a conceptual serialization-deserialization that happens
// during the transfer. In particular object identity is not preserved, some objects are morphed,
@@ -57,7 +57,7 @@
// * IEnumerable<T> of valid types T (this include arrays) (* New for V4.6)
// * Explicitly Opted in class or struct with public property Getters over Valid types. (* New for V4.6)
//
-// This set of types is roughly a generalization of JSON support (Basically primitives, bags, and arrays).
+// This set of types is roughly a generalization of JSON support (basically primitives, bags, and arrays).
//
// Explicitly allowed structs include (* New for V4.6)
// * Marked with the EventData attribute
@@ -67,27 +67,27 @@
// When classes are returned in an EventListener, what is returned is something that implements
// IDictionary<string, T>. Thus when objects are passed to an EventSource they are transformed
// into a key-value bag (the IDictionary<string, T>) for consumption in the listener. These
-// are obvious NOT the original objects.
+// are obviously NOT the original objects.
//
-// ETWserialization formats:
+// ETW serialization formats:
//
-// As mentioned conceptually EventSource's send data to EventListeners and there is a conceptual
+// As mentioned, conceptually EventSources send data to EventListeners and there is a conceptual
// copy/morph of that data as described above. In addition the .NET framework supports a conceptual
-// ETWListener that will send the data to then ETW stream. If you use this feature, the data needs
+// ETWListener that will send the data to the ETW stream. If you use this feature, the data needs
// to be serialized in a way that ETW supports. ETW supports the following serialization formats
//
// 1) Manifest Based serialization.
// 2) SelfDescribing serialization (TraceLogging style in the TraceLogging directory)
//
-// A key factor is that the Write<T> method, which support on the fly definition of events, can't
+// A key factor is that the Write<T> method, which supports on the fly definition of events, can't
// support the manifest based serialization because the manifest needs the schema of all events
-// to be known before any events are emitted. This implies the following
+// to be known before any events are emitted. This implies the following:
//
// If you use Write<T> and the output goes to ETW it will use the SelfDescribing format.
// If you use the EventSource(string) constructor for an eventSource (in which you don't
// create a subclass), the default is also to use Self-Describing serialization. In addition
// you can use the EventSoruce(EventSourceSettings) constructor to also explicitly specify
-// Self-Describing serialization format. These effect the WriteEvent* APIs going to ETW.
+// Self-Describing serialization format. These affect the WriteEvent* APIs going to ETW.
//
// Note that none of this ETW serialization logic affects EventListeners. Only the ETW listener.
//
@@ -117,7 +117,7 @@
//
// EventPayload is the internal type that implements the IDictionary<string, object> interface
// The EventListeners will pass back for serialized classes for nested object, but
-// WriteToAllListeners(NAME, Guid*, Guid*, EventPayload) unpacks this uses the fields as if they
+// WriteToAllListeners(NAME, Guid*, Guid*, EventPayload) unpacks this and uses the fields as if they
// were parameters to a method.
//
// The first two are used for the WriteEvent* case, and the later is used for the Write<T> case.
@@ -129,7 +129,7 @@
// WriteMultiMerge(NAME, Options, Types, EventData*)
// WriteMultiMerge(NAME, Options, Types, object[])
// WriteImpl<T> has logic that knows how to serialize (like WriteMultiMerge) but also knows
-// will write it to
+// where it will write it to
//
// All ETW writes eventually call
// EventWriteTransfer (native PINVOKE wrapper)
@@ -146,7 +146,7 @@
// since it is the TraceLoggingTypeInfo structure that knows how to do this. Effectively for a type you
// can call one of these
// WriteMetadata - transforms the type T into serialization meta data blob for that type
-// WriteObjectData - transforms an object of T into serialization meta data blob for that type
+// WriteObjectData - transforms an object of T into serialization data blob for that instance
// GetData - transforms an object of T into its deserialized form suitable for passing to EventListener.
// The first two are used to serialize something for ETW. The second one is used to transform the object
// for use by the EventListener. We also have a 'DecodeObject' method that will take a EventData* and
diff --git a/src/System.Private.CoreLib/shared/System/Guid.cs b/src/System.Private.CoreLib/shared/System/Guid.cs
index 01c0e883f..c57d3c4d9 100644
--- a/src/System.Private.CoreLib/shared/System/Guid.cs
+++ b/src/System.Private.CoreLib/shared/System/Guid.cs
@@ -427,7 +427,7 @@ namespace System
}
// Check for dashes
- bool dashesExistInString = guidString.IndexOf('-') >= 0;
+ bool dashesExistInString = guidString.Contains('-');
if (dashesExistInString)
{
diff --git a/src/System.Private.CoreLib/shared/System/MemoryExtensions.Fast.cs b/src/System.Private.CoreLib/shared/System/MemoryExtensions.Fast.cs
index efd11c9c5..e86ca4fcd 100644
--- a/src/System.Private.CoreLib/shared/System/MemoryExtensions.Fast.cs
+++ b/src/System.Private.CoreLib/shared/System/MemoryExtensions.Fast.cs
@@ -83,20 +83,6 @@ namespace System
return CompareInfo.EqualsOrdinalIgnoreCase(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), span.Length);
}
- // TODO https://github.com/dotnet/corefx/issues/27526
- internal static bool Contains(this ReadOnlySpan<char> source, char value)
- {
- for (int i = 0; i < source.Length; i++)
- {
- if (source[i] == value)
- {
- return true;
- }
- }
-
- return false;
- }
-
/// <summary>
/// Compares the specified <paramref name="span"/> and <paramref name="other"/> using the specified <paramref name="comparisonType"/>,
/// and returns an integer that indicates their relative position in the sort order.
diff --git a/src/System.Private.CoreLib/shared/System/MemoryExtensions.cs b/src/System.Private.CoreLib/shared/System/MemoryExtensions.cs
index 739bc3145..f0937c448 100644
--- a/src/System.Private.CoreLib/shared/System/MemoryExtensions.cs
+++ b/src/System.Private.CoreLib/shared/System/MemoryExtensions.cs
@@ -183,6 +183,56 @@ namespace System
}
/// <summary>
+ /// Searches for the specified value and returns true if found. If not found, returns false. Values are compared using IEquatable{T}.Equals(T).
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="span">The span to search.</param>
+ /// <param name="value">The value to search for.</param>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool Contains<T>(this Span<T> span, T value)
+ where T : IEquatable<T>
+ {
+ if (typeof(T) == typeof(byte))
+ return SpanHelpers.Contains(
+ ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
+ Unsafe.As<T, byte>(ref value),
+ span.Length);
+
+ if (typeof(T) == typeof(char))
+ return SpanHelpers.Contains(
+ ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
+ Unsafe.As<T, char>(ref value),
+ span.Length);
+
+ return SpanHelpers.Contains(ref MemoryMarshal.GetReference(span), value, span.Length);
+ }
+
+ /// <summary>
+ /// Searches for the specified value and returns true if found. If not found, returns false. Values are compared using IEquatable{T}.Equals(T).
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="span">The span to search.</param>
+ /// <param name="value">The value to search for.</param>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static bool Contains<T>(this ReadOnlySpan<T> span, T value)
+ where T : IEquatable<T>
+ {
+ if (typeof(T) == typeof(byte))
+ return SpanHelpers.Contains(
+ ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
+ Unsafe.As<T, byte>(ref value),
+ span.Length);
+
+ if (typeof(T) == typeof(char))
+ return SpanHelpers.Contains(
+ ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
+ Unsafe.As<T, char>(ref value),
+ span.Length);
+
+ return SpanHelpers.Contains(ref MemoryMarshal.GetReference(span), value, span.Length);
+ }
+
+ /// <summary>
/// Searches for the specified value and returns the index of its first occurrence. If not found, returns -1. Values are compared using IEquatable{T}.Equals(T).
/// </summary>
/// <param name="span">The span to search.</param>
@@ -196,6 +246,7 @@ namespace System
ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
Unsafe.As<T, byte>(ref value),
span.Length);
+
if (typeof(T) == typeof(char))
return SpanHelpers.IndexOf(
ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
@@ -238,6 +289,7 @@ namespace System
ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
Unsafe.As<T, byte>(ref value),
span.Length);
+
if (typeof(T) == typeof(char))
return SpanHelpers.LastIndexOf(
ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
@@ -322,6 +374,7 @@ namespace System
ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
Unsafe.As<T, byte>(ref value),
span.Length);
+
if (typeof(T) == typeof(char))
return SpanHelpers.IndexOf(
ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
@@ -364,6 +417,7 @@ namespace System
ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)),
Unsafe.As<T, byte>(ref value),
span.Length);
+
if (typeof(T) == typeof(char))
return SpanHelpers.LastIndexOf(
ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)),
diff --git a/src/System.Private.CoreLib/shared/System/Number.Formatting.cs b/src/System.Private.CoreLib/shared/System/Number.Formatting.cs
index 106fd153e..3d3c15bf7 100644
--- a/src/System.Private.CoreLib/shared/System/Number.Formatting.cs
+++ b/src/System.Private.CoreLib/shared/System/Number.Formatting.cs
@@ -301,7 +301,7 @@ namespace System
if (fmt != 0)
{
- NumberToString(ref sb, ref number, fmt, digits, info, isDecimal:true);
+ NumberToString(ref sb, ref number, fmt, digits, info);
}
else
{
@@ -327,7 +327,7 @@ namespace System
if (fmt != 0)
{
- NumberToString(ref sb, ref number, fmt, digits, info, isDecimal: true);
+ NumberToString(ref sb, ref number, fmt, digits, info);
}
else
{
@@ -342,6 +342,7 @@ namespace System
char* buffer = number.digits;
number.precision = DecimalPrecision;
number.sign = d.IsNegative;
+ number.kind = NumberBufferKind.Decimal;
char* p = buffer + DecimalPrecision;
while ((d.Mid | d.High) != 0)
@@ -388,6 +389,7 @@ namespace System
char fmt = ParseFormatSpecifier(format, out int digits);
int precision = DoublePrecision;
NumberBuffer number = default;
+ number.kind = NumberBufferKind.Double;
switch (fmt)
{
@@ -409,12 +411,12 @@ namespace System
if (NumberToDouble(ref number) == value)
{
- NumberToString(ref sb, ref number, 'G', DoublePrecision, info, isDecimal: false);
+ NumberToString(ref sb, ref number, 'G', DoublePrecision, info);
}
else
{
DoubleToNumber(value, 17, ref number);
- NumberToString(ref sb, ref number, 'G', 17, info, isDecimal: false);
+ NumberToString(ref sb, ref number, 'G', 17, info);
}
return null;
@@ -451,7 +453,7 @@ namespace System
if (fmt != 0)
{
- NumberToString(ref sb, ref number, fmt, digits, info, isDecimal: false);
+ NumberToString(ref sb, ref number, fmt, digits, info);
}
else
{
@@ -488,6 +490,7 @@ namespace System
char fmt = ParseFormatSpecifier(format, out int digits);
int precision = FloatPrecision;
NumberBuffer number = default;
+ number.kind = NumberBufferKind.Double;
switch (fmt)
{
@@ -509,12 +512,12 @@ namespace System
if ((float)NumberToDouble(ref number) == value)
{
- NumberToString(ref sb, ref number, 'G', FloatPrecision, info, isDecimal: false);
+ NumberToString(ref sb, ref number, 'G', FloatPrecision, info);
}
else
{
DoubleToNumber(value, 9, ref number);
- NumberToString(ref sb, ref number, 'G', 9, info, isDecimal: false);
+ NumberToString(ref sb, ref number, 'G', 9, info);
}
return null;
}
@@ -550,7 +553,7 @@ namespace System
if (fmt != 0)
{
- NumberToString(ref sb, ref number, fmt, digits, info, false);
+ NumberToString(ref sb, ref number, fmt, digits, info);
}
else
{
@@ -608,7 +611,7 @@ namespace System
}
if (fmt != 0)
{
- NumberToString(ref sb, ref number, fmt, digits, info, false);
+ NumberToString(ref sb, ref number, fmt, digits, info);
}
else
{
@@ -653,7 +656,7 @@ namespace System
}
if (fmt != 0)
{
- NumberToString(ref sb, ref number, fmt, digits, info, false);
+ NumberToString(ref sb, ref number, fmt, digits, info);
}
else
{
@@ -696,7 +699,7 @@ namespace System
}
if (fmt != 0)
{
- NumberToString(ref sb, ref number, fmt, digits, info, false);
+ NumberToString(ref sb, ref number, fmt, digits, info);
}
else
{
@@ -739,7 +742,7 @@ namespace System
}
if (fmt != 0)
{
- NumberToString(ref sb, ref number, fmt, digits, info, false);
+ NumberToString(ref sb, ref number, fmt, digits, info);
}
else
{
@@ -785,7 +788,7 @@ namespace System
}
if (fmt != 0)
{
- NumberToString(ref sb, ref number, fmt, digits, info, false);
+ NumberToString(ref sb, ref number, fmt, digits, info);
}
else
{
@@ -831,7 +834,7 @@ namespace System
}
if (fmt != 0)
{
- NumberToString(ref sb, ref number, fmt, digits, info, false);
+ NumberToString(ref sb, ref number, fmt, digits, info);
}
else
{
@@ -875,7 +878,7 @@ namespace System
}
if (fmt != 0)
{
- NumberToString(ref sb, ref number, fmt, digits, info, false);
+ NumberToString(ref sb, ref number, fmt, digits, info);
}
else
{
@@ -919,7 +922,7 @@ namespace System
}
if (fmt != 0)
{
- NumberToString(ref sb, ref number, fmt, digits, info, false);
+ NumberToString(ref sb, ref number, fmt, digits, info);
}
else
{
@@ -949,6 +952,7 @@ namespace System
int i = (int)(buffer + Int32Precision - p);
number.scale = i;
+ number.kind = NumberBufferKind.Integer;
char* dst = number.digits;
while (--i >= 0)
@@ -1065,6 +1069,7 @@ namespace System
char* p = UInt32ToDecChars(buffer + UInt32Precision, value, 0);
int i = (int)(buffer + UInt32Precision - p);
number.scale = i;
+ number.kind = NumberBufferKind.Integer;
char* dst = number.digits;
while (--i >= 0)
@@ -1184,6 +1189,7 @@ namespace System
int i = (int)(buffer + Int64Precision - p);
number.scale = i;
+ number.kind = NumberBufferKind.Integer;
char* dst = number.digits;
while (--i >= 0)
@@ -1325,6 +1331,7 @@ namespace System
int i = (int)(buffer + UInt64Precision - p);
number.scale = i;
+ number.kind = NumberBufferKind.Integer;
char* dst = number.digits;
while (--i >= 0)
@@ -1453,8 +1460,10 @@ namespace System
'\0';
}
- internal static unsafe void NumberToString(ref ValueStringBuilder sb, ref NumberBuffer number, char format, int nMaxDigits, NumberFormatInfo info, bool isDecimal)
+ internal static unsafe void NumberToString(ref ValueStringBuilder sb, ref NumberBuffer number, char format, int nMaxDigits, NumberFormatInfo info)
{
+ Debug.Assert(number.kind != NumberBufferKind.Unknown);
+
switch (format)
{
case 'C':
@@ -1522,14 +1531,9 @@ namespace System
bool noRounding = false;
if (nMaxDigits < 1)
{
- if (isDecimal && (nMaxDigits == -1))
+ if ((number.kind == NumberBufferKind.Decimal) && (nMaxDigits == -1))
{
noRounding = true; // Turn off rounding for ECMA compliance to output trailing 0's after decimal as significant
- if (number.digits[0] == 0)
- {
- // Minus zero should be formatted as 0
- goto SkipSign;
- }
goto SkipRounding;
}
else
@@ -1539,13 +1543,12 @@ namespace System
}
}
- RoundNumber(ref number, nMaxDigits); // This also fixes up the minus zero case
+ RoundNumber(ref number, nMaxDigits);
SkipRounding:
if (number.sign)
sb.Append(info.NegativeSign);
-SkipSign:
FormatGeneral(ref sb, ref number, nMaxDigits, info, (char)(format - ('G' - 'E')), noRounding);
break;
@@ -1572,6 +1575,8 @@ SkipSign:
internal static unsafe void NumberToStringFormat(ref ValueStringBuilder sb, ref NumberBuffer number, ReadOnlySpan<char> format, NumberFormatInfo info)
{
+ Debug.Assert(number.kind != NumberBufferKind.Unknown);
+
int digitCount;
int decimalPos;
int firstDigit;
@@ -1694,7 +1699,6 @@ SkipSign:
}
else
{
- number.sign = false; // We need to format -0 without the sign set.
number.scale = 0; // Decimals with scale ('0.00') should be rounded.
}
@@ -2220,7 +2224,11 @@ SkipSign:
if (i == 0)
{
number.scale = 0;
- number.sign = false;
+
+ if (number.kind == NumberBufferKind.Integer)
+ {
+ number.sign = false;
+ }
}
dig[i] = '\0';
}
diff --git a/src/System.Private.CoreLib/shared/System/Number.NumberBuffer.cs b/src/System.Private.CoreLib/shared/System/Number.NumberBuffer.cs
index 2316f99bd..1730cf18f 100644
--- a/src/System.Private.CoreLib/shared/System/Number.NumberBuffer.cs
+++ b/src/System.Private.CoreLib/shared/System/Number.NumberBuffer.cs
@@ -15,17 +15,27 @@ namespace System
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal unsafe ref struct NumberBuffer // needs to match layout of NUMBER in coreclr's src/classlibnative/bcltype/number.h
{
- public int precision;
- public int scale;
- private int _sign;
- private DigitsAndNullTerminator _digits;
- private char* _allDigits;
+ public int precision; // 0
+ public int scale; // 4
+ private int _sign; // 8
+ private NumberBufferKind _kind; // 12
+ private char* _allDigits; // 16
+ private DigitsAndNullTerminator _digits; // 20 or 24
public bool sign { get => _sign != 0; set => _sign = value ? 1 : 0; }
public char* digits => (char*)Unsafe.AsPointer(ref _digits);
+ public NumberBufferKind kind { get => _kind; set => _kind = value; }
[StructLayout(LayoutKind.Sequential, Size = (NumberMaxDigits + 1) * sizeof(char))]
private struct DigitsAndNullTerminator { }
}
+
+ internal enum NumberBufferKind // needs to match NUMBER_KIND in coreclr's src/classlibnative/bcltype/number.h
+ {
+ Unknown = 0,
+ Integer = 1,
+ Decimal = 2,
+ Double = 3
+ }
}
}
diff --git a/src/System.Private.CoreLib/shared/System/Reflection/SignatureConstructedGenericType.cs b/src/System.Private.CoreLib/shared/System/Reflection/SignatureConstructedGenericType.cs
index cd97ffa21..d3d88520f 100644
--- a/src/System.Private.CoreLib/shared/System/Reflection/SignatureConstructedGenericType.cs
+++ b/src/System.Private.CoreLib/shared/System/Reflection/SignatureConstructedGenericType.cs
@@ -10,11 +10,25 @@ namespace System.Reflection
{
internal sealed class SignatureConstructedGenericType : SignatureType
{
- internal SignatureConstructedGenericType(Type genericTypeDefinition, Type[] genericTypeArguments)
+ // The exception-visible name "typeArguments" is chosen to match the parameter name to Type.MakeGenericType() since that's the
+ // intended user of this constructor.
+ internal SignatureConstructedGenericType(Type genericTypeDefinition, Type[] typeArguments)
{
- Debug.Assert(genericTypeDefinition != null && genericTypeArguments != null);
+ if (genericTypeDefinition == null)
+ throw new ArgumentNullException(nameof(genericTypeDefinition));
+
+ if (typeArguments == null)
+ throw new ArgumentNullException(nameof(typeArguments));
+
+ typeArguments = (Type[])(typeArguments.Clone());
+ for (int i = 0; i < typeArguments.Length; i++)
+ {
+ if (typeArguments[i] == null)
+ throw new ArgumentNullException(nameof(typeArguments));
+ }
+
_genericTypeDefinition = genericTypeDefinition;
- _genericTypeArguments = (Type[])(genericTypeArguments.Clone());
+ _genericTypeArguments = typeArguments;
}
public sealed override bool IsTypeDefinition => false;
diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs
index ee07f0928..a4b5680c7 100644
--- a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs
+++ b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx2.PlatformNotSupported.cs
@@ -539,242 +539,290 @@ namespace System.Runtime.Intrinsics.X86
/// <summary>
/// __m128i _mm_i32gather_epi32 (int const* base_addr, __m128i vindex, const int scale)
/// VPGATHERDD xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<int> GatherVector128(int* baseAddress, Vector128<int> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_i32gather_epi32 (int const* base_addr, __m128i vindex, const int scale)
/// VPGATHERDD xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<uint> GatherVector128(uint* baseAddress, Vector128<int> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_i32gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// VPGATHERDQ xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<long> GatherVector128(long* baseAddress, Vector128<int> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_i32gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// VPGATHERDQ xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<ulong> GatherVector128(ulong* baseAddress, Vector128<int> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128 _mm_i32gather_ps (float const* base_addr, __m128i vindex, const int scale)
/// VGATHERDPS xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<float> GatherVector128(float* baseAddress, Vector128<int> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128d _mm_i32gather_pd (double const* base_addr, __m128i vindex, const int scale)
/// VGATHERDPD xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<double> GatherVector128(double* baseAddress, Vector128<int> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_i64gather_epi32 (int const* base_addr, __m128i vindex, const int scale)
/// VPGATHERQD xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<int> GatherVector128(int* baseAddress, Vector128<long> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_i64gather_epi32 (int const* base_addr, __m128i vindex, const int scale)
/// VPGATHERQD xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<uint> GatherVector128(uint* baseAddress, Vector128<long> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_i64gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// VPGATHERQQ xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<long> GatherVector128(long* baseAddress, Vector128<long> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_i64gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// VPGATHERQQ xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<ulong> GatherVector128(ulong* baseAddress, Vector128<long> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128 _mm_i64gather_ps (float const* base_addr, __m128i vindex, const int scale)
/// VGATHERQPS xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<float> GatherVector128(float* baseAddress, Vector128<long> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128d _mm_i64gather_pd (double const* base_addr, __m128i vindex, const int scale)
/// VGATHERQPD xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<double> GatherVector128(double* baseAddress, Vector128<long> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256i _mm256_i32gather_epi32 (int const* base_addr, __m256i vindex, const int scale)
/// VPGATHERDD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<int> GatherVector256(int* baseAddress, Vector256<int> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256i _mm256_i32gather_epi32 (int const* base_addr, __m256i vindex, const int scale)
/// VPGATHERDD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<uint> GatherVector256(uint* baseAddress, Vector256<int> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256i _mm256_i32gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// VPGATHERDQ ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<long> GatherVector256(long* baseAddress, Vector128<int> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256i _mm256_i32gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// VPGATHERDQ ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<ulong> GatherVector256(ulong* baseAddress, Vector128<int> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256 _mm256_i32gather_ps (float const* base_addr, __m256i vindex, const int scale)
/// VGATHERDPS ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<float> GatherVector256(float* baseAddress, Vector256<int> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256d _mm256_i32gather_pd (double const* base_addr, __m128i vindex, const int scale)
/// VGATHERDPD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<double> GatherVector256(double* baseAddress, Vector128<int> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm256_i64gather_epi32 (int const* base_addr, __m256i vindex, const int scale)
- /// VPGATHERQD ymm, vm64y, ymm
+ /// VPGATHERQD xmm, vm64y, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<int> GatherVector128(int* baseAddress, Vector256<long> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm256_i64gather_epi32 (int const* base_addr, __m256i vindex, const int scale)
- /// VPGATHERQD ymm, vm64y, ymm
+ /// VPGATHERQD xmm, vm64y, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<uint> GatherVector128(uint* baseAddress, Vector256<long> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256i _mm256_i64gather_epi64 (__int64 const* base_addr, __m256i vindex, const int scale)
/// VPGATHERQQ ymm, vm64y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<long> GatherVector256(long* baseAddress, Vector256<long> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256i _mm256_i64gather_epi64 (__int64 const* base_addr, __m256i vindex, const int scale)
/// VPGATHERQQ ymm, vm64y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<ulong> GatherVector256(ulong* baseAddress, Vector256<long> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128 _mm256_i64gather_ps (float const* base_addr, __m256i vindex, const int scale)
- /// VGATHERQPS ymm, vm64y, ymm
+ /// VGATHERQPS xmm, vm64y, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<float> GatherVector128(float* baseAddress, Vector256<long> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256d _mm256_i64gather_pd (double const* base_addr, __m256i vindex, const int scale)
/// VGATHERQPD ymm, vm64y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<double> GatherVector256(double* baseAddress, Vector256<long> index, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_mask_i32gather_epi32 (__m128i src, int const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERDD xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<int> GatherMaskVector128(Vector128<int> source, int* baseAddress, Vector128<int> index, Vector128<int> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_mask_i32gather_epi32 (__m128i src, int const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERDD xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<uint> GatherMaskVector128(Vector128<uint> source, uint* baseAddress, Vector128<int> index, Vector128<uint> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_mask_i32gather_epi64 (__m128i src, __int64 const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERDQ xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<long> GatherMaskVector128(Vector128<long> source, long* baseAddress, Vector128<int> index, Vector128<long> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_mask_i32gather_epi64 (__m128i src, __int64 const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERDQ xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<ulong> GatherMaskVector128(Vector128<ulong> source, ulong* baseAddress, Vector128<int> index, Vector128<ulong> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128 _mm_mask_i32gather_ps (__m128 src, float const* base_addr, __m128i vindex, __m128 mask, const int scale)
/// VGATHERDPS xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector128<int> index, Vector128<float> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128d _mm_mask_i32gather_pd (__m128d src, double const* base_addr, __m128i vindex, __m128d mask, const int scale)
/// VGATHERDPD xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<double> GatherMaskVector128(Vector128<double> source, double* baseAddress, Vector128<int> index, Vector128<double> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_mask_i64gather_epi32 (__m128i src, int const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERQD xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<int> GatherMaskVector128(Vector128<int> source, int* baseAddress, Vector128<long> index, Vector128<int> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_mask_i64gather_epi32 (__m128i src, int const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERQD xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<uint> GatherMaskVector128(Vector128<uint> source, uint* baseAddress, Vector128<long> index, Vector128<uint> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_mask_i64gather_epi64 (__m128i src, __int64 const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERQQ xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<long> GatherMaskVector128(Vector128<long> source, long* baseAddress, Vector128<long> index, Vector128<long> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_mask_i64gather_epi64 (__m128i src, __int64 const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERQQ xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<ulong> GatherMaskVector128(Vector128<ulong> source, ulong* baseAddress, Vector128<long> index, Vector128<ulong> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128 _mm_mask_i64gather_ps (__m128 src, float const* base_addr, __m128i vindex, __m128 mask, const int scale)
- /// VPGATHERQPS xmm, vm64x, xmm
+ /// VGATHERQPS xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector128<long> index, Vector128<float> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128d _mm_mask_i64gather_pd (__m128d src, double const* base_addr, __m128i vindex, __m128d mask, const int scale)
- /// VPGATHERQPD xmm, vm64x, xmm
+ /// VGATHERQPD xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<double> GatherMaskVector128(Vector128<double> source, double* baseAddress, Vector128<long> index, Vector128<double> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256i _mm256_mask_i32gather_epi32 (__m256i src, int const* base_addr, __m256i vindex, __m256i mask, const int scale)
/// VPGATHERDD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<int> GatherMaskVector256(Vector256<int> source, int* baseAddress, Vector256<int> index, Vector256<int> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256i _mm256_mask_i32gather_epi32 (__m256i src, int const* base_addr, __m256i vindex, __m256i mask, const int scale)
/// VPGATHERDD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<uint> GatherMaskVector256(Vector256<uint> source, uint* baseAddress, Vector256<int> index, Vector256<uint> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256i _mm256_mask_i32gather_epi64 (__m256i src, __int64 const* base_addr, __m128i vindex, __m256i mask, const int scale)
/// VPGATHERDQ ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<long> GatherMaskVector256(Vector256<long> source, long* baseAddress, Vector128<int> index, Vector256<long> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256i _mm256_mask_i32gather_epi64 (__m256i src, __int64 const* base_addr, __m128i vindex, __m256i mask, const int scale)
/// VPGATHERDQ ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<ulong> GatherMaskVector256(Vector256<ulong> source, ulong* baseAddress, Vector128<int> index, Vector256<ulong> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256 _mm256_mask_i32gather_ps (__m256 src, float const* base_addr, __m256i vindex, __m256 mask, const int scale)
/// VPGATHERDPS ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<float> GatherMaskVector256(Vector256<float> source, float* baseAddress, Vector256<int> index, Vector256<float> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256d _mm256_mask_i32gather_pd (__m256d src, double const* base_addr, __m128i vindex, __m256d mask, const int scale)
/// VPGATHERDPD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<double> GatherMaskVector256(Vector256<double> source, double* baseAddress, Vector128<int> index, Vector256<double> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm256_mask_i64gather_epi32 (__m128i src, int const* base_addr, __m256i vindex, __m128i mask, const int scale)
- /// VPGATHERQD ymm, vm32y, ymm
+ /// VPGATHERQD xmm, vm32y, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<int> GatherMaskVector128(Vector128<int> source, int* baseAddress, Vector256<long> index, Vector128<int> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm256_mask_i64gather_epi32 (__m128i src, int const* base_addr, __m256i vindex, __m128i mask, const int scale)
- /// VPGATHERQD ymm, vm32y, ymm
+ /// VPGATHERQD xmm, vm32y, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<uint> GatherMaskVector128(Vector128<uint> source, uint* baseAddress, Vector256<long> index, Vector128<uint> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256i _mm256_mask_i64gather_epi64 (__m256i src, __int64 const* base_addr, __m256i vindex, __m256i mask, const int scale)
/// VPGATHERQQ ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<long> GatherMaskVector256(Vector256<long> source, long* baseAddress, Vector256<long> index, Vector256<long> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256i _mm256_mask_i64gather_epi64 (__m256i src, __int64 const* base_addr, __m256i vindex, __m256i mask, const int scale)
/// VPGATHERQQ ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<ulong> GatherMaskVector256(Vector256<ulong> source, ulong* baseAddress, Vector256<long> index, Vector256<ulong> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128 _mm256_mask_i64gather_ps (__m128 src, float const* base_addr, __m256i vindex, __m128 mask, const int scale)
- /// VPGATHERQPS ymm, vm32y, ymm
+ /// VGATHERQPS xmm, vm32y, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector256<long> index, Vector128<float> mask, byte scale) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m256d _mm256_mask_i64gather_pd (__m256d src, double const* base_addr, __m256i vindex, __m256d mask, const int scale)
- /// VPGATHERQPD ymm, vm32y, ymm
+ /// VGATHERQPD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
public static unsafe Vector256<double> GatherMaskVector256(Vector256<double> source, double* baseAddress, Vector256<long> index, Vector256<double> mask, byte scale) { throw new PlatformNotSupportedException(); }
diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx2.cs b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx2.cs
index 1f92cbf23..2e949dc83 100644
--- a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx2.cs
+++ b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Avx2.cs
@@ -545,244 +545,1012 @@ namespace System.Runtime.Intrinsics.X86
/// <summary>
/// __m128i _mm_i32gather_epi32 (int const* base_addr, __m128i vindex, const int scale)
/// VPGATHERDD xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<int> GatherVector128(int* baseAddress, Vector128<int> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<int> GatherVector128(int* baseAddress, Vector128<int> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_i32gather_epi32 (int const* base_addr, __m128i vindex, const int scale)
/// VPGATHERDD xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<uint> GatherVector128(uint* baseAddress, Vector128<int> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<uint> GatherVector128(uint* baseAddress, Vector128<int> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_i32gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// VPGATHERDQ xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<long> GatherVector128(long* baseAddress, Vector128<int> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<long> GatherVector128(long* baseAddress, Vector128<int> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_i32gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// VPGATHERDQ xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<ulong> GatherVector128(ulong* baseAddress, Vector128<int> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<ulong> GatherVector128(ulong* baseAddress, Vector128<int> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128 _mm_i32gather_ps (float const* base_addr, __m128i vindex, const int scale)
/// VGATHERDPS xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<float> GatherVector128(float* baseAddress, Vector128<int> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<float> GatherVector128(float* baseAddress, Vector128<int> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128d _mm_i32gather_pd (double const* base_addr, __m128i vindex, const int scale)
/// VGATHERDPD xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<double> GatherVector128(double* baseAddress, Vector128<int> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<double> GatherVector128(double* baseAddress, Vector128<int> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_i64gather_epi32 (int const* base_addr, __m128i vindex, const int scale)
/// VPGATHERQD xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<int> GatherVector128(int* baseAddress, Vector128<long> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<int> GatherVector128(int* baseAddress, Vector128<long> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_i64gather_epi32 (int const* base_addr, __m128i vindex, const int scale)
/// VPGATHERQD xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<uint> GatherVector128(uint* baseAddress, Vector128<long> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<uint> GatherVector128(uint* baseAddress, Vector128<long> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_i64gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// VPGATHERQQ xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<long> GatherVector128(long* baseAddress, Vector128<long> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<long> GatherVector128(long* baseAddress, Vector128<long> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_i64gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// VPGATHERQQ xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<ulong> GatherVector128(ulong* baseAddress, Vector128<long> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<ulong> GatherVector128(ulong* baseAddress, Vector128<long> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128 _mm_i64gather_ps (float const* base_addr, __m128i vindex, const int scale)
/// VGATHERQPS xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<float> GatherVector128(float* baseAddress, Vector128<long> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<float> GatherVector128(float* baseAddress, Vector128<long> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128d _mm_i64gather_pd (double const* base_addr, __m128i vindex, const int scale)
/// VGATHERQPD xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<double> GatherVector128(double* baseAddress, Vector128<long> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<double> GatherVector128(double* baseAddress, Vector128<long> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_i32gather_epi32 (int const* base_addr, __m256i vindex, const int scale)
/// VPGATHERDD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<int> GatherVector256(int* baseAddress, Vector256<int> index, byte scale) => GatherVector256(baseAddress, index, scale);
+ public static unsafe Vector256<int> GatherVector256(int* baseAddress, Vector256<int> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector256(baseAddress, index, 1);
+ case 2:
+ return GatherVector256(baseAddress, index, 2);
+ case 4:
+ return GatherVector256(baseAddress, index, 4);
+ case 8:
+ return GatherVector256(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_i32gather_epi32 (int const* base_addr, __m256i vindex, const int scale)
/// VPGATHERDD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<uint> GatherVector256(uint* baseAddress, Vector256<int> index, byte scale) => GatherVector256(baseAddress, index, scale);
+ public static unsafe Vector256<uint> GatherVector256(uint* baseAddress, Vector256<int> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector256(baseAddress, index, 1);
+ case 2:
+ return GatherVector256(baseAddress, index, 2);
+ case 4:
+ return GatherVector256(baseAddress, index, 4);
+ case 8:
+ return GatherVector256(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_i32gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// VPGATHERDQ ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<long> GatherVector256(long* baseAddress, Vector128<int> index, byte scale) => GatherVector256(baseAddress, index, scale);
+ public static unsafe Vector256<long> GatherVector256(long* baseAddress, Vector128<int> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector256(baseAddress, index, 1);
+ case 2:
+ return GatherVector256(baseAddress, index, 2);
+ case 4:
+ return GatherVector256(baseAddress, index, 4);
+ case 8:
+ return GatherVector256(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_i32gather_epi64 (__int64 const* base_addr, __m128i vindex, const int scale)
/// VPGATHERDQ ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<ulong> GatherVector256(ulong* baseAddress, Vector128<int> index, byte scale) => GatherVector256(baseAddress, index, scale);
+ public static unsafe Vector256<ulong> GatherVector256(ulong* baseAddress, Vector128<int> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector256(baseAddress, index, 1);
+ case 2:
+ return GatherVector256(baseAddress, index, 2);
+ case 4:
+ return GatherVector256(baseAddress, index, 4);
+ case 8:
+ return GatherVector256(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256 _mm256_i32gather_ps (float const* base_addr, __m256i vindex, const int scale)
/// VGATHERDPS ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<float> GatherVector256(float* baseAddress, Vector256<int> index, byte scale) => GatherVector256(baseAddress, index, scale);
+ public static unsafe Vector256<float> GatherVector256(float* baseAddress, Vector256<int> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector256(baseAddress, index, 1);
+ case 2:
+ return GatherVector256(baseAddress, index, 2);
+ case 4:
+ return GatherVector256(baseAddress, index, 4);
+ case 8:
+ return GatherVector256(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256d _mm256_i32gather_pd (double const* base_addr, __m128i vindex, const int scale)
/// VGATHERDPD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<double> GatherVector256(double* baseAddress, Vector128<int> index, byte scale) => GatherVector256(baseAddress, index, scale);
+ public static unsafe Vector256<double> GatherVector256(double* baseAddress, Vector128<int> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector256(baseAddress, index, 1);
+ case 2:
+ return GatherVector256(baseAddress, index, 2);
+ case 4:
+ return GatherVector256(baseAddress, index, 4);
+ case 8:
+ return GatherVector256(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm256_i64gather_epi32 (int const* base_addr, __m256i vindex, const int scale)
- /// VPGATHERQD ymm, vm64y, ymm
+ /// VPGATHERQD xmm, vm64y, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<int> GatherVector128(int* baseAddress, Vector256<long> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<int> GatherVector128(int* baseAddress, Vector256<long> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm256_i64gather_epi32 (int const* base_addr, __m256i vindex, const int scale)
- /// VPGATHERQD ymm, vm64y, ymm
+ /// VPGATHERQD xmm, vm64y, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<uint> GatherVector128(uint* baseAddress, Vector256<long> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<uint> GatherVector128(uint* baseAddress, Vector256<long> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_i64gather_epi64 (__int64 const* base_addr, __m256i vindex, const int scale)
/// VPGATHERQQ ymm, vm64y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<long> GatherVector256(long* baseAddress, Vector256<long> index, byte scale) => GatherVector256(baseAddress, index, scale);
+ public static unsafe Vector256<long> GatherVector256(long* baseAddress, Vector256<long> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector256(baseAddress, index, 1);
+ case 2:
+ return GatherVector256(baseAddress, index, 2);
+ case 4:
+ return GatherVector256(baseAddress, index, 4);
+ case 8:
+ return GatherVector256(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_i64gather_epi64 (__int64 const* base_addr, __m256i vindex, const int scale)
/// VPGATHERQQ ymm, vm64y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<ulong> GatherVector256(ulong* baseAddress, Vector256<long> index, byte scale) => GatherVector256(baseAddress, index, scale);
+ public static unsafe Vector256<ulong> GatherVector256(ulong* baseAddress, Vector256<long> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector256(baseAddress, index, 1);
+ case 2:
+ return GatherVector256(baseAddress, index, 2);
+ case 4:
+ return GatherVector256(baseAddress, index, 4);
+ case 8:
+ return GatherVector256(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128 _mm256_i64gather_ps (float const* base_addr, __m256i vindex, const int scale)
- /// VGATHERQPS ymm, vm64y, ymm
+ /// VGATHERQPS xmm, vm64y, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<float> GatherVector128(float* baseAddress, Vector256<long> index, byte scale) => GatherVector128(baseAddress, index, scale);
+ public static unsafe Vector128<float> GatherVector128(float* baseAddress, Vector256<long> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector128(baseAddress, index, 1);
+ case 2:
+ return GatherVector128(baseAddress, index, 2);
+ case 4:
+ return GatherVector128(baseAddress, index, 4);
+ case 8:
+ return GatherVector128(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256d _mm256_i64gather_pd (double const* base_addr, __m256i vindex, const int scale)
/// VGATHERQPD ymm, vm64y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<double> GatherVector256(double* baseAddress, Vector256<long> index, byte scale) => GatherVector256(baseAddress, index, scale);
+ public static unsafe Vector256<double> GatherVector256(double* baseAddress, Vector256<long> index, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherVector256(baseAddress, index, 1);
+ case 2:
+ return GatherVector256(baseAddress, index, 2);
+ case 4:
+ return GatherVector256(baseAddress, index, 4);
+ case 8:
+ return GatherVector256(baseAddress, index, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_mask_i32gather_epi32 (__m128i src, int const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERDD xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<int> GatherMaskVector128(Vector128<int> source, int* baseAddress, Vector128<int> index, Vector128<int> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<int> GatherMaskVector128(Vector128<int> source, int* baseAddress, Vector128<int> index, Vector128<int> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_mask_i32gather_epi32 (__m128i src, int const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERDD xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<uint> GatherMaskVector128(Vector128<uint> source, uint* baseAddress, Vector128<int> index, Vector128<uint> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<uint> GatherMaskVector128(Vector128<uint> source, uint* baseAddress, Vector128<int> index, Vector128<uint> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_mask_i32gather_epi64 (__m128i src, __int64 const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERDQ xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<long> GatherMaskVector128(Vector128<long> source, long* baseAddress, Vector128<int> index, Vector128<long> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<long> GatherMaskVector128(Vector128<long> source, long* baseAddress, Vector128<int> index, Vector128<long> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_mask_i32gather_epi64 (__m128i src, __int64 const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERDQ xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<ulong> GatherMaskVector128(Vector128<ulong> source, ulong* baseAddress, Vector128<int> index, Vector128<ulong> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<ulong> GatherMaskVector128(Vector128<ulong> source, ulong* baseAddress, Vector128<int> index, Vector128<ulong> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128 _mm_mask_i32gather_ps (__m128 src, float const* base_addr, __m128i vindex, __m128 mask, const int scale)
/// VGATHERDPS xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector128<int> index, Vector128<float> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector128<int> index, Vector128<float> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128d _mm_mask_i32gather_pd (__m128d src, double const* base_addr, __m128i vindex, __m128d mask, const int scale)
/// VGATHERDPD xmm, vm32x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<double> GatherMaskVector128(Vector128<double> source, double* baseAddress, Vector128<int> index, Vector128<double> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<double> GatherMaskVector128(Vector128<double> source, double* baseAddress, Vector128<int> index, Vector128<double> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_mask_i64gather_epi32 (__m128i src, int const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERQD xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<int> GatherMaskVector128(Vector128<int> source, int* baseAddress, Vector128<long> index, Vector128<int> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<int> GatherMaskVector128(Vector128<int> source, int* baseAddress, Vector128<long> index, Vector128<int> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_mask_i64gather_epi32 (__m128i src, int const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERQD xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<uint> GatherMaskVector128(Vector128<uint> source, uint* baseAddress, Vector128<long> index, Vector128<uint> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<uint> GatherMaskVector128(Vector128<uint> source, uint* baseAddress, Vector128<long> index, Vector128<uint> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_mask_i64gather_epi64 (__m128i src, __int64 const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERQQ xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<long> GatherMaskVector128(Vector128<long> source, long* baseAddress, Vector128<long> index, Vector128<long> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<long> GatherMaskVector128(Vector128<long> source, long* baseAddress, Vector128<long> index, Vector128<long> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm_mask_i64gather_epi64 (__m128i src, __int64 const* base_addr, __m128i vindex, __m128i mask, const int scale)
/// VPGATHERQQ xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<ulong> GatherMaskVector128(Vector128<ulong> source, ulong* baseAddress, Vector128<long> index, Vector128<ulong> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<ulong> GatherMaskVector128(Vector128<ulong> source, ulong* baseAddress, Vector128<long> index, Vector128<ulong> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128 _mm_mask_i64gather_ps (__m128 src, float const* base_addr, __m128i vindex, __m128 mask, const int scale)
- /// VPGATHERQPS xmm, vm64x, xmm
+ /// VGATHERQPS xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector128<long> index, Vector128<float> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector128<long> index, Vector128<float> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128d _mm_mask_i64gather_pd (__m128d src, double const* base_addr, __m128i vindex, __m128d mask, const int scale)
- /// VPGATHERQPD xmm, vm64x, xmm
+ /// VGATHERQPD xmm, vm64x, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<double> GatherMaskVector128(Vector128<double> source, double* baseAddress, Vector128<long> index, Vector128<double> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<double> GatherMaskVector128(Vector128<double> source, double* baseAddress, Vector128<long> index, Vector128<double> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_mask_i32gather_epi32 (__m256i src, int const* base_addr, __m256i vindex, __m256i mask, const int scale)
/// VPGATHERDD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<int> GatherMaskVector256(Vector256<int> source, int* baseAddress, Vector256<int> index, Vector256<int> mask, byte scale) => GatherMaskVector256(source, baseAddress, index, mask, scale);
+ public static unsafe Vector256<int> GatherMaskVector256(Vector256<int> source, int* baseAddress, Vector256<int> index, Vector256<int> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector256(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector256(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector256(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector256(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_mask_i32gather_epi32 (__m256i src, int const* base_addr, __m256i vindex, __m256i mask, const int scale)
/// VPGATHERDD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<uint> GatherMaskVector256(Vector256<uint> source, uint* baseAddress, Vector256<int> index, Vector256<uint> mask, byte scale) => GatherMaskVector256(source, baseAddress, index, mask, scale);
+ public static unsafe Vector256<uint> GatherMaskVector256(Vector256<uint> source, uint* baseAddress, Vector256<int> index, Vector256<uint> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector256(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector256(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector256(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector256(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_mask_i32gather_epi64 (__m256i src, __int64 const* base_addr, __m128i vindex, __m256i mask, const int scale)
/// VPGATHERDQ ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<long> GatherMaskVector256(Vector256<long> source, long* baseAddress, Vector128<int> index, Vector256<long> mask, byte scale) => GatherMaskVector256(source, baseAddress, index, mask, scale);
+ public static unsafe Vector256<long> GatherMaskVector256(Vector256<long> source, long* baseAddress, Vector128<int> index, Vector256<long> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector256(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector256(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector256(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector256(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_mask_i32gather_epi64 (__m256i src, __int64 const* base_addr, __m128i vindex, __m256i mask, const int scale)
/// VPGATHERDQ ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<ulong> GatherMaskVector256(Vector256<ulong> source, ulong* baseAddress, Vector128<int> index, Vector256<ulong> mask, byte scale) => GatherMaskVector256(source, baseAddress, index, mask, scale);
+ public static unsafe Vector256<ulong> GatherMaskVector256(Vector256<ulong> source, ulong* baseAddress, Vector128<int> index, Vector256<ulong> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector256(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector256(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector256(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector256(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256 _mm256_mask_i32gather_ps (__m256 src, float const* base_addr, __m256i vindex, __m256 mask, const int scale)
/// VPGATHERDPS ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<float> GatherMaskVector256(Vector256<float> source, float* baseAddress, Vector256<int> index, Vector256<float> mask, byte scale) => GatherMaskVector256(source, baseAddress, index, mask, scale);
+ public static unsafe Vector256<float> GatherMaskVector256(Vector256<float> source, float* baseAddress, Vector256<int> index, Vector256<float> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector256(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector256(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector256(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector256(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256d _mm256_mask_i32gather_pd (__m256d src, double const* base_addr, __m128i vindex, __m256d mask, const int scale)
/// VPGATHERDPD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<double> GatherMaskVector256(Vector256<double> source, double* baseAddress, Vector128<int> index, Vector256<double> mask, byte scale) => GatherMaskVector256(source, baseAddress, index, mask, scale);
+ public static unsafe Vector256<double> GatherMaskVector256(Vector256<double> source, double* baseAddress, Vector128<int> index, Vector256<double> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector256(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector256(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector256(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector256(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm256_mask_i64gather_epi32 (__m128i src, int const* base_addr, __m256i vindex, __m128i mask, const int scale)
- /// VPGATHERQD ymm, vm32y, ymm
+ /// VPGATHERQD xmm, vm32y, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<int> GatherMaskVector128(Vector128<int> source, int* baseAddress, Vector256<long> index, Vector128<int> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<int> GatherMaskVector128(Vector128<int> source, int* baseAddress, Vector256<long> index, Vector128<int> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128i _mm256_mask_i64gather_epi32 (__m128i src, int const* base_addr, __m256i vindex, __m128i mask, const int scale)
- /// VPGATHERQD ymm, vm32y, ymm
+ /// VPGATHERQD xmm, vm32y, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<uint> GatherMaskVector128(Vector128<uint> source, uint* baseAddress, Vector256<long> index, Vector128<uint> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<uint> GatherMaskVector128(Vector128<uint> source, uint* baseAddress, Vector256<long> index, Vector128<uint> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_mask_i64gather_epi64 (__m256i src, __int64 const* base_addr, __m256i vindex, __m256i mask, const int scale)
/// VPGATHERQQ ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<long> GatherMaskVector256(Vector256<long> source, long* baseAddress, Vector256<long> index, Vector256<long> mask, byte scale) => GatherMaskVector256(source, baseAddress, index, mask, scale);
+ public static unsafe Vector256<long> GatherMaskVector256(Vector256<long> source, long* baseAddress, Vector256<long> index, Vector256<long> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector256(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector256(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector256(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector256(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_mask_i64gather_epi64 (__m256i src, __int64 const* base_addr, __m256i vindex, __m256i mask, const int scale)
/// VPGATHERQQ ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<ulong> GatherMaskVector256(Vector256<ulong> source, ulong* baseAddress, Vector256<long> index, Vector256<ulong> mask, byte scale) => GatherMaskVector256(source, baseAddress, index, mask, scale);
+ public static unsafe Vector256<ulong> GatherMaskVector256(Vector256<ulong> source, ulong* baseAddress, Vector256<long> index, Vector256<ulong> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector256(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector256(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector256(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector256(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m128 _mm256_mask_i64gather_ps (__m128 src, float const* base_addr, __m256i vindex, __m128 mask, const int scale)
- /// VPGATHERQPS ymm, vm32y, ymm
+ /// VGATHERQPS xmm, vm32y, xmm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector256<long> index, Vector128<float> mask, byte scale) => GatherMaskVector128(source, baseAddress, index, mask, scale);
+ public static unsafe Vector128<float> GatherMaskVector128(Vector128<float> source, float* baseAddress, Vector256<long> index, Vector128<float> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector128(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector128(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector128(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector128(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256d _mm256_mask_i64gather_pd (__m256d src, double const* base_addr, __m256i vindex, __m256d mask, const int scale)
- /// VPGATHERQPD ymm, vm32y, ymm
+ /// VGATHERQPD ymm, vm32y, ymm
+ /// The scale parameter should be 1, 2, 4 or 8, otherwise, ArgumentOutOfRangeException will be thrown.
/// </summary>
- public static unsafe Vector256<double> GatherMaskVector256(Vector256<double> source, double* baseAddress, Vector256<long> index, Vector256<double> mask, byte scale) => GatherMaskVector256(source, baseAddress, index, mask, scale);
+ public static unsafe Vector256<double> GatherMaskVector256(Vector256<double> source, double* baseAddress, Vector256<long> index, Vector256<double> mask, byte scale)
+ {
+ switch (scale)
+ {
+ case 1:
+ return GatherMaskVector256(source, baseAddress, index, mask, 1);
+ case 2:
+ return GatherMaskVector256(source, baseAddress, index, mask, 2);
+ case 4:
+ return GatherMaskVector256(source, baseAddress, index, mask, 4);
+ case 8:
+ return GatherMaskVector256(source, baseAddress, index, mask, 8);
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scale));
+ }
+ }
/// <summary>
/// __m256i _mm256_hadd_epi16 (__m256i a, __m256i b)
diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Pclmulqdq.PlatformNotSupported.cs b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Pclmulqdq.PlatformNotSupported.cs
index a1ec168aa..b79e50a2b 100644
--- a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Pclmulqdq.PlatformNotSupported.cs
+++ b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Pclmulqdq.PlatformNotSupported.cs
@@ -21,11 +21,11 @@ namespace System.Runtime.Intrinsics.X86
/// __m128i _mm_clmulepi64_si128 (__m128i a, __m128i b, const int imm8)
/// PCLMULQDQ xmm, xmm/m128, imm8
/// </summary>
- public static Vector128<long> CarryLessMultiply(Vector128<long> left, Vector128<long> right, byte control) { throw new PlatformNotSupportedException(); }
+ public static Vector128<long> CarrylessMultiply(Vector128<long> left, Vector128<long> right, byte control) { throw new PlatformNotSupportedException(); }
/// <summary>
/// __m128i _mm_clmulepi64_si128 (__m128i a, __m128i b, const int imm8)
/// PCLMULQDQ xmm, xmm/m128, imm8
/// </summary>
- public static Vector128<ulong> CarryLessMultiply(Vector128<ulong> left, Vector128<ulong> right, byte control) { throw new PlatformNotSupportedException(); }
+ public static Vector128<ulong> CarrylessMultiply(Vector128<ulong> left, Vector128<ulong> right, byte control) { throw new PlatformNotSupportedException(); }
}
}
diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Pclmulqdq.cs b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Pclmulqdq.cs
index c2ed5bf2b..c108e65f0 100644
--- a/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Pclmulqdq.cs
+++ b/src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/X86/Pclmulqdq.cs
@@ -21,11 +21,11 @@ namespace System.Runtime.Intrinsics.X86
/// __m128i _mm_clmulepi64_si128 (__m128i a, __m128i b, const int imm8)
/// PCLMULQDQ xmm, xmm/m128, imm8
/// </summary>
- public static Vector128<long> CarryLessMultiply(Vector128<long> left, Vector128<long> right, byte control) => CarryLessMultiply(left, right, control);
+ public static Vector128<long> CarrylessMultiply(Vector128<long> left, Vector128<long> right, byte control) => CarrylessMultiply(left, right, control);
/// <summary>
/// __m128i _mm_clmulepi64_si128 (__m128i a, __m128i b, const int imm8)
/// PCLMULQDQ xmm, xmm/m128, imm8
/// </summary>
- public static Vector128<ulong> CarryLessMultiply(Vector128<ulong> left, Vector128<ulong> right, byte control) => CarryLessMultiply(left, right, control);
+ public static Vector128<ulong> CarrylessMultiply(Vector128<ulong> left, Vector128<ulong> right, byte control) => CarrylessMultiply(left, right, control);
}
}
diff --git a/src/System.Private.CoreLib/shared/System/SpanHelpers.Byte.cs b/src/System.Private.CoreLib/shared/System/SpanHelpers.Byte.cs
index 2890adb56..373065363 100644
--- a/src/System.Private.CoreLib/shared/System/SpanHelpers.Byte.cs
+++ b/src/System.Private.CoreLib/shared/System/SpanHelpers.Byte.cs
@@ -16,7 +16,7 @@ using nuint = System.UInt32;
namespace System
{
- internal static partial class SpanHelpers
+ internal static partial class SpanHelpers // .Byte
{
public static int IndexOf(ref byte searchSpace, int searchSpaceLength, ref byte value, int valueLength)
{
@@ -96,6 +96,98 @@ namespace System
return index;
}
+ // Adapted from IndexOf(...)
+ public static unsafe bool Contains(ref byte searchSpace, byte value, int length)
+ {
+ Debug.Assert(length >= 0);
+
+ uint uValue = value; // Use uint for comparisons to avoid unnecessary 8->32 extensions
+ IntPtr index = (IntPtr)0; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
+ IntPtr nLength = (IntPtr)length;
+
+ if (Vector.IsHardwareAccelerated && length >= Vector<byte>.Count * 2)
+ {
+ int unaligned = (int)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
+ nLength = (IntPtr)((Vector<byte>.Count - unaligned) & (Vector<byte>.Count - 1));
+ }
+
+ SequentialScan:
+ while ((byte*)nLength >= (byte*)8)
+ {
+ nLength -= 8;
+
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 0) ||
+ uValue == Unsafe.AddByteOffset(ref searchSpace, index + 1) ||
+ uValue == Unsafe.AddByteOffset(ref searchSpace, index + 2) ||
+ uValue == Unsafe.AddByteOffset(ref searchSpace, index + 3) ||
+ uValue == Unsafe.AddByteOffset(ref searchSpace, index + 4) ||
+ uValue == Unsafe.AddByteOffset(ref searchSpace, index + 5) ||
+ uValue == Unsafe.AddByteOffset(ref searchSpace, index + 6) ||
+ uValue == Unsafe.AddByteOffset(ref searchSpace, index + 7))
+ {
+ goto Found;
+ }
+
+ index += 8;
+ }
+
+ if ((byte*)nLength >= (byte*)4)
+ {
+ nLength -= 4;
+
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index + 0) ||
+ uValue == Unsafe.AddByteOffset(ref searchSpace, index + 1) ||
+ uValue == Unsafe.AddByteOffset(ref searchSpace, index + 2) ||
+ uValue == Unsafe.AddByteOffset(ref searchSpace, index + 3))
+ {
+ goto Found;
+ }
+
+ index += 4;
+ }
+
+ while ((byte*)nLength > (byte*)0)
+ {
+ nLength -= 1;
+
+ if (uValue == Unsafe.AddByteOffset(ref searchSpace, index))
+ goto Found;
+
+ index += 1;
+ }
+
+ if (Vector.IsHardwareAccelerated && ((int)(byte*)index < length))
+ {
+ nLength = (IntPtr)((length - (int)(byte*)index) & ~(Vector<byte>.Count - 1));
+
+ // Get comparison Vector
+ Vector<byte> vComparison = new Vector<byte>(value);
+
+ while ((byte*)nLength > (byte*)index)
+ {
+ var vMatches = Vector.Equals(vComparison, Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref searchSpace, index)));
+ if (Vector<byte>.Zero.Equals(vMatches))
+ {
+ index += Vector<byte>.Count;
+ continue;
+ }
+
+ goto Found;
+ }
+
+ if ((int)(byte*)index < length)
+ {
+ nLength = (IntPtr)(length - (int)(byte*)index);
+ goto SequentialScan;
+ }
+ }
+
+ return false;
+
+ Found:
+ return true;
+ }
+
public static unsafe int IndexOf(ref byte searchSpace, byte value, int length)
{
Debug.Assert(length >= 0);
diff --git a/src/System.Private.CoreLib/shared/System/SpanHelpers.Char.cs b/src/System.Private.CoreLib/shared/System/SpanHelpers.Char.cs
index 51ace58a3..02df69feb 100644
--- a/src/System.Private.CoreLib/shared/System/SpanHelpers.Char.cs
+++ b/src/System.Private.CoreLib/shared/System/SpanHelpers.Char.cs
@@ -4,18 +4,15 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
+using System.Numerics;
#if !netstandard
using Internal.Runtime.CompilerServices;
#endif
-#if !netstandard11
-using System.Numerics;
-#endif
-
namespace System
{
- internal static partial class SpanHelpers
+ internal static partial class SpanHelpers // .Char
{
public static unsafe int SequenceCompareTo(ref char first, int firstLength, ref char second, int secondLength)
{
@@ -32,7 +29,6 @@ namespace System
if ((byte*)minLength >= (byte*)(sizeof(UIntPtr) / sizeof(char)))
{
-#if !netstandard11
if (Vector.IsHardwareAccelerated && (byte*)minLength >= (byte*)Vector<ushort>.Count)
{
IntPtr nLength = minLength - Vector<ushort>.Count;
@@ -47,7 +43,6 @@ namespace System
}
while ((byte*)nLength >= (byte*)i);
}
-#endif
while ((byte*)minLength >= (byte*)(i + sizeof(UIntPtr) / sizeof(char)))
{
@@ -81,6 +76,94 @@ namespace System
return lengthDelta;
}
+ // Adapted from IndexOf(...)
+ public static unsafe bool Contains(ref char searchSpace, char value, int length)
+ {
+ Debug.Assert(length >= 0);
+
+ fixed (char* pChars = &searchSpace)
+ {
+ char* pCh = pChars;
+ char* pEndCh = pCh + length;
+
+ if (Vector.IsHardwareAccelerated && length >= Vector<ushort>.Count * 2)
+ {
+ // Figure out how many characters to read sequentially until we are vector aligned
+ // This is equivalent to:
+ // unaligned = ((int)pCh % Unsafe.SizeOf<Vector<ushort>>()) / elementsPerByte
+ // length = (Vector<ushort>.Count - unaligned) % Vector<ushort>.Count
+ const int elementsPerByte = sizeof(ushort) / sizeof(byte);
+ int unaligned = ((int)pCh & (Unsafe.SizeOf<Vector<ushort>>() - 1)) / elementsPerByte;
+ length = (Vector<ushort>.Count - unaligned) & (Vector<ushort>.Count - 1);
+ }
+
+ SequentialScan:
+ while (length >= 4)
+ {
+ length -= 4;
+
+ if (value == *pCh ||
+ value == *(pCh + 1) ||
+ value == *(pCh + 2) ||
+ value == *(pCh + 3))
+ {
+ goto Found;
+ }
+
+ pCh += 4;
+ }
+
+ while (length > 0)
+ {
+ length -= 1;
+
+ if (value == *pCh)
+ goto Found;
+
+ pCh += 1;
+ }
+
+ // We get past SequentialScan only if IsHardwareAccelerated is true. However, we still have the redundant check to allow
+ // the JIT to see that the code is unreachable and eliminate it when the platform does not have hardware accelerated.
+ if (Vector.IsHardwareAccelerated && pCh < pEndCh)
+ {
+ // Get the highest multiple of Vector<ushort>.Count that is within the search space.
+ // That will be how many times we iterate in the loop below.
+ // This is equivalent to: length = Vector<ushort>.Count * ((int)(pEndCh - pCh) / Vector<ushort>.Count)
+ length = (int)((pEndCh - pCh) & ~(Vector<ushort>.Count - 1));
+
+ // Get comparison Vector
+ Vector<ushort> vComparison = new Vector<ushort>(value);
+
+ while (length > 0)
+ {
+ // Using Unsafe.Read instead of ReadUnaligned since the search space is pinned and pCh is always vector aligned
+ Debug.Assert(((int)pCh & (Unsafe.SizeOf<Vector<ushort>>() - 1)) == 0);
+ Vector<ushort> vMatches = Vector.Equals(vComparison, Unsafe.Read<Vector<ushort>>(pCh));
+ if (Vector<ushort>.Zero.Equals(vMatches))
+ {
+ pCh += Vector<ushort>.Count;
+ length -= Vector<ushort>.Count;
+ continue;
+ }
+
+ goto Found;
+ }
+
+ if (pCh < pEndCh)
+ {
+ length = (int)(pEndCh - pCh);
+ goto SequentialScan;
+ }
+ }
+
+ return false;
+
+ Found:
+ return true;
+ }
+ }
+
public static unsafe int IndexOf(ref char searchSpace, char value, int length)
{
Debug.Assert(length >= 0);
@@ -90,7 +173,6 @@ namespace System
char* pCh = pChars;
char* pEndCh = pCh + length;
-#if !netstandard11
if (Vector.IsHardwareAccelerated && length >= Vector<ushort>.Count * 2)
{
// Figure out how many characters to read sequentially until we are vector aligned
@@ -101,8 +183,8 @@ namespace System
int unaligned = ((int)pCh & (Unsafe.SizeOf<Vector<ushort>>() - 1)) / elementsPerByte;
length = (Vector<ushort>.Count - unaligned) & (Vector<ushort>.Count - 1);
}
+
SequentialScan:
-#endif
while (length >= 4)
{
length -= 4;
@@ -128,7 +210,7 @@ namespace System
pCh += 1;
}
-#if !netstandard11
+
// We get past SequentialScan only if IsHardwareAccelerated is true. However, we still have the redundant check to allow
// the JIT to see that the code is unreachable and eliminate it when the platform does not have hardware accelerated.
if (Vector.IsHardwareAccelerated && pCh < pEndCh)
@@ -162,7 +244,7 @@ namespace System
goto SequentialScan;
}
}
-#endif
+
return -1;
Found3:
pCh++;
@@ -184,7 +266,6 @@ namespace System
char* pCh = pChars + length;
char* pEndCh = pChars;
-#if !netstandard11
if (Vector.IsHardwareAccelerated && length >= Vector<ushort>.Count * 2)
{
// Figure out how many characters to read sequentially from the end until we are vector aligned
@@ -192,8 +273,8 @@ namespace System
const int elementsPerByte = sizeof(ushort) / sizeof(byte);
length = ((int)pCh & (Unsafe.SizeOf<Vector<ushort>>() - 1)) / elementsPerByte;
}
+
SequentialScan:
-#endif
while (length >= 4)
{
length -= 4;
@@ -217,7 +298,7 @@ namespace System
if (*pCh == value)
goto Found;
}
-#if !netstandard11
+
// We get past SequentialScan only if IsHardwareAccelerated is true. However, we still have the redundant check to allow
// the JIT to see that the code is unreachable and eliminate it when the platform does not have hardware accelerated.
if (Vector.IsHardwareAccelerated && pCh > pEndCh)
@@ -252,7 +333,7 @@ namespace System
goto SequentialScan;
}
}
-#endif
+
return -1;
Found:
return (int)(pCh - pEndCh);
@@ -265,7 +346,6 @@ namespace System
}
}
-#if !netstandard11
// Vector sub-search adapted from https://github.com/aspnet/KestrelHttpServer/pull/1138
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int LocateFirstFoundChar(Vector<ushort> match)
@@ -336,6 +416,5 @@ namespace System
}
return index;
}
-#endif
}
}
diff --git a/src/System.Private.CoreLib/shared/System/SpanHelpers.T.cs b/src/System.Private.CoreLib/shared/System/SpanHelpers.T.cs
index d7a27fd4c..20fdc616d 100644
--- a/src/System.Private.CoreLib/shared/System/SpanHelpers.T.cs
+++ b/src/System.Private.CoreLib/shared/System/SpanHelpers.T.cs
@@ -4,18 +4,15 @@
using System.Diagnostics;
using System.Runtime.CompilerServices; // Do not remove. This is necessary for netstandard, since this file is mirrored into corefx
+using System.Numerics;
#if !netstandard
using Internal.Runtime.CompilerServices;
#endif
-#if !netstandard11
-using System.Numerics;
-#endif
-
namespace System
{
- internal static partial class SpanHelpers
+ internal static partial class SpanHelpers // .T
{
public static int IndexOf<T>(ref T searchSpace, int searchSpaceLength, ref T value, int valueLength)
where T : IEquatable<T>
@@ -53,6 +50,63 @@ namespace System
return -1;
}
+ // Adapted from IndexOf(...)
+ public static unsafe bool Contains<T>(ref T searchSpace, T value, int length)
+ where T : IEquatable<T>
+ {
+ Debug.Assert(length >= 0);
+
+ IntPtr index = (IntPtr)0; // Use IntPtr for arithmetic to avoid unnecessary 64->32->64 truncations
+ while (length >= 8)
+ {
+ length -= 8;
+
+ if (value.Equals(Unsafe.Add(ref searchSpace, index + 0)) ||
+ value.Equals(Unsafe.Add(ref searchSpace, index + 1)) ||
+ value.Equals(Unsafe.Add(ref searchSpace, index + 2)) ||
+ value.Equals(Unsafe.Add(ref searchSpace, index + 3)) ||
+ value.Equals(Unsafe.Add(ref searchSpace, index + 4)) ||
+ value.Equals(Unsafe.Add(ref searchSpace, index + 5)) ||
+ value.Equals(Unsafe.Add(ref searchSpace, index + 6)) ||
+ value.Equals(Unsafe.Add(ref searchSpace, index + 7)))
+ {
+ goto Found;
+ }
+
+ index += 8;
+ }
+
+ if (length >= 4)
+ {
+ length -= 4;
+
+ if (value.Equals(Unsafe.Add(ref searchSpace, index + 0)) ||
+ value.Equals(Unsafe.Add(ref searchSpace, index + 1)) ||
+ value.Equals(Unsafe.Add(ref searchSpace, index + 2)) ||
+ value.Equals(Unsafe.Add(ref searchSpace, index + 3)))
+ {
+ goto Found;
+ }
+
+ index += 4;
+ }
+
+ while (length > 0)
+ {
+ length -= 1;
+
+ if (value.Equals(Unsafe.Add(ref searchSpace, index)))
+ goto Found;
+
+ index += 1;
+ }
+
+ return false;
+
+ Found:
+ return true;
+ }
+
public static unsafe int IndexOf<T>(ref T searchSpace, T value, int length)
where T : IEquatable<T>
{
diff --git a/src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs b/src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs
index 21cc3dc01..74b5dacf9 100644
--- a/src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs
+++ b/src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs
@@ -50,9 +50,20 @@ namespace System.Text
/// <summary>
/// Get a pinnable reference to the builder.
+ /// Does not ensure there is a null char after <see cref="Length"/>
+ /// This overload is pattern matched in the C# 7.3+ compiler so you can omit
+ /// the explicit method call, and write eg "fixed (char* c = builder)"
+ /// </summary>
+ public ref char GetPinnableReference()
+ {
+ return ref MemoryMarshal.GetReference(_chars);
+ }
+
+ /// <summary>
+ /// Get a pinnable reference to the builder.
/// </summary>
/// <param name="terminate">Ensures that the builder has a null char after <see cref="Length"/></param>
- public ref char GetPinnableReference(bool terminate = false)
+ public ref char GetPinnableReference(bool terminate)
{
if (terminate)
{
diff --git a/src/System.Private.CoreLib/shared/System/Type.cs b/src/System.Private.CoreLib/shared/System/Type.cs
index 79f6b6f2f..c78d98833 100644
--- a/src/System.Private.CoreLib/shared/System/Type.cs
+++ b/src/System.Private.CoreLib/shared/System/Type.cs
@@ -346,6 +346,8 @@ namespace System
public virtual Type MakeGenericType(params Type[] typeArguments) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
public virtual Type MakePointerType() { throw new NotSupportedException(); }
+ public static Type MakeGenericSignatureType(Type genericTypeDefinition, params Type[] typeArguments) => new SignatureConstructedGenericType(genericTypeDefinition, typeArguments);
+
public static Type MakeGenericMethodParameter(int position)
{
if (position < 0)
diff --git a/src/System.Private.CoreLib/shared/System/Version.cs b/src/System.Private.CoreLib/shared/System/Version.cs
index 9d24270eb..444ee4885 100644
--- a/src/System.Private.CoreLib/shared/System/Version.cs
+++ b/src/System.Private.CoreLib/shared/System/Version.cs
@@ -341,7 +341,7 @@ namespace System
if (buildEnd != -1)
{
buildEnd += (minorEnd + 1);
- if (input.Slice(buildEnd + 1).IndexOf('.') != -1)
+ if (input.Slice(buildEnd + 1).Contains('.'))
{
if (throwOnFailure) throw new ArgumentException(SR.Arg_VersionString, nameof(input));
return null;
diff --git a/src/System.Private.CoreLib/src/System/Number.Unix.cs b/src/System.Private.CoreLib/src/System/Number.Unix.cs
index 909ca6a6e..f02a788f7 100644
--- a/src/System.Private.CoreLib/src/System/Number.Unix.cs
+++ b/src/System.Private.CoreLib/src/System/Number.Unix.cs
@@ -30,14 +30,9 @@ namespace System
char* dst = number.digits;
number.scale = 0;
- number.sign = false;
+ number.sign = double.IsNegative(value);
*dst = '\0';
- if (value < 0.0)
- {
- number.sign = true;
- }
-
if (value == 0.0)
{
for (int j = 0; j < precision; j++)
diff --git a/src/System.Private.CoreLib/src/System/Reflection/CustomAttributeData.cs b/src/System.Private.CoreLib/src/System/Reflection/CustomAttributeData.cs
index bdf6d56c2..71b85feae 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/CustomAttributeData.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/CustomAttributeData.cs
@@ -12,7 +12,7 @@ namespace System.Reflection
{
protected CustomAttributeData() { }
- public Type AttributeType
+ public virtual Type AttributeType
{
get
{
diff --git a/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILImporter.Interpreter.cs b/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILImporter.Interpreter.cs
index 8aac7110c..70b54d2a3 100644
--- a/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILImporter.Interpreter.cs
+++ b/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILImporter.Interpreter.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using Internal.Runtime.Interpreter;
using Internal.TypeSystem;
@@ -101,6 +102,15 @@ namespace Internal.IL
return _interpreter.TypeSystemContext.GetWellKnownType(wellKnownType);
}
+ public StackItem PopWithValidation()
+ {
+ bool hasStackItem = _interpreter.EvaluationStack.TryPop(out StackItem stackItem);
+ if (!hasStackItem)
+ ThrowHelper.ThrowInvalidProgramException();
+
+ return stackItem;
+ }
+
private void ImportNop()
{
// Do nothing!
@@ -143,37 +153,73 @@ namespace Internal.IL
private void ImportLoadNull()
{
- _interpreter.EvaluationStack.Push(new ObjectRefStackItem(null));
+ _interpreter.EvaluationStack.Push(StackItem.FromObjectRef(null));
}
private void ImportReturn()
{
- bool hasReturnValue = _interpreter.EvaluationStack.TryPop(out StackItem stackItem);
- if (!hasReturnValue)
+ var returnType = _method.Signature.ReturnType;
+ if (returnType.IsVoid)
return;
+
+ StackItem stackItem = PopWithValidation();
+ TypeFlags category = returnType.Category;
- switch (stackItem.Kind)
+ switch (category)
{
- case StackValueKind.Int32:
- _interpreter.SetReturnValue(((Int32StackItem)stackItem).Value);
+ case TypeFlags.Boolean:
+ _interpreter.SetReturnValue(stackItem.AsInt32() != 0);
+ break;
+ case TypeFlags.Char:
+ _interpreter.SetReturnValue((char)stackItem.AsInt32());
+ break;
+ case TypeFlags.SByte:
+ _interpreter.SetReturnValue((sbyte)stackItem.AsInt32());
+ break;
+ case TypeFlags.Byte:
+ _interpreter.SetReturnValue((byte)stackItem.AsInt32());
+ break;
+ case TypeFlags.Int16:
+ _interpreter.SetReturnValue((short)stackItem.AsInt32());
break;
- case StackValueKind.Int64:
- _interpreter.SetReturnValue(((Int64StackItem)stackItem).Value);
+ case TypeFlags.UInt16:
+ _interpreter.SetReturnValue((ushort)stackItem.AsInt32());
break;
- case StackValueKind.Unknown:
- case StackValueKind.NativeInt:
- case StackValueKind.Float:
- if (stackItem.Type == WellKnownType.Single)
- _interpreter.SetReturnValue(((FloatStackItem)stackItem).Value);
- else if (stackItem.Type == WellKnownType.Double)
- _interpreter.SetReturnValue(((DoubleStackItem)stackItem).Value);
+ case TypeFlags.Int32:
+ case TypeFlags.UInt32:
+ _interpreter.SetReturnValue(stackItem.AsInt32());
break;
- case StackValueKind.ByRef:
- case StackValueKind.ObjRef:
- _interpreter.SetReturnValue(((ObjectRefStackItem)stackItem).Value);
+ case TypeFlags.Int64:
+ case TypeFlags.UInt64:
+ _interpreter.SetReturnValue(stackItem.AsInt64());
break;
- case StackValueKind.ValueType:
+ case TypeFlags.IntPtr:
+ case TypeFlags.UIntPtr:
+ _interpreter.SetReturnValue(stackItem.AsIntPtr());
+ break;
+ case TypeFlags.Single:
+ _interpreter.SetReturnValue((float)stackItem.AsDouble());
+ break;
+ case TypeFlags.Double:
+ _interpreter.SetReturnValue(stackItem.AsDouble());
+ break;
+ case TypeFlags.ValueType:
+ _interpreter.SetReturnValue(stackItem.AsValueType());
+ break;
+ case TypeFlags.Interface:
+ case TypeFlags.Class:
+ case TypeFlags.Array:
+ case TypeFlags.SzArray:
+ _interpreter.SetReturnValue(stackItem.AsObjectRef());
+ break;
+ case TypeFlags.Enum:
+ case TypeFlags.Nullable:
+ case TypeFlags.ByRef:
+ case TypeFlags.Pointer:
+ case TypeFlags.FunctionPointer:
+ case TypeFlags.GenericParameter:
default:
+ // TODO: Support more complex return types
break;
}
}
@@ -181,19 +227,14 @@ namespace Internal.IL
private void ImportLoadInt(long value, StackValueKind kind)
{
if (kind == StackValueKind.Int32)
- _interpreter.EvaluationStack.Push(new Int32StackItem((int)value));
+ _interpreter.EvaluationStack.Push(StackItem.FromInt32((int)value));
else if (kind == StackValueKind.Int64)
- _interpreter.EvaluationStack.Push(new Int64StackItem(value));
- }
-
- private void ImportLoadFloat(float value)
- {
- _interpreter.EvaluationStack.Push(new FloatStackItem(value));
+ _interpreter.EvaluationStack.Push(StackItem.FromInt64(value));
}
private void ImportLoadFloat(double value)
{
- _interpreter.EvaluationStack.Push(new DoubleStackItem(value));
+ _interpreter.EvaluationStack.Push(StackItem.FromDouble(value));
}
private void ImportShiftOperation(ILOpcode opcode)
@@ -389,7 +430,7 @@ namespace Internal.IL
private void ImportLoadString(int token)
{
string str = (string)_methodIL.GetObject(token);
- _interpreter.EvaluationStack.Push(new ObjectRefStackItem(str));
+ _interpreter.EvaluationStack.Push(StackItem.FromObjectRef(str));
}
private void ImportBinaryOperation(ILOpcode opCode)
diff --git a/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILInterpreter.cs b/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILInterpreter.cs
index d78611ec9..f5f947c74 100644
--- a/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILInterpreter.cs
+++ b/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/ILInterpreter.cs
@@ -18,22 +18,10 @@ namespace Internal.Runtime.Interpreter
private readonly LowLevelStack<StackItem> _stack;
private CallInterceptorArgs _callInterceptorArgs;
-
- public LowLevelStack<StackItem> EvaluationStack
- {
- get
- {
- return _stack;
- }
- }
- public TypeSystemContext TypeSystemContext
- {
- get
- {
- return _context;
- }
- }
+ public LowLevelStack<StackItem> EvaluationStack => _stack;
+
+ public TypeSystemContext TypeSystemContext => _context;
public ILInterpreter(TypeSystemContext context, MethodDesc method, MethodIL methodIL)
{
diff --git a/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/StackItem.cs b/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/StackItem.cs
index 612bd350d..97578b61d 100644
--- a/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/StackItem.cs
+++ b/src/System.Private.Interpreter/src/Internal/Runtime/Interpreter/StackItem.cs
@@ -3,68 +3,103 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
using Internal.IL;
using Internal.TypeSystem;
namespace Internal.Runtime.Interpreter
{
- internal abstract class StackItem
+ [StructLayout(LayoutKind.Explicit)]
+ internal unsafe struct StackItem
{
- public StackValueKind Kind { get; protected set; }
- public WellKnownType Type { get; protected set; }
- }
+ [FieldOffset(0)]
+ private StackValueKind _kind;
- internal class StackItem<T> : StackItem
- {
- public T Value { get; }
+ [FieldOffset(8)]
+ private int _int32;
+
+ [FieldOffset(8)]
+ private long _int64;
+
+ [FieldOffset(8)]
+ private IntPtr _nativeInt;
+
+ [FieldOffset(8)]
+ private double _double;
- public StackItem(T value, StackValueKind kind, WellKnownType type)
+ [FieldOffset(16)]
+ private ValueType _valueType;
+
+ [FieldOffset(16)]
+ private object _objref;
+
+ public StackValueKind Kind => _kind;
+
+ public static StackItem FromInt32(int int32)
{
- Value = value;
- Kind = kind;
- Type = type;
+ return new StackItem { _int32 = int32, _kind = StackValueKind.Int32 };
}
- }
- internal class Int32StackItem : StackItem<int>
- {
- public Int32StackItem(int value) : base(value, StackValueKind.Int32, WellKnownType.Int32)
+ public int AsInt32()
{
+ Debug.Assert(_kind == StackValueKind.Int32);
+ return _int32;
}
- }
- internal class Int64StackItem : StackItem<long>
- {
- public Int64StackItem(long value) : base(value, StackValueKind.Int64, WellKnownType.Int64)
+ public static StackItem FromInt64(long int64)
{
+ return new StackItem { _int64 = int64, _kind = StackValueKind.Int64 };
}
- }
- internal class FloatStackItem : StackItem<float>
- {
- public FloatStackItem(float value) : base(value, StackValueKind.Float, WellKnownType.Single)
+ public long AsInt64()
{
+ Debug.Assert(_kind == StackValueKind.Int64);
+ return _int64;
}
- }
- internal class DoubleStackItem : StackItem<double>
- {
- public DoubleStackItem(double value) : base(value, StackValueKind.Float, WellKnownType.Double)
+ public static StackItem FromIntPtr(IntPtr nativeInt)
{
+ return new StackItem { _nativeInt = nativeInt, _kind = StackValueKind.NativeInt };
}
- }
- internal class ValueTypeStackItem : StackItem<ValueType>
- {
- public ValueTypeStackItem(ValueType value) : base(value, StackValueKind.ValueType, WellKnownType.ValueType)
+ public IntPtr AsIntPtr()
{
+ Debug.Assert(_kind == StackValueKind.NativeInt);
+ return _nativeInt;
}
- }
- internal class ObjectRefStackItem : StackItem<Object>
- {
- public ObjectRefStackItem(Object value) : base(value, StackValueKind.ObjRef, WellKnownType.Object)
+ public static StackItem FromDouble(double d)
+ {
+ return new StackItem { _double = d, _kind = StackValueKind.Float };
+ }
+
+ public double AsDouble()
+ {
+ Debug.Assert(_kind == StackValueKind.Float);
+ return _double;
+ }
+
+ public static StackItem FromValueType(ValueType valueType)
+ {
+ return new StackItem { _valueType = valueType, _kind = StackValueKind.ValueType };
+ }
+
+ public ValueType AsValueType()
+ {
+ Debug.Assert(_kind == StackValueKind.ValueType);
+ return _valueType;
+ }
+
+ public static StackItem FromObjectRef(object obj)
+ {
+ return new StackItem { _objref = obj, _kind = StackValueKind.ObjRef };
+ }
+
+ public object AsObjectRef()
{
+ Debug.Assert(_kind == StackValueKind.ObjRef);
+ return _objref;
}
}
}
diff --git a/src/System.Private.Reflection.Metadata/tests/System.Private.Reflection.Metadata.Tests.csproj b/src/System.Private.Reflection.Metadata/tests/System.Private.Reflection.Metadata.Tests.csproj
index 17e544899..08994fa92 100644
--- a/src/System.Private.Reflection.Metadata/tests/System.Private.Reflection.Metadata.Tests.csproj
+++ b/src/System.Private.Reflection.Metadata/tests/System.Private.Reflection.Metadata.Tests.csproj
@@ -6,7 +6,7 @@
<AssemblyName>System.Private.Reflection.Metadata.Tests</AssemblyName>
<RootNamespace>System.Private.Reflection.Metadata.Tests</RootNamespace>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <TargetFramework>netstandard1.3</TargetFramework>
+ <TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<NativeFormatCommonPath>..\..\Common\src\Internal\NativeFormat</NativeFormatCommonPath>
@@ -26,8 +26,11 @@
<Compile Include="$(MetadataCommonPath)\NativeFormatReaderGen.cs" />
</ItemGroup>
<ItemGroup>
- <PackageReference Include="Microsoft.DotNet.BuildTools.TestSuite">
- <Version>$(XunitNetcoreExtensionsVersion)</Version>
+ <PackageReference Include="xunit">
+ <Version>$(XUnitPackageVersion)</Version>
+ </PackageReference>
+ <PackageReference Include="Microsoft.DotNet.XUnitExtensions">
+ <Version>$(MicrosoftDotNetXUnitExtensionsVersion)</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
diff --git a/src/dirs.proj b/src/dirs.proj
index bc9ce5cad..a0ab1b264 100644
--- a/src/dirs.proj
+++ b/src/dirs.proj
@@ -2,9 +2,10 @@
<Import Project="dir.props" />
<ItemGroup>
- <!-- This project requires ILASM and we have access to that only on Windows -->
+ <!-- These projects requires ILASM and we have access to that only on Windows -->
<ExcludeProjects Condition="'$(OSEnvironment)'!='Windows_NT'" Include="**\TypeSystem.Tests.csproj" />
<ExcludeProjects Condition="'$(OSEnvironment)'!='Windows_NT'" Include="**\ILCompiler.MetadataTransform.Tests.csproj" />
+ <ExcludeProjects Condition="'$(OSEnvironment)'!='Windows_NT'" Include="**\ILVerification.Tests.csproj" />
<Project Include="AotPackageReference\AotPackageReference.depproj" />
diff --git a/tests/TopN.CoreFX.Windows.issues.json b/tests/TopN.CoreFX.Windows.issues.json
index b116139fa..4848b78f4 100644
--- a/tests/TopN.CoreFX.Windows.issues.json
+++ b/tests/TopN.CoreFX.Windows.issues.json
@@ -862,6 +862,10 @@
{
"name": "System.Tests.BitConverterArray.ConvertFromChar",
"reason": "System.ArgumentException"
+ },
+ {
+ "name": "System.Tests.ConvertToStringTests.FromBoxedObject",
+ "reason": "https://github.com/dotnet/coreclr/pull/19775"
}
]
}
diff --git a/tests/runtest.sh b/tests/runtest.sh
index 9489061bc..9da8a524a 100755
--- a/tests/runtest.sh
+++ b/tests/runtest.sh
@@ -39,6 +39,7 @@ run_test_dir()
local __dir_path=`dirname ${__test_dir}`
local __filename=`basename ${__dir_path}`
local __extra_args=""
+ local __extra_flags=()
if [ "${__mode}" = "Cpp" ]; then
__extra_args="${__extra_args} /p:NativeCodeGen=cpp"
fi
@@ -47,9 +48,11 @@ run_test_dir()
fi
if [ -n "${__extra_cxxflags}" ]; then
__extra_cxxflags="/p:AdditionalCppCompilerFlags=\"${__extra_cxxflags}\""
+ __extra_flags+=("${__extra_cxxflags}")
fi
- if [ -n "${__extra_cxxflags}" ]; then
+ if [ -n "${__extra_linkflags}" ]; then
__extra_linkflags="/p:AdditionalLinkerFlags=\"${__extra_linkflags}\""
+ __extra_flags+=("${__extra_linkflags}")
fi
if [ "${CoreRT_MultiFileConfiguration}" = "MultiModule" ]; then
__extra_args="${__extra_args} /p:IlcMultiModule=true"
@@ -59,8 +62,8 @@ run_test_dir()
local __msbuild_dir=${CoreRT_TestRoot}/../Tools
- echo ${__msbuild_dir}/msbuild.sh /ds /m /p:IlcPath=${CoreRT_ToolchainDir} /p:Configuration=${CoreRT_BuildType} /p:Platform=${CoreRT_BuildArch} /p:RepoLocalBuild=true "/p:FrameworkLibPath=${CoreRT_TestRoot}/../bin/${CoreRT_BuildOS}.${CoreRT_BuildArch}.${CoreRT_BuildType}/lib" "/p:FrameworkObjPath=${CoreRT_TestRoot}/../bin/obj/${CoreRT_BuildOS}.${CoreRT_BuildArch}.${CoreRT_BuildType}/Framework" ${__extra_args} ${__extra_cxxflags} ${__extra_linkflags} ${__dir_path}/${__filename}.csproj
- ${__msbuild_dir}/msbuild.sh /ds /m /p:IlcPath=${CoreRT_ToolchainDir} /p:Configuration=${CoreRT_BuildType} /p:Platform=${CoreRT_BuildArch} /p:OSGroup=${CoreRT_BuildOS} /p:RepoLocalBuild=true "/p:FrameworkLibPath=${CoreRT_TestRoot}/../bin/${CoreRT_BuildOS}.${CoreRT_BuildArch}.${CoreRT_BuildType}/lib" "/p:FrameworkObjPath=${CoreRT_TestRoot}/../bin/obj/${CoreRT_BuildOS}.${CoreRT_BuildArch}.${CoreRT_BuildType}/Framework" ${__extra_args} ${__extra_cxxflags} ${__extra_linkflags} ${__dir_path}/${__filename}.csproj
+ echo ${__msbuild_dir}/msbuild.sh /ds /m /p:IlcPath=${CoreRT_ToolchainDir} /p:Configuration=${CoreRT_BuildType} /p:Platform=${CoreRT_BuildArch} /p:OSGroup=${CoreRT_BuildOS} /p:RepoLocalBuild=true "/p:FrameworkLibPath=${CoreRT_TestRoot}/../bin/${CoreRT_BuildOS}.${CoreRT_BuildArch}.${CoreRT_BuildType}/lib" "/p:FrameworkObjPath=${CoreRT_TestRoot}/../bin/obj/${CoreRT_BuildOS}.${CoreRT_BuildArch}.${CoreRT_BuildType}/Framework" ${__extra_args} "${__extra_flags[@]}" ${__dir_path}/${__filename}.csproj
+ ${__msbuild_dir}/msbuild.sh /ds /m /p:IlcPath=${CoreRT_ToolchainDir} /p:Configuration=${CoreRT_BuildType} /p:Platform=${CoreRT_BuildArch} /p:OSGroup=${CoreRT_BuildOS} /p:RepoLocalBuild=true "/p:FrameworkLibPath=${CoreRT_TestRoot}/../bin/${CoreRT_BuildOS}.${CoreRT_BuildArch}.${CoreRT_BuildType}/lib" "/p:FrameworkObjPath=${CoreRT_TestRoot}/../bin/obj/${CoreRT_BuildOS}.${CoreRT_BuildArch}.${CoreRT_BuildType}/Framework" ${__extra_args} "${__extra_flags[@]}" ${__dir_path}/${__filename}.csproj
local __exitcode=$?
diff --git a/tests/src/Simple/HelloWasm/Program.cs b/tests/src/Simple/HelloWasm/Program.cs
index 95563912a..98ccb4eb1 100644
--- a/tests/src/Simple/HelloWasm/Program.cs
+++ b/tests/src/Simple/HelloWasm/Program.cs
@@ -15,6 +15,8 @@ internal static class Program
private static int threadStaticInt;
private static unsafe int Main(string[] args)
{
+ PrintLine("Starting");
+
Add(1, 2);
int tempInt = 0;
int tempInt2 = 0;
@@ -310,6 +312,8 @@ internal static class Program
PrintLine("ByReference intrinsics exercise via ReadOnlySpan OK.");
}
+ TestConstrainedClassCalls();
+
// This test should remain last to get other results before stopping the debugger
PrintLine("Debugger.Break() test: Ok if debugger is open and breaks.");
System.Diagnostics.Debugger.Break();
@@ -490,6 +494,113 @@ internal static class Program
}
}
+ private static void TestConstrainedClassCalls()
+ {
+ string s = "utf-8";
+
+ PrintString("Direct ToString test: ");
+ string stringDirectToString = s.ToString();
+ if (s.Equals(stringDirectToString))
+ {
+ PrintLine("Ok.");
+ }
+ else
+ {
+ PrintString("Failed. Returned string:\"");
+ PrintString(stringDirectToString);
+ PrintLine("\"");
+ }
+
+ // Generic calls on methods not defined on object
+ uint dataFromBase = GenericGetData<MyBase>(new MyBase(11));
+ PrintString("Generic call to base class test: ");
+ if (dataFromBase == 11)
+ {
+ PrintLine("Ok.");
+ }
+ else
+ {
+ PrintLine("Failed.");
+ }
+
+ uint dataFromUnsealed = GenericGetData<UnsealedDerived>(new UnsealedDerived(13));
+ PrintString("Generic call to unsealed derived class test: ");
+ if (dataFromUnsealed == 26)
+ {
+ PrintLine("Ok.");
+ }
+ else
+ {
+ PrintLine("Failed.");
+ }
+
+ uint dataFromSealed = GenericGetData<SealedDerived>(new SealedDerived(15));
+ PrintString("Generic call to sealed derived class test: ");
+ if (dataFromSealed == 45)
+ {
+ PrintLine("Ok.");
+ }
+ else
+ {
+ PrintLine("Failed.");
+ }
+
+ uint dataFromUnsealedAsBase = GenericGetData<MyBase>(new UnsealedDerived(17));
+ PrintString("Generic call to unsealed derived class as base test: ");
+ if (dataFromUnsealedAsBase == 34)
+ {
+ PrintLine("Ok.");
+ }
+ else
+ {
+ PrintLine("Failed.");
+ }
+
+ uint dataFromSealedAsBase = GenericGetData<MyBase>(new SealedDerived(19));
+ PrintString("Generic call to sealed derived class as base test: ");
+ if (dataFromSealedAsBase == 57)
+ {
+ PrintLine("Ok.");
+ }
+ else
+ {
+ PrintLine("Failed.");
+ }
+
+ // Generic calls to methods defined on object
+ uint hashCodeOfSealedViaGeneric = (uint)GenericGetHashCode<MySealedClass>(new MySealedClass(37));
+ PrintString("Generic GetHashCode for sealed class test: ");
+ if (hashCodeOfSealedViaGeneric == 74)
+ {
+ PrintLine("Ok.");
+ }
+ else
+ {
+ PrintLine("Failed.");
+ }
+
+ uint hashCodeOfUnsealedViaGeneric = (uint)GenericGetHashCode<MyUnsealedClass>(new MyUnsealedClass(41));
+ PrintString("Generic GetHashCode for unsealed class test: ");
+ if (hashCodeOfUnsealedViaGeneric == 82)
+ {
+ PrintLine("Ok.");
+ }
+ else
+ {
+ PrintLine("Failed.");
+ }
+ }
+
+ static uint GenericGetData<T>(T obj) where T : MyBase
+ {
+ return obj.GetData();
+ }
+
+ static int GenericGetHashCode<T>(T obj)
+ {
+ return obj.GetHashCode();
+ }
+
[DllImport("*")]
private static unsafe extern int printf(byte* str, byte* unused);
}
@@ -646,3 +757,97 @@ public struct ItfStruct : ITestItf
return 4;
}
}
+
+public sealed class MySealedClass
+{
+ uint _data;
+
+ public MySealedClass()
+ {
+ _data = 104;
+ }
+
+ public MySealedClass(uint data)
+ {
+ _data = data;
+ }
+
+ public uint GetData()
+ {
+ return _data;
+ }
+
+ public override int GetHashCode()
+ {
+ return (int)_data * 2;
+ }
+
+ public override string ToString()
+ {
+ Program.PrintLine("MySealedClass.ToString called. Data:");
+ Program.PrintLine(_data.ToString());
+ return _data.ToString();
+ }
+}
+
+public class MyUnsealedClass
+{
+ uint _data;
+
+ public MyUnsealedClass()
+ {
+ _data = 24;
+ }
+
+ public MyUnsealedClass(uint data)
+ {
+ _data = data;
+ }
+
+ public uint GetData()
+ {
+ return _data;
+ }
+
+ public override int GetHashCode()
+ {
+ return (int)_data * 2;
+ }
+
+ public override string ToString()
+ {
+ return _data.ToString();
+ }
+}
+
+public class MyBase
+{
+ protected uint _data;
+ public MyBase(uint data)
+ {
+ _data = data;
+ }
+
+ public virtual uint GetData()
+ {
+ return _data;
+ }
+}
+
+public class UnsealedDerived : MyBase
+{
+ public UnsealedDerived(uint data) : base(data) { }
+ public override uint GetData()
+ {
+ return _data * 2;
+ }
+}
+
+public sealed class SealedDerived : MyBase
+{
+ public SealedDerived(uint data) : base(data) { }
+ public override uint GetData()
+ {
+ return _data * 3;
+ }
+}