diff options
Diffstat (limited to 'src')
74 files changed, 1083 insertions, 447 deletions
diff --git a/src/.nuget/Microsoft.NETCore.Native/Microsoft.NETCore.Native.builds b/src/.nuget/Microsoft.NETCore.Native/Microsoft.NETCore.Native.builds new file mode 100644 index 0000000000..a178ddb961 --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/Microsoft.NETCore.Native.builds @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + + <PropertyGroup> + <!-- This property must be set to the same value as $(PackageOutputPath) for the nuspecs and nupkgs to be binplaced to the intended location. --> + <OutputPath>$(PackageOutputPath)</OutputPath> + </PropertyGroup> + + <!-- We always build the identity/redirection package. However, the platform specific runtime-*.nupkg is built based upon the target OS we are building the product for. --> + <ItemGroup> + <Project Include="Microsoft.NETCore.Native.pkgproj"> + </Project> + <Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'linux-x64'" Include="linux/Microsoft.NETCore.Native.pkgproj"> + <OSGroup>Linux</OSGroup> + <Platform>amd64</Platform> + </Project> + <Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'debian.8-x64'" Include="debian/Microsoft.NETCore.Native.pkgproj"> + <OSGroup>Linux</OSGroup> + <Platform>amd64</Platform> + </Project> + <Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'fedora.23-x64'" Include="fedora/23/Microsoft.NETCore.Native.pkgproj"> + <OSGroup>Linux</OSGroup> + <Platform>amd64</Platform> + </Project> + <Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'fedora.24-x64'" Include="fedora/24/Microsoft.NETCore.Native.pkgproj"> + <OSGroup>Linux</OSGroup> + <Platform>amd64</Platform> + </Project> + <Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'opensuse.13.2-x64'" Include="opensuse/13.2/Microsoft.NETCore.Native.pkgproj"> + <OSGroup>Linux</OSGroup> + <Platform>amd64</Platform> + </Project> + <Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'opensuse.42.1-x64'" Include="opensuse/42.1/Microsoft.NETCore.Native.pkgproj"> + <OSGroup>Linux</OSGroup> + <Platform>amd64</Platform> + </Project> + <Project Condition="'$(TargetsLinux)' == 'true' and $(DistroRid.StartsWith('rhel.7'))" Include="rhel/Microsoft.NETCore.Native.pkgproj"> + <OSGroup>Linux</OSGroup> + <Platform>amd64</Platform> + </Project> + <Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'ubuntu.14.04-x64'" Include="ubuntu/14.04/Microsoft.NETCore.Native.pkgproj"> + <OSGroup>Linux</OSGroup> + <Platform>amd64</Platform> + </Project> + <Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'ubuntu.16.04-x64'" Include="ubuntu/16.04/Microsoft.NETCore.Native.pkgproj"> + <OSGroup>Linux</OSGroup> + <Platform>amd64</Platform> + </Project> + <Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'ubuntu.16.10-x64'" Include="ubuntu/16.10/Microsoft.NETCore.Native.pkgproj"> + <OSGroup>Linux</OSGroup> + <Platform>amd64</Platform> + </Project> + <Project Condition="'$(TargetsLinux)' == 'true' and '$(DistroRid)' == 'alpine.3.4.3-x64'" Include="alpine/3.4.3/Microsoft.NETCore.Native.pkgproj"> + <OSGroup>Linux</OSGroup> + <Platform>amd64</Platform> + </Project> + <Project Condition="'$(TargetsOSX)' == 'true'" Include="osx/Microsoft.NETCore.Native.pkgproj"> + <OSGroup>OSX</OSGroup> + <Platform>amd64</Platform> + </Project> + </ItemGroup> + + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..51b524a1c8 --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <SkipValidatePackage>true</SkipValidatePackage> + <PackagePlatforms>x64;x86;arm64;arm;</PackagePlatforms> + <OutputPath>$(PackagesOutputPath)</OutputPath> + <IncludeRuntimeJson>true</IncludeRuntimeJson> + </PropertyGroup> + <ItemGroup> + <ProjectReference Include="linux\Microsoft.NETCore.Native.pkgproj"> + <Platform>amd64</Platform> + </ProjectReference> + <ProjectReference Include="debian\Microsoft.NETCore.Native.pkgproj"> + <Platform>amd64</Platform> + </ProjectReference> + <ProjectReference Include="fedora\23\Microsoft.NETCore.Native.pkgproj"> + <Platform>amd64</Platform> + </ProjectReference> + <ProjectReference Include="fedora\24\Microsoft.NETCore.Native.pkgproj"> + <Platform>amd64</Platform> + </ProjectReference> + <ProjectReference Include="opensuse\13.2\Microsoft.NETCore.Native.pkgproj"> + <Platform>amd64</Platform> + </ProjectReference> + <ProjectReference Include="opensuse\42.1\Microsoft.NETCore.Native.pkgproj"> + <Platform>amd64</Platform> + </ProjectReference> + <ProjectReference Include="rhel\Microsoft.NETCore.Native.pkgproj"> + <Platform>amd64</Platform> + </ProjectReference> + <ProjectReference Include="ubuntu\14.04\Microsoft.NETCore.Native.pkgproj"> + <Platform>amd64</Platform> + </ProjectReference> + <ProjectReference Include="ubuntu\16.04\Microsoft.NETCore.Native.pkgproj"> + <Platform>amd64</Platform> + </ProjectReference> + <ProjectReference Include="ubuntu\16.10\Microsoft.NETCore.Native.pkgproj"> + <Platform>amd64</Platform> + </ProjectReference> + <ProjectReference Include="alpine\3.4.3\Microsoft.NETCore.Native.pkgproj"> + <Platform>amd64</Platform> + </ProjectReference> + <ProjectReference Include="osx\Microsoft.NETCore.Native.pkgproj"> + <Platform>amd64</Platform> + </ProjectReference> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/alpine/3.4.3/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/alpine/3.4.3/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..90545a9001 --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/alpine/3.4.3/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <PackageTargetRuntime>alpine.3.4.3-$(PackagePlatform)</PackageTargetRuntime> + <!-- only build for x64 --> + <PackagePlatforms>x64;</PackagePlatforms> + </PropertyGroup> + <ItemGroup> + <NativeBinary Include="$(BinDir)libSystem.Globalization.Native.a" /> + <NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.so" /> + <ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" /> + <File Include="@(ArchitectureSpecificNativeFile);@(NativeBinary)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + </File> + </ItemGroup> + <ItemGroup Condition="'$(__BuildType)' == 'Release'"> + <ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" /> + <AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" /> + <ArchitectureSpecificNativeSymbol Include="..\..\..\_.pdb" /> + <File Include="@(ArchitectureSpecificNativeSymbol)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + <IsSymbolFile>true</IsSymbolFile> + </File> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/debian/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/debian/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..c136a2c057 --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/debian/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <PackageTargetRuntime>debian.8-$(PackagePlatform)</PackageTargetRuntime> + <!-- only build for x64 --> + <PackagePlatforms>x64;</PackagePlatforms> + </PropertyGroup> + <ItemGroup> + <NativeBinary Include="$(BinDir)libSystem.Globalization.Native.a" /> + <NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.so" /> + <ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" /> + <File Include="@(ArchitectureSpecificNativeFile);@(NativeBinary)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + </File> + </ItemGroup> + <ItemGroup Condition="'$(__BuildType)' == 'Release'"> + <ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" /> + <AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" /> + <ArchitectureSpecificNativeSymbol Include="..\..\_.pdb" /> + <File Include="@(ArchitectureSpecificNativeSymbol)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + <IsSymbolFile>true</IsSymbolFile> + </File> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/fedora/23/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/fedora/23/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..8547114cdd --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/fedora/23/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <PackageTargetRuntime>fedora.23-$(PackagePlatform)</PackageTargetRuntime> + <!-- only build for x64 --> + <PackagePlatforms>x64;</PackagePlatforms> + </PropertyGroup> + <ItemGroup> + <NativeBinary Include="$(BinDir)libSystem.Globalization.Native.a" /> + <NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.so" /> + <ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" /> + <File Include="@(ArchitectureSpecificNativeFile);@(NativeBinary)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + </File> + </ItemGroup> + <ItemGroup Condition="'$(__BuildType)' == 'Release'"> + <ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" /> + <AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" /> + <ArchitectureSpecificNativeSymbol Include="..\..\..\_.pdb" /> + <File Include="@(ArchitectureSpecificNativeSymbol)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + <IsSymbolFile>true</IsSymbolFile> + </File> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/fedora/24/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/fedora/24/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..f4987de01d --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/fedora/24/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <PackageTargetRuntime>fedora.24-$(PackagePlatform)</PackageTargetRuntime> + <!-- only build for x64 --> + <PackagePlatforms>x64;</PackagePlatforms> + </PropertyGroup> + <ItemGroup> + <NativeBinary Include="$(BinDir)libSystem.Globalization.Native.a" /> + <NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.so" /> + <ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" /> + <File Include="@(ArchitectureSpecificNativeFile);@(NativeBinary)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + </File> + </ItemGroup> + <ItemGroup Condition="'$(__BuildType)' == 'Release'"> + <ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" /> + <AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" /> + <ArchitectureSpecificNativeSymbol Include="..\..\..\_.pdb" /> + <File Include="@(ArchitectureSpecificNativeSymbol)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + <IsSymbolFile>true</IsSymbolFile> + </File> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/linux/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/linux/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..8b1064f081 --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/linux/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <PackageTargetRuntime>linux-$(PackagePlatform)</PackageTargetRuntime> + <!-- only build for x64 --> + <PackagePlatforms>x64;</PackagePlatforms> + </PropertyGroup> + <ItemGroup> + <NativeBinary Include="$(BinDir)libSystem.Globalization.Native.a" /> + <NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.so" /> + <ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" /> + <File Include="@(ArchitectureSpecificNativeFile);@(NativeBinary)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + </File> + </ItemGroup> + <ItemGroup Condition="'$(__BuildType)' == 'Release'"> + <ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" /> + <AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" /> + <ArchitectureSpecificNativeSymbol Include="..\..\_.pdb" /> + <File Include="@(ArchitectureSpecificNativeSymbol)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + <IsSymbolFile>true</IsSymbolFile> + </File> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/opensuse/13.2/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/opensuse/13.2/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..bf8307a0b3 --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/opensuse/13.2/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <PackageTargetRuntime>opensuse.13.2-$(PackagePlatform)</PackageTargetRuntime> + <!-- only build for x64 --> + <PackagePlatforms>x64;</PackagePlatforms> + </PropertyGroup> + <ItemGroup> + <NativeBinary Include="$(BinDir)libSystem.Globalization.Native.a" /> + <NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.so" /> + <ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" /> + <File Include="@(ArchitectureSpecificNativeFile);@(NativeBinary)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + </File> + </ItemGroup> + <ItemGroup Condition="'$(__BuildType)' == 'Release'"> + <ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" /> + <AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" /> + <ArchitectureSpecificNativeSymbol Include="..\..\..\_.pdb" /> + <File Include="@(ArchitectureSpecificNativeSymbol)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + <IsSymbolFile>true</IsSymbolFile> + </File> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/opensuse/42.1/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/opensuse/42.1/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..19ac91cd88 --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/opensuse/42.1/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <PackageTargetRuntime>opensuse.42.1-$(PackagePlatform)</PackageTargetRuntime> + <!-- only build for x64 --> + <PackagePlatforms>x64;</PackagePlatforms> + </PropertyGroup> + <ItemGroup> + <NativeBinary Include="$(BinDir)libSystem.Globalization.Native.a" /> + <NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.so" /> + <ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" /> + <File Include="@(ArchitectureSpecificNativeFile);@(NativeBinary)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + </File> + </ItemGroup> + <ItemGroup Condition="'$(__BuildType)' == 'Release'"> + <ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" /> + <AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" /> + <ArchitectureSpecificNativeSymbol Include="..\..\..\_.pdb" /> + <File Include="@(ArchitectureSpecificNativeSymbol)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + <IsSymbolFile>true</IsSymbolFile> + </File> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/osx/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/osx/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..b358c86799 --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/osx/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <PackageTargetRuntime>osx.10.10-$(PackagePlatform)</PackageTargetRuntime> + <!-- only build for x64 --> + <PackagePlatforms>x64;</PackagePlatforms> + </PropertyGroup> + <ItemGroup> + <NativeBinary Include="$(BinDir)libSystem.Globalization.Native.a" /> + <NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.dylib" /> + <ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" /> + <File Include="@(ArchitectureSpecificNativeFile);@(NativeBinary)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + </File> + </ItemGroup> + <ItemGroup Condition="'$(__BuildType)' == 'Release'"> + <ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dwarf')" /> + <AdditionalLibPackageExcludes Include="%2A%2A\%2A.dwarf" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dylib" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" /> + <ArchitectureSpecificNativeSymbol Include="..\..\_.pdb" /> + <File Include="@(ArchitectureSpecificNativeSymbol)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + <IsSymbolFile>true</IsSymbolFile> + </File> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/rhel/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/rhel/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..f9dc309a6b --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/rhel/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <PackageTargetRuntime>rhel.7-$(PackagePlatform)</PackageTargetRuntime> + <!-- only build for x64 --> + <PackagePlatforms>x64;</PackagePlatforms> + </PropertyGroup> + <ItemGroup> + <NativeBinary Include="$(BinDir)libSystem.Globalization.Native.a" /> + <NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.so" /> + <ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" /> + <File Include="@(ArchitectureSpecificNativeFile);@(NativeBinary)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + </File> + </ItemGroup> + <ItemGroup Condition="'$(__BuildType)' == 'Release'"> + <ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" /> + <AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" /> + <ArchitectureSpecificNativeSymbol Include="..\..\_.pdb" /> + <File Include="@(ArchitectureSpecificNativeSymbol)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + <IsSymbolFile>true</IsSymbolFile> + </File> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/ubuntu/14.04/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/ubuntu/14.04/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..d1c5be74ff --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/ubuntu/14.04/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <PackageTargetRuntime>ubuntu.14.04-$(PackagePlatform)</PackageTargetRuntime> + <!-- only build for x64 --> + <PackagePlatforms>x64;</PackagePlatforms> + </PropertyGroup> + <ItemGroup> + <NativeBinary Include="$(BinDir)libSystem.Globalization.Native.a" /> + <NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.so" /> + <ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" /> + <File Include="@(ArchitectureSpecificNativeFile);@(NativeBinary)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + </File> + </ItemGroup> + <ItemGroup Condition="'$(__BuildType)' == 'Release'"> + <ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" /> + <AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" /> + <ArchitectureSpecificNativeSymbol Include="..\..\..\_.pdb" /> + <File Include="@(ArchitectureSpecificNativeSymbol)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + <IsSymbolFile>true</IsSymbolFile> + </File> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/ubuntu/16.04/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/ubuntu/16.04/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..b2b0f96587 --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/ubuntu/16.04/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <PackageTargetRuntime>ubuntu.16.04-$(PackagePlatform)</PackageTargetRuntime> + <!-- only build for x64 --> + <PackagePlatforms>x64;</PackagePlatforms> + </PropertyGroup> + <ItemGroup> + <NativeBinary Include="$(BinDir)libSystem.Globalization.Native.a" /> + <NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.so" /> + <ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" /> + <File Include="@(ArchitectureSpecificNativeFile);@(NativeBinary)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + </File> + </ItemGroup> + <ItemGroup Condition="'$(__BuildType)' == 'Release'"> + <ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" /> + <AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" /> + <ArchitectureSpecificNativeSymbol Include="..\..\..\_.pdb" /> + <File Include="@(ArchitectureSpecificNativeSymbol)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + <IsSymbolFile>true</IsSymbolFile> + </File> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/Microsoft.NETCore.Native/ubuntu/16.10/Microsoft.NETCore.Native.pkgproj b/src/.nuget/Microsoft.NETCore.Native/ubuntu/16.10/Microsoft.NETCore.Native.pkgproj new file mode 100644 index 0000000000..da4a03d668 --- /dev/null +++ b/src/.nuget/Microsoft.NETCore.Native/ubuntu/16.10/Microsoft.NETCore.Native.pkgproj @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <SkipPackageFileCheck>true</SkipPackageFileCheck> + <PackageTargetRuntime>ubuntu.16.10-$(PackagePlatform)</PackageTargetRuntime> + <!-- only build for x64 --> + <PackagePlatforms>x64;</PackagePlatforms> + </PropertyGroup> + <ItemGroup> + <NativeBinary Include="$(BinDir)libSystem.Globalization.Native.a" /> + <NativeSplittableBinary Include="$(BinDir)System.Globalization.Native.so" /> + <ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)" /> + <File Include="@(ArchitectureSpecificNativeFile);@(NativeBinary)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + </File> + </ItemGroup> + <ItemGroup Condition="'$(__BuildType)' == 'Release'"> + <ArchitectureSpecificNativeSymbol Include="@(NativeSplittableBinary -> '%(Identity).dbg')" /> + <AdditionalLibPackageExcludes Include="%2A%2A\%2A.dbg" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.so" /> + <AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" /> + <ArchitectureSpecificNativeSymbol Include="..\..\..\_.pdb" /> + <File Include="@(ArchitectureSpecificNativeSymbol)"> + <TargetPath>runtimes/$(PackageTargetRuntime)/native</TargetPath> + <IsSymbolFile>true</IsSymbolFile> + </File> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/src/.nuget/descriptions.json b/src/.nuget/descriptions.json index 640ff0251f..ccb6af8bbd 100644 --- a/src/.nuget/descriptions.json +++ b/src/.nuget/descriptions.json @@ -38,5 +38,10 @@ "Name": "Microsoft.NETCore.TestHost", "Description": "CoreCLR application host for test applications", "CommonTypes": [ ] + }, + { + "Name": "Microsoft.NETCore.Native", + "Description": "Native shims for .NET Core runtime", + "CommonTypes": [ ] } ] diff --git a/src/.nuget/packages.builds b/src/.nuget/packages.builds index 7458c8e56f..5d1d025100 100644 --- a/src/.nuget/packages.builds +++ b/src/.nuget/packages.builds @@ -18,6 +18,7 @@ <ItemGroup Condition="'$(__SkipNativeBuild)'==''"> <Project Include="Microsoft.NETCore.Jit\Microsoft.NETCore.Jit.builds" /> <Project Include="Microsoft.NETCore.TestHost\Microsoft.NETCore.TestHost.builds" /> + <Project Include="Microsoft.NETCore.Native\Microsoft.NETCore.Native.builds" /> </ItemGroup> <ItemGroup> diff --git a/src/ToolBox/SOS/Strike/disasmARM.cpp b/src/ToolBox/SOS/Strike/disasmARM.cpp index 82173558fd..cc80d77590 100644 --- a/src/ToolBox/SOS/Strike/disasmARM.cpp +++ b/src/ToolBox/SOS/Strike/disasmARM.cpp @@ -28,6 +28,7 @@ namespace ARMGCDump { #undef _TARGET_X86_ +#define WIN64EXCEPTIONS #undef LIMITED_METHOD_CONTRACT #define LIMITED_METHOD_DAC_CONTRACT #define SUPPORTS_DAC diff --git a/src/corefx/System.Globalization.Native/CMakeLists.txt b/src/corefx/System.Globalization.Native/CMakeLists.txt index 90f50671cd..9ecb0e08b9 100644 --- a/src/corefx/System.Globalization.Native/CMakeLists.txt +++ b/src/corefx/System.Globalization.Native/CMakeLists.txt @@ -67,6 +67,14 @@ _add_library(System.Globalization.Native ${NATIVEGLOBALIZATION_SOURCES} ) +_add_library(System.Globalization.Native_Static + STATIC + ${NATIVEGLOBALIZATION_SOURCES} +) + +# Remove the _Static postfix from the static library name +set_target_properties(System.Globalization.Native_Static PROPERTIES OUTPUT_NAME System.Globalization.Native) + # Disable the "lib" prefix. set_target_properties(System.Globalization.Native PROPERTIES PREFIX "") @@ -80,10 +88,17 @@ if(NOT CLR_CMAKE_PLATFORM_DARWIN) ${ICUUC} ${ICUI18N} ) + target_link_libraries(System.Globalization.Native_Static + ${ICUUC} + ${ICUI18N} + ) elseif(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD) target_link_libraries(System.Globalization.Native dl ) + target_link_libraries(System.Globalization.Native_Static + dl + ) endif() else() target_link_libraries(System.Globalization.Native @@ -100,4 +115,5 @@ verify_dependencies( # add the install targets install_clr(System.Globalization.Native) +install(TARGETS System.Globalization.Native_Static DESTINATION .) diff --git a/src/debug/daccess/dacfn.cpp b/src/debug/daccess/dacfn.cpp index d8bae7746f..33dfa10b54 100644 --- a/src/debug/daccess/dacfn.cpp +++ b/src/debug/daccess/dacfn.cpp @@ -219,7 +219,7 @@ DacWriteAll(TADDR addr, PVOID buffer, ULONG32 size, bool throwEx) #ifdef FEATURE_PAL HRESULT -DacVirtualUnwind(DWORD threadId, PCONTEXT context, PT_KNONVOLATILE_CONTEXT_POINTERS contextPointers) +DacVirtualUnwind(DWORD threadId, PT_CONTEXT context, PT_KNONVOLATILE_CONTEXT_POINTERS contextPointers) { if (!g_dacImpl) { diff --git a/src/debug/daccess/enummem.cpp b/src/debug/daccess/enummem.cpp index d66af05769..0f38aa582a 100644 --- a/src/debug/daccess/enummem.cpp +++ b/src/debug/daccess/enummem.cpp @@ -970,7 +970,7 @@ HRESULT ClrDataAccess::EnumMemWalkStackHelper(CLRDataEnumMemoryFlags flags, // Pulls in sequence points and local variable info DebugInfoManager::EnumMemoryRegionsForMethodDebugInfo(flags, pMethodDesc); -#ifdef WIN64EXCEPTIONS +#if defined(WIN64EXCEPTIONS) && defined(USE_GC_INFO_DECODER) if (addr != NULL) { @@ -988,7 +988,7 @@ HRESULT ClrDataAccess::EnumMemWalkStackHelper(CLRDataEnumMemoryFlags flags, DacEnumMemoryRegion(dac_cast<TADDR>(pGCInfo), gcDecoder.GetNumBytesRead(), true); } } -#endif // WIN64EXCEPTIONS +#endif // WIN64EXCEPTIONS && USE_GC_INFO_DECODER } pMethodDefinition.Clear(); } diff --git a/src/debug/di/rspriv.h b/src/debug/di/rspriv.h index 18920add5d..8f369b7414 100644 --- a/src/debug/di/rspriv.h +++ b/src/debug/di/rspriv.h @@ -6929,11 +6929,11 @@ public: // new-style constructor CordbMiscFrame(DebuggerIPCE_JITFuncData * pJITFuncData); -#if defined(DBG_TARGET_WIN64) || defined(DBG_TARGET_ARM) +#ifdef WIN64EXCEPTIONS SIZE_T parentIP; FramePointer fpParentOrSelf; bool fIsFilterFunclet; -#endif // DBG_TARGET_WIN64 || DBG_TARGET_ARM +#endif // WIN64EXCEPTIONS }; diff --git a/src/debug/di/rsthread.cpp b/src/debug/di/rsthread.cpp index a4660be570..02fae00b0f 100644 --- a/src/debug/di/rsthread.cpp +++ b/src/debug/di/rsthread.cpp @@ -5849,11 +5849,11 @@ CordbMiscFrame::CordbMiscFrame() // the real constructor which stores the funclet-related information in the CordbMiscFrame CordbMiscFrame::CordbMiscFrame(DebuggerIPCE_JITFuncData * pJITFuncData) { -#if defined(DBG_TARGET_WIN64) || defined(DBG_TARGET_ARM) +#ifdef WIN64EXCEPTIONS this->parentIP = pJITFuncData->parentNativeOffset; this->fpParentOrSelf = pJITFuncData->fpParentOrSelf; this->fIsFilterFunclet = (pJITFuncData->fIsFilterFrame == TRUE); -#endif // DBG_TARGET_WIN64 || DBG_TARGET_ARM +#endif // WIN64EXCEPTIONS } /* ------------------------------------------------------------------------- * diff --git a/src/debug/inc/dbgipcevents.h b/src/debug/inc/dbgipcevents.h index 6ace36e011..1b4dec7c16 100644 --- a/src/debug/inc/dbgipcevents.h +++ b/src/debug/inc/dbgipcevents.h @@ -1355,11 +1355,11 @@ struct MSLAYOUT DebuggerIPCE_JITFuncData LSPTR_DJI nativeCodeJITInfoToken; VMPTR_MethodDesc vmNativeCodeMethodDescToken; -#if defined(DBG_TARGET_WIN64) || defined(DBG_TARGET_ARM) +#ifdef WIN64EXCEPTIONS BOOL fIsFilterFrame; SIZE_T parentNativeOffset; FramePointer fpParentOrSelf; -#endif // DBG_TARGET_WIN64 || DBG_TARGET_ARM +#endif // WIN64EXCEPTIONS // indicates if the MethodDesc is a generic function or a method inside a generic class (or // both!). diff --git a/src/inc/clrnt.h b/src/inc/clrnt.h index 0e082c79d5..9a4601ebaf 100644 --- a/src/inc/clrnt.h +++ b/src/inc/clrnt.h @@ -837,6 +837,13 @@ RtlVirtualUnwind_Unsafe( #ifdef _TARGET_X86_ #ifndef FEATURE_PAL +// +// x86 ABI does not define RUNTIME_FUNCTION. Define our own to allow unification between x86 and other platforms. +// +typedef struct _RUNTIME_FUNCTION { + DWORD BeginAddress; + DWORD UnwindData; +} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION; typedef struct _DISPATCHER_CONTEXT { _EXCEPTION_REGISTRATION_RECORD* RegistrationPointer; @@ -845,6 +852,43 @@ typedef struct _DISPATCHER_CONTEXT { #endif // !FEATURE_PAL #define RUNTIME_FUNCTION__BeginAddress(prf) (prf)->BeginAddress +#define RUNTIME_FUNCTION__SetBeginAddress(prf,addr) ((prf)->BeginAddress = (addr)) + +#ifdef WIN64EXCEPTIONS +EXTERN_C ULONG +RtlpGetFunctionEndAddress ( + __in PT_RUNTIME_FUNCTION FunctionEntry, + __in ULONG ImageBase + ); + +#define RUNTIME_FUNCTION__EndAddress(prf, ImageBase) RtlpGetFunctionEndAddress(prf, ImageBase) + +#define RUNTIME_FUNCTION__GetUnwindInfoAddress(prf) (prf)->UnwindData +#define RUNTIME_FUNCTION__SetUnwindInfoAddress(prf, addr) do { (prf)->UnwindData = (addr); } while(0) + +#define UNW_FLAG_NHANDLER 0x0 /* any handler */ +#define UNW_FLAG_EHANDLER 0x1 /* filter handler */ +#define UNW_FLAG_UHANDLER 0x2 /* unwind handler */ + +typedef struct _UNWIND_INFO { + // dummy +} UNWIND_INFO, *PUNWIND_INFO; + +EXTERN_C +NTSYSAPI +PEXCEPTION_ROUTINE +NTAPI +RtlVirtualUnwind ( + __in DWORD HandlerType, + __in DWORD ImageBase, + __in DWORD ControlPc, + __in PRUNTIME_FUNCTION FunctionEntry, + __inout PT_CONTEXT ContextRecord, + __out PVOID *HandlerData, + __out PDWORD EstablisherFrame, + __inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers + ); +#endif // WIN64EXCEPTIONS #endif // _TARGET_X86_ diff --git a/src/inc/corcompile.h b/src/inc/corcompile.h index 3b517ae212..73463146c6 100644 --- a/src/inc/corcompile.h +++ b/src/inc/corcompile.h @@ -22,11 +22,11 @@ #error FEATURE_PREJIT is required for this file #endif // FEATURE_PREJIT -#if !defined(_TARGET_X86_) +#if !defined(_TARGET_X86_) || defined(FEATURE_PAL) #ifndef WIN64EXCEPTIONS #define WIN64EXCEPTIONS #endif -#endif // !_TARGET_X86_ +#endif // !_TARGET_X86_ || FEATURE_PAL #include <cor.h> #include <corhdr.h> @@ -72,16 +72,6 @@ typedef DPTR(struct CORCOMPILE_IMPORT_SECTION) PTR_CORCOMPILE_IMPORT_SECTION; #ifdef _TARGET_X86_ -#ifndef FEATURE_PAL -// -// x86 ABI does not define RUNTIME_FUNCTION. Define our own to allow unification between x86 and other platforms. -// -typedef struct _RUNTIME_FUNCTION { - DWORD BeginAddress; - DWORD UnwindData; -} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION; - -#endif // !FEATURE_PAL typedef DPTR(RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION; diff --git a/src/inc/daccess.h b/src/inc/daccess.h index 6d9fb3265f..3e3a62c746 100644 --- a/src/inc/daccess.h +++ b/src/inc/daccess.h @@ -784,7 +784,7 @@ BOOL DacUnwindStackFrame(T_CONTEXT * pContext, T_KNONVOLATILE_CONTEXT_POINTERS* #if defined(FEATURE_PAL) // call back through data target to unwind out-of-process -HRESULT DacVirtualUnwind(ULONG32 threadId, PCONTEXT context, PT_KNONVOLATILE_CONTEXT_POINTERS contextPointers); +HRESULT DacVirtualUnwind(ULONG32 threadId, PT_CONTEXT context, PT_KNONVOLATILE_CONTEXT_POINTERS contextPointers); #endif // FEATURE_PAL #ifdef FEATURE_MINIMETADATA_IN_TRIAGEDUMPS diff --git a/src/inc/eetwain.h b/src/inc/eetwain.h index 502d181962..55cc905576 100644 --- a/src/inc/eetwain.h +++ b/src/inc/eetwain.h @@ -602,7 +602,7 @@ HRESULT FixContextForEnC(PCONTEXT pCtx, #endif // #ifndef DACCESS_COMPILE -#ifndef _TARGET_X86_ +#ifdef WIN64EXCEPTIONS static void EnsureCallerContextIsValid( PREGDISPLAY pRD, StackwalkCacheEntry* pCacheEntry, EECodeInfo * pCodeInfo = NULL ); static size_t GetCallerSp( PREGDISPLAY pRD ); #endif diff --git a/src/inc/gcinfodecoder.h b/src/inc/gcinfodecoder.h index 6d4850ad67..5151616229 100644 --- a/src/inc/gcinfodecoder.h +++ b/src/inc/gcinfodecoder.h @@ -451,6 +451,7 @@ private: GcSlotDesc* m_pLastSlot; }; +#ifdef USE_GC_INFO_DECODER class GcInfoDecoder { public: @@ -678,6 +679,7 @@ private: } } }; +#endif // USE_GC_INFO_DECODER #endif // _GC_INFO_DECODER_ diff --git a/src/inc/jithelpers.h b/src/inc/jithelpers.h index f84db9142d..89d4be7efc 100644 --- a/src/inc/jithelpers.h +++ b/src/inc/jithelpers.h @@ -135,7 +135,8 @@ JITHELPER(CORINFO_HELP_FIELD_ACCESS_EXCEPTION,JIT_ThrowFieldAccessException, CORINFO_HELP_SIG_REG_ONLY) JITHELPER(CORINFO_HELP_CLASS_ACCESS_EXCEPTION,JIT_ThrowClassAccessException, CORINFO_HELP_SIG_REG_ONLY) -#ifdef WIN64EXCEPTIONS +// UNIXTODO: Disable JIT_EndCatch after revising the jitter not to use this (for x86/Linux) +#ifndef _TARGET_X86_ JITHELPER(CORINFO_HELP_ENDCATCH, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) #else JITHELPER(CORINFO_HELP_ENDCATCH, JIT_EndCatch, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) diff --git a/src/inc/readytorun.h b/src/inc/readytorun.h index 9204862e17..ebc557b6f1 100644 --- a/src/inc/readytorun.h +++ b/src/inc/readytorun.h @@ -279,7 +279,7 @@ enum ReadyToRunHelper READYTORUN_HELPER_DblRound = 0xE2, READYTORUN_HELPER_FltRound = 0xE3, -#ifndef _TARGET_X86_ +#ifdef WIN64EXCEPTIONS // Personality rountines READYTORUN_HELPER_PersonalityRoutine = 0xF0, READYTORUN_HELPER_PersonalityRoutineFilterFunclet = 0xF1, diff --git a/src/inc/regdisp.h b/src/inc/regdisp.h index 09a6a38f62..81143466cd 100644 --- a/src/inc/regdisp.h +++ b/src/inc/regdisp.h @@ -18,10 +18,33 @@ struct REGDISPLAY { // returned by GetContext or provided // at exception time. +#ifndef WIN64EXCEPTIONS // TODO: Unify with pCurrentContext / pCallerContext used on 64-bit PCONTEXT pContextForUnwind; // scratch context for unwinding // used to preserve context saved in the frame that // could be otherwise wiped by the unwinding +#else // !WIN64EXCEPTIONS + PT_CONTEXT pCurrentContext; // [trashed] points to current Context of stackwalk + PT_CONTEXT pCallerContext; // [trashed] points to the Context of the caller during stackwalk -- used for GC crawls + + // [trashed] points to current context pointers of stackwalk + T_KNONVOLATILE_CONTEXT_POINTERS *pCurrentContextPointers; + // [trashed] points to the context pointers of the caller during stackwalk -- used for GC crawls + T_KNONVOLATILE_CONTEXT_POINTERS *pCallerContextPointers; + + BOOL IsCallerContextValid; // TRUE if pCallerContext really contains the caller's context + BOOL IsCallerSPValid; // Don't add usage of this field. This is only temporary. + + T_CONTEXT ctxOne; // used by stackwalk + T_CONTEXT ctxTwo; // used by stackwalk + + T_KNONVOLATILE_CONTEXT_POINTERS ctxPtrsOne; // used by stackwalk + T_KNONVOLATILE_CONTEXT_POINTERS ctxPtrsTwo; // used by stackwalk + +#ifdef DEBUG_REGDISPLAY + Thread *_pThread; +#endif // DEBUG_REGDISPLAY +#endif // !WIN64EXCEPTIONS DWORD * pEdi; DWORD * pEsi; @@ -166,18 +189,6 @@ inline PCODE GetControlPC(REGDISPLAY *display) { void CheckRegDisplaySP (REGDISPLAY *pRD); #endif // DEBUG_REGDISPLAY -inline void SyncRegDisplayToCurrentContext(REGDISPLAY* pRD) -{ - LIMITED_METHOD_CONTRACT; - - pRD->SP = (INT_PTR)GetSP(pRD->pCurrentContext); - -#ifdef DEBUG_REGDISPLAY - CheckRegDisplaySP(pRD); -#endif // DEBUG_REGDISPLAY - - pRD->ControlPC = INT_PTR(GetIP(pRD->pCurrentContext)); -} // This function tells us if the given stack pointer is in one of the frames of the functions called by the given frame inline BOOL IsInCalleesFrames(REGDISPLAY *display, LPVOID stackPointer) @@ -204,20 +215,6 @@ inline TADDR GetRegdisplayStackMark(REGDISPLAY *display) #endif // _TARGET_AMD64_ } -// This needs to be implemented for platforms that have funclets. -inline LPVOID GetRegdisplayReturnValue(REGDISPLAY *display) -{ - LIMITED_METHOD_CONTRACT; - -#if defined(_TARGET_AMD64_) - return (LPVOID)display->pCurrentContext->Rax; -#elif defined(_TARGET_ARM64_) - return (LPVOID)display->pCurrentContext->X0; -#else - PORTABILITY_ASSERT("GetRegdisplayReturnValue NYI for this platform (Regdisp.h)"); - return NULL; -#endif -} #elif defined(_TARGET_ARM_) @@ -307,20 +304,7 @@ inline TADDR GetRegdisplayStackMark(REGDISPLAY *display) { return GetSP(display->pCallerContext); } -inline void SyncRegDisplayToCurrentContext(REGDISPLAY* pRD) -{ - LIMITED_METHOD_CONTRACT; - pRD->SP = (DWORD)GetSP(pRD->pCurrentContext); - pRD->ControlPC = (DWORD)GetIP(pRD->pCurrentContext); -} - -// This needs to be implemented for platforms that have funclets. -inline LPVOID GetRegdisplayReturnValue(REGDISPLAY *display) -{ - LIMITED_METHOD_CONTRACT; - return (LPVOID)display->pCurrentContext->R0; -} #else // none of the above processors @@ -359,6 +343,50 @@ inline LPVOID GetRegdisplayStackMark(REGDISPLAY *display) { #endif +#if defined(_WIN64) || defined(_TARGET_ARM_) || (defined(_TARGET_X86_) && defined(WIN64EXCEPTIONS)) +// This needs to be implemented for platforms that have funclets. +inline LPVOID GetRegdisplayReturnValue(REGDISPLAY *display) +{ + LIMITED_METHOD_CONTRACT; + +#if defined(_TARGET_AMD64_) + return (LPVOID)display->pCurrentContext->Rax; +#elif defined(_TARGET_ARM64_) + return (LPVOID)display->pCurrentContext->X0; +#elif defined(_TARGET_ARM_) + return (LPVOID)display->pCurrentContext->R0; +#elif defined(_TARGET_X86_) + return (LPVOID)display->pCurrentContext->Eax; +#else + PORTABILITY_ASSERT("GetRegdisplayReturnValue NYI for this platform (Regdisp.h)"); + return NULL; +#endif +} + +inline void SyncRegDisplayToCurrentContext(REGDISPLAY* pRD) +{ + LIMITED_METHOD_CONTRACT; + +#if defined(_WIN64) + pRD->SP = (INT_PTR)GetSP(pRD->pCurrentContext); + +#ifdef DEBUG_REGDISPLAY + CheckRegDisplaySP(pRD); +#endif // DEBUG_REGDISPLAY + + pRD->ControlPC = INT_PTR(GetIP(pRD->pCurrentContext)); +#elif defined(_TARGET_ARM_) // _WIN64 + pRD->SP = (DWORD)GetSP(pRD->pCurrentContext); + pRD->ControlPC = (DWORD)GetIP(pRD->pCurrentContext); +#elif defined(_TARGET_X86_) // _TARGET_ARM_ + pRD->Esp = (DWORD)GetSP(pRD->pCurrentContext); + pRD->ControlPC = (DWORD)GetIP(pRD->pCurrentContext); +#else // _TARGET_X86_ + PORTABILITY_ASSERT("SyncRegDisplayToCurrentContext"); +#endif // _TARGET_ARM_ || _TARGET_X86_ +} +#endif // _WIN64 || _TARGET_ARM_ || (_TARGET_X86_ && WIN64EXCEPTIONS) + typedef REGDISPLAY *PREGDISPLAY; @@ -368,6 +396,7 @@ inline void FillRegDisplay(const PREGDISPLAY pRD, PT_CONTEXT pctx, PT_CONTEXT pC SUPPORTS_DAC; +#ifndef WIN64EXCEPTIONS #ifdef _TARGET_X86_ pRD->pContext = pctx; pRD->pContextForUnwind = NULL; @@ -381,57 +410,38 @@ inline void FillRegDisplay(const PREGDISPLAY pRD, PT_CONTEXT pctx, PT_CONTEXT pC pRD->Esp = pctx->Esp; pRD->ControlPC = (PCODE)(pctx->Eip); pRD->PCTAddr = (UINT_PTR)&(pctx->Eip); -#elif defined(_WIN64) +#else // _TARGET_X86_ + PORTABILITY_ASSERT("FillRegDisplay"); +#endif // _TARGET_???_ (ELSE) + +#else // !WIN64EXCEPTIONS pRD->pContext = pctx; #ifdef _TARGET_AMD64_ for (int i = 0; i < 16; i++) { *(&pRD->ctxPtrsOne.Rax + i) = (&pctx->Rax + i); } -#elif defined(_TARGET_ARM64_) +#elif defined(_TARGET_ARM64_) // _TARGET_AMD64_ for (int i = 0; i < 12; i++) { *(&pRD->ctxPtrsOne.X19 + i) = (&pctx->X19 + i); } -#endif // _TARGET_AMD64_ - - pRD->pCurrentContextPointers = &pRD->ctxPtrsOne; - pRD->pCallerContextPointers = &pRD->ctxPtrsTwo; - - pRD->pCurrentContext = &(pRD->ctxOne); - pRD->pCallerContext = &(pRD->ctxTwo); - - // copy the active context to initialize our stackwalk - *(pRD->pCurrentContext) = *(pctx); - - // copy the caller context as well if it's specified - if (pCallerCtx == NULL) - { - pRD->IsCallerContextValid = FALSE; - pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary. - } - else - { - *(pRD->pCallerContext) = *(pCallerCtx); - pRD->IsCallerContextValid = TRUE; - pRD->IsCallerSPValid = TRUE; // Don't add usage of this field. This is only temporary. - } - -#ifdef DEBUG_REGDISPLAY - pRD->_pThread = NULL; -#endif // DEBUG_REGDISPLAY - - SyncRegDisplayToCurrentContext(pRD); -#elif defined(_TARGET_ARM_) - pRD->pContext = pctx; - +#elif defined(_TARGET_ARM_) // _TARGET_ARM64_ // Copy over the nonvolatile integer registers (R4-R11) for (int i = 0; i < 8; i++) { *(&pRD->ctxPtrsOne.R4 + i) = (&pctx->R4 + i); } - pRD->ctxPtrsOne.Lr = &pctx->Lr; + pRD->ctxPtrsOne.Lr = &pctx->Lr; +#elif defined(_TARGET_X86_) // _TARGET_ARM_ + for (int i = 0; i < 4; ++i) + { + *(&pRD->ctxPtrsOne.Ebx + i) = (&pctx->Ebx + i); + } +#else // _TARGET_X86_ + PORTABILITY_ASSERT("FillRegDisplay"); +#endif // _TARGET_???_ (ELSE) // Setup the references pRD->pCurrentContextPointers = &pRD->ctxPtrsOne; @@ -456,7 +466,9 @@ inline void FillRegDisplay(const PREGDISPLAY pRD, PT_CONTEXT pctx, PT_CONTEXT pC pRD->IsCallerSPValid = TRUE; // Don't add usage of this field. This is only temporary. } +#ifdef _TARGET_ARM_ pRD->pPC = &pRD->pCurrentContext->Pc; +#endif #ifdef DEBUG_REGDISPLAY pRD->_pThread = NULL; @@ -464,9 +476,7 @@ inline void FillRegDisplay(const PREGDISPLAY pRD, PT_CONTEXT pctx, PT_CONTEXT pC // This will setup the PC and SP SyncRegDisplayToCurrentContext(pRD); -#else - PORTABILITY_ASSERT("@NYI Platform - InitRegDisplay (Threads.cpp)"); -#endif +#endif // !WIN64EXCEPTIONS } // Initialize a new REGDISPLAY/CONTEXT pair from an existing valid REGDISPLAY. diff --git a/src/inc/switches.h b/src/inc/switches.h index f52f24bc67..bb3ca28e12 100644 --- a/src/inc/switches.h +++ b/src/inc/switches.h @@ -37,7 +37,7 @@ #define LOGGING #endif -#if !defined(_TARGET_X86_) +#if !defined(_TARGET_X86_) || defined(FEATURE_PAL) #define WIN64EXCEPTIONS #endif diff --git a/src/jit/block.h b/src/jit/block.h index 7c66b610dd..cb02afd840 100644 --- a/src/jit/block.h +++ b/src/jit/block.h @@ -821,33 +821,15 @@ struct BasicBlock : private LIR::Range // lclVar, and thus has no local #, we can't use a GenTreePhiArg. Instead, we use this struct. struct HeapPhiArg { - bool m_isSsaNum; // If true, the phi arg is an SSA # for an internal try block heap state, being - // added to the phi of a catch block. If false, it's a pred block. - union { - BasicBlock* m_predBB; // Predecessor block from which the SSA # flows. - unsigned m_ssaNum; // SSA# for internal block heap state. - }; + unsigned m_ssaNum; // SSA# for incoming value. HeapPhiArg* m_nextArg; // Next arg in the list, else NULL. unsigned GetSsaNum() { - if (m_isSsaNum) - { - return m_ssaNum; - } - else - { - assert(m_predBB != nullptr); - return m_predBB->bbHeapSsaNumOut; - } + return m_ssaNum; } - HeapPhiArg(BasicBlock* predBB, HeapPhiArg* nextArg = nullptr) - : m_isSsaNum(false), m_predBB(predBB), m_nextArg(nextArg) - { - } - HeapPhiArg(unsigned ssaNum, HeapPhiArg* nextArg = nullptr) - : m_isSsaNum(true), m_ssaNum(ssaNum), m_nextArg(nextArg) + HeapPhiArg(unsigned ssaNum, HeapPhiArg* nextArg = nullptr) : m_ssaNum(ssaNum), m_nextArg(nextArg) { } diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp index 8e0af48799..827000b920 100644 --- a/src/jit/codegenxarch.cpp +++ b/src/jit/codegenxarch.cpp @@ -4858,11 +4858,6 @@ void CodeGen::genCallInstruction(GenTreePtr node) if (arg->OperGet() != GT_ARGPLACE && !(arg->gtFlags & GTF_LATE_ARG)) { #if defined(_TARGET_X86_) - assert((arg->OperGet() == GT_PUTARG_STK) || (arg->OperGet() == GT_LONG)); - if (arg->OperGet() == GT_LONG) - { - assert((arg->gtGetOp1()->OperGet() == GT_PUTARG_STK) && (arg->gtGetOp2()->OperGet() == GT_PUTARG_STK)); - } if ((arg->OperGet() == GT_PUTARG_STK) && (arg->gtGetOp1()->OperGet() == GT_FIELD_LIST)) { fgArgTabEntryPtr curArgTabEntry = compiler->gtArgEntryByNode(call, arg); @@ -7782,9 +7777,9 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* putArgStk) GenTreePtr data = putArgStk->gtOp1; - // On a 32-bit target, all of the long arguments have been decomposed into - // a separate putarg_stk for each of the upper and lower halves. - noway_assert(targetType != TYP_LONG); + // On a 32-bit target, all of the long arguments are handled with GT_FIELD_LIST, + // and the type of the putArgStk is TYP_VOID. + assert(targetType != TYP_LONG); const unsigned argSize = putArgStk->getArgSize(); assert((argSize % TARGET_POINTER_SIZE) == 0); @@ -8381,6 +8376,14 @@ void CodeGen::genCreateAndStoreGCInfoX64(unsigned codeSize, unsigned prologSize gcInfoEncoder->SetSizeOfEditAndContinuePreservedArea(preservedAreaSize); } + if (compiler->opts.IsReversePInvoke()) + { + unsigned reversePInvokeFrameVarNumber = compiler->lvaReversePInvokeFrameVar; + assert(reversePInvokeFrameVarNumber != BAD_VAR_NUM && reversePInvokeFrameVarNumber < compiler->lvaRefCount); + LclVarDsc& reversePInvokeFrameVar = compiler->lvaTable[reversePInvokeFrameVarNumber]; + gcInfoEncoder->SetReversePInvokeFrameSlot(reversePInvokeFrameVar.lvStkOffs); + } + gcInfoEncoder->Build(); // GC Encoder automatically puts the GC info in the right spot using ICorJitInfo::allocGCInfo(size_t) diff --git a/src/jit/gtlist.h b/src/jit/gtlist.h index 92265a7359..707ae61215 100644 --- a/src/jit/gtlist.h +++ b/src/jit/gtlist.h @@ -269,7 +269,7 @@ GTNODE(EMITNOP , "emitnop" ,GenTree ,0,GTK_LEAF|GTK_NOV GTNODE(PINVOKE_PROLOG ,"pinvoke_prolog",GenTree ,0,GTK_LEAF|GTK_NOVALUE) // pinvoke prolog seq GTNODE(PINVOKE_EPILOG ,"pinvoke_epilog",GenTree ,0,GTK_LEAF|GTK_NOVALUE) // pinvoke epilog seq GTNODE(PUTARG_REG , "putarg_reg" ,GenTreeOp ,0,GTK_UNOP) // operator that places outgoing arg in register -GTNODE(PUTARG_STK , "putarg_stk" ,GenTreePutArgStk ,0,GTK_UNOP) // operator that places outgoing arg in stack +GTNODE(PUTARG_STK , "putarg_stk" ,GenTreePutArgStk ,0,GTK_UNOP|GTK_NOVALUE) // operator that places outgoing arg in stack GTNODE(RETURNTRAP , "returnTrap" ,GenTreeOp ,0,GTK_UNOP|GTK_NOVALUE) // a conditional call to wait on gc GTNODE(SWAP , "swap" ,GenTreeOp ,0,GTK_BINOP|GTK_NOVALUE) // op1 and op2 swap (registers) GTNODE(IL_OFFSET , "il_offset" ,GenTreeStmt ,0,GTK_LEAF|GTK_NOVALUE) // marks an IL offset for debugging purposes diff --git a/src/jit/lir.cpp b/src/jit/lir.cpp index 35dd1815ef..6eb8a49aca 100644 --- a/src/jit/lir.cpp +++ b/src/jit/lir.cpp @@ -1494,9 +1494,13 @@ bool LIR::Range::CheckLIR(Compiler* compiler, bool checkUnusedValues) const } else if (!def->IsValue()) { - // Calls may contain "uses" of nodes that do not produce a value. This is an artifact of - // the HIR and should probably be fixed, but doing so is an unknown amount of work. - assert(node->OperGet() == GT_CALL); + // Stack arguments do not produce a value, but they are considered children of the call. + // It may be useful to remove these from being call operands, but that may also impact + // other code that relies on being able to reach all the operands from a call node. + // The GT_NOP case is because sometimes we eliminate stack argument stores as dead, but + // instead of removing them we replace with a NOP. + assert((node->OperGet() == GT_CALL) && + (def->OperIsStore() || (def->OperGet() == GT_PUTARG_STK) || (def->OperGet() == GT_NOP))); continue; } diff --git a/src/jit/liveness.cpp b/src/jit/liveness.cpp index 3a2fe3e650..60ef1a1bdb 100644 --- a/src/jit/liveness.cpp +++ b/src/jit/liveness.cpp @@ -1067,7 +1067,6 @@ class LiveVarAnalysis { Compiler* m_compiler; - bool m_changed; bool m_hasPossibleBackEdge; bool m_heapLiveIn; @@ -1077,7 +1076,6 @@ class LiveVarAnalysis LiveVarAnalysis(Compiler* compiler) : m_compiler(compiler) - , m_changed(false) , m_hasPossibleBackEdge(false) , m_heapLiveIn(false) , m_heapLiveOut(false) @@ -1086,7 +1084,7 @@ class LiveVarAnalysis { } - void PerBlockAnalysis(BasicBlock* block, bool updateInternalOnly, bool keepAliveThis) + bool PerBlockAnalysis(BasicBlock* block, bool updateInternalOnly, bool keepAliveThis) { /* Compute the 'liveOut' set */ VarSetOps::ClearD(m_compiler, m_liveOut); @@ -1148,8 +1146,8 @@ class LiveVarAnalysis /* Has there been any change in either live set? */ - if (!VarSetOps::Equal(m_compiler, block->bbLiveIn, m_liveIn) || - !VarSetOps::Equal(m_compiler, block->bbLiveOut, m_liveOut)) + bool liveInChanged = !VarSetOps::Equal(m_compiler, block->bbLiveIn, m_liveIn); + if (liveInChanged || !VarSetOps::Equal(m_compiler, block->bbLiveOut, m_liveOut)) { if (updateInternalOnly) { @@ -1157,8 +1155,10 @@ class LiveVarAnalysis noway_assert(block->bbFlags & BBF_INTERNAL); - if (!VarSetOps::Equal(m_compiler, VarSetOps::Intersection(m_compiler, block->bbLiveIn, m_liveIn), - m_liveIn) || + liveInChanged = + !VarSetOps::Equal(m_compiler, VarSetOps::Intersection(m_compiler, block->bbLiveIn, m_liveIn), + m_liveIn); + if (liveInChanged || !VarSetOps::Equal(m_compiler, VarSetOps::Intersection(m_compiler, block->bbLiveOut, m_liveOut), m_liveOut)) { @@ -1175,23 +1175,23 @@ class LiveVarAnalysis VarSetOps::UnionD(m_compiler, block->bbLiveIn, m_liveIn); VarSetOps::UnionD(m_compiler, block->bbLiveOut, m_liveOut); - m_changed = true; } } else { VarSetOps::Assign(m_compiler, block->bbLiveIn, m_liveIn); VarSetOps::Assign(m_compiler, block->bbLiveOut, m_liveOut); - m_changed = true; } } - if ((block->bbHeapLiveIn == 1) != m_heapLiveIn || (block->bbHeapLiveOut == 1) != m_heapLiveOut) + const bool heapLiveInChanged = (block->bbHeapLiveIn == 1) != m_heapLiveIn; + if (heapLiveInChanged || (block->bbHeapLiveOut == 1) != m_heapLiveOut) { block->bbHeapLiveIn = m_heapLiveIn; block->bbHeapLiveOut = m_heapLiveOut; - m_changed = true; } + + return liveInChanged || heapLiveInChanged; } void Run(bool updateInternalOnly) @@ -1200,9 +1200,10 @@ class LiveVarAnalysis m_compiler->lvaKeepAliveAndReportThis() && m_compiler->lvaTable[m_compiler->info.compThisArg].lvTracked; /* Live Variable Analysis - Backward dataflow */ + bool changed; do { - m_changed = false; + changed = false; /* Visit all blocks and compute new data flow values */ @@ -1234,7 +1235,10 @@ class LiveVarAnalysis } } - PerBlockAnalysis(block, updateInternalOnly, keepAliveThis); + if (PerBlockAnalysis(block, updateInternalOnly, keepAliveThis)) + { + changed = true; + } } // if there is no way we could have processed a block without seeing all of its predecessors // then there is no need to iterate @@ -1242,7 +1246,7 @@ class LiveVarAnalysis { break; } - } while (m_changed); + } while (changed); } public: diff --git a/src/jit/lower.cpp b/src/jit/lower.cpp index a6e50b304c..d1ecf7cea2 100644 --- a/src/jit/lower.cpp +++ b/src/jit/lower.cpp @@ -757,16 +757,6 @@ GenTreePtr Lowering::NewPutArg(GenTreeCall* call, GenTreePtr arg, fgArgTabEntryP GenTreePtr putArg = nullptr; bool updateArgTable = true; -#if !defined(_TARGET_64BIT_) - if (varTypeIsLong(type)) - { - // For TYP_LONG, we leave the GT_LONG as the arg, and put the putArg below it. - // Therefore, we don't update the arg table entry. - updateArgTable = false; - type = TYP_INT; - } -#endif // !defined(_TARGET_64BIT_) - bool isOnStack = true; #ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING if (varTypeIsStruct(type)) @@ -1084,25 +1074,22 @@ void Lowering::LowerArg(GenTreeCall* call, GenTreePtr* ppArg) NYI("Lowering of long register argument"); } - // For longs, we will create two PUTARG_STKs below the GT_LONG. The hi argument needs to - // be pushed first, so the hi PUTARG_STK will precede the lo PUTARG_STK in execution order. + // For longs, we will replace the GT_LONG with a GT_FIELD_LIST, and put that under a PUTARG_STK. + // Although the hi argument needs to be pushed first, that will be handled by the general case, + // in which the fields will be reversed. noway_assert(arg->OperGet() == GT_LONG); - GenTreePtr argLo = arg->gtGetOp1(); - GenTreePtr argHi = arg->gtGetOp2(); - - GenTreePtr putArgLo = NewPutArg(call, argLo, info, type); - GenTreePtr putArgHi = NewPutArg(call, argHi, info, type); - - arg->gtOp.gtOp1 = putArgLo; - arg->gtOp.gtOp2 = putArgHi; - - BlockRange().InsertBefore(arg, putArgHi, putArgLo); - - // The execution order now looks like this: - // argLoPrev <-> argLoFirst ... argLo <-> argHiFirst ... argHi <-> putArgHi <-> putArgLo <-> arg(GT_LONG) - - assert((arg->gtFlags & GTF_REVERSE_OPS) == 0); - arg->gtFlags |= GTF_REVERSE_OPS; // We consume the high arg (op2) first. + assert(info->numSlots == 2); + GenTreePtr argLo = arg->gtGetOp1(); + GenTreePtr argHi = arg->gtGetOp2(); + GenTreeFieldList* fieldList = new (comp, GT_FIELD_LIST) GenTreeFieldList(argLo, 0, TYP_INT, nullptr); + // Only the first fieldList node (GTF_FIELD_LIST_HEAD) is in the instruction sequence. + (void)new (comp, GT_FIELD_LIST) GenTreeFieldList(argHi, 4, TYP_INT, fieldList); + putArg = NewPutArg(call, fieldList, info, TYP_VOID); + + // We can't call ReplaceArgWithPutArgOrCopy here because it presumes that we are keeping the original arg. + BlockRange().InsertBefore(arg, fieldList, putArg); + BlockRange().Remove(arg); + *ppArg = putArg; } else #endif // !defined(_TARGET_64BIT_) diff --git a/src/jit/lowerxarch.cpp b/src/jit/lowerxarch.cpp index bf5d29c596..50ddf69f55 100644 --- a/src/jit/lowerxarch.cpp +++ b/src/jit/lowerxarch.cpp @@ -1024,7 +1024,7 @@ void Lowering::TreeNodeInfoInitSimple(GenTree* tree) { TreeNodeInfo* info = &(tree->gtLsraInfo); unsigned kind = tree->OperKind(); - info->dstCount = (tree->TypeGet() == TYP_VOID) ? 0 : 1; + info->dstCount = tree->IsValue() ? 1 : 0; if (kind & (GTK_CONST | GTK_LEAF)) { info->srcCount = 0; @@ -1589,53 +1589,38 @@ void Lowering::TreeNodeInfoInitCall(GenTreeCall* call) if (!(args->gtFlags & GTF_LATE_ARG)) { TreeNodeInfo* argInfo = &(arg->gtLsraInfo); -#if !defined(_TARGET_64BIT_) - if (arg->TypeGet() == TYP_LONG) + if (argInfo->dstCount != 0) { - assert(arg->OperGet() == GT_LONG); - GenTreePtr loArg = arg->gtGetOp1(); - GenTreePtr hiArg = arg->gtGetOp2(); - assert((loArg->OperGet() == GT_PUTARG_STK) && (hiArg->OperGet() == GT_PUTARG_STK)); - assert((loArg->gtLsraInfo.dstCount == 1) && (hiArg->gtLsraInfo.dstCount == 1)); - loArg->gtLsraInfo.isLocalDefUse = true; - hiArg->gtLsraInfo.isLocalDefUse = true; + argInfo->isLocalDefUse = true; } - else -#endif // !defined(_TARGET_64BIT_) - { - if (argInfo->dstCount != 0) - { - argInfo->isLocalDefUse = true; - } - // If the child of GT_PUTARG_STK is a constant, we don't need a register to - // move it to memory (stack location). - // - // On AMD64, we don't want to make 0 contained, because we can generate smaller code - // by zeroing a register and then storing it. E.g.: - // xor rdx, rdx - // mov gword ptr [rsp+28H], rdx - // is 2 bytes smaller than: - // mov gword ptr [rsp+28H], 0 - // - // On x86, we push stack arguments; we don't use 'mov'. So: - // push 0 - // is 1 byte smaller than: - // xor rdx, rdx - // push rdx - - argInfo->dstCount = 0; - if (arg->gtOper == GT_PUTARG_STK) - { - GenTree* op1 = arg->gtOp.gtOp1; - if (IsContainableImmed(arg, op1) + // If the child of GT_PUTARG_STK is a constant, we don't need a register to + // move it to memory (stack location). + // + // On AMD64, we don't want to make 0 contained, because we can generate smaller code + // by zeroing a register and then storing it. E.g.: + // xor rdx, rdx + // mov gword ptr [rsp+28H], rdx + // is 2 bytes smaller than: + // mov gword ptr [rsp+28H], 0 + // + // On x86, we push stack arguments; we don't use 'mov'. So: + // push 0 + // is 1 byte smaller than: + // xor rdx, rdx + // push rdx + + argInfo->dstCount = 0; + if (arg->gtOper == GT_PUTARG_STK) + { + GenTree* op1 = arg->gtOp.gtOp1; + if (IsContainableImmed(arg, op1) #if defined(_TARGET_AMD64_) - && !op1->IsIntegralConst(0) + && !op1->IsIntegralConst(0) #endif // _TARGET_AMD64_ - ) - { - MakeSrcContained(arg, op1); - } + ) + { + MakeSrcContained(arg, op1); } } } diff --git a/src/jit/rationalize.cpp b/src/jit/rationalize.cpp index 7c635cad34..c648ab2677 100644 --- a/src/jit/rationalize.cpp +++ b/src/jit/rationalize.cpp @@ -7,6 +7,7 @@ #pragma hdrstop #endif +#ifndef LEGACY_BACKEND // state carried over the tree walk, to be used in making // a splitting decision. struct SplitData @@ -1054,3 +1055,4 @@ void Rationalizer::DoPhase() comp->compRationalIRForm = true; } +#endif // LEGACY_BACKEND diff --git a/src/jit/ssabuilder.cpp b/src/jit/ssabuilder.cpp index f0ee461c45..5d553c1344 100644 --- a/src/jit/ssabuilder.cpp +++ b/src/jit/ssabuilder.cpp @@ -1333,17 +1333,18 @@ void SsaBuilder::AssignPhiNodeRhsVariables(BasicBlock* block, SsaRenameState* pR { if (succ->bbHeapSsaPhiFunc == BasicBlock::EmptyHeapPhiDef) { - succ->bbHeapSsaPhiFunc = new (m_pCompiler) BasicBlock::HeapPhiArg(block); + succ->bbHeapSsaPhiFunc = new (m_pCompiler) BasicBlock::HeapPhiArg(block->bbHeapSsaNumOut); } else { BasicBlock::HeapPhiArg* curArg = succ->bbHeapSsaPhiFunc; + unsigned ssaNum = block->bbHeapSsaNumOut; bool found = false; // This is a quadratic algorithm. We might need to consider some switch over to a hash table // representation for the arguments of a phi node, to make this linear. while (curArg != nullptr) { - if (curArg->m_predBB == block) + if (curArg->m_ssaNum == ssaNum) { found = true; break; @@ -1352,7 +1353,7 @@ void SsaBuilder::AssignPhiNodeRhsVariables(BasicBlock* block, SsaRenameState* pR } if (!found) { - succ->bbHeapSsaPhiFunc = new (m_pCompiler) BasicBlock::HeapPhiArg(block, succ->bbHeapSsaPhiFunc); + succ->bbHeapSsaPhiFunc = new (m_pCompiler) BasicBlock::HeapPhiArg(ssaNum, succ->bbHeapSsaPhiFunc); } } DBG_SSA_JITDUMP(" Added phi arg for Heap from BB%02u in BB%02u.\n", block->bbNum, succ->bbNum); @@ -1466,20 +1467,18 @@ void SsaBuilder::AssignPhiNodeRhsVariables(BasicBlock* block, SsaRenameState* pR { if (handlerStart->bbHeapSsaPhiFunc == BasicBlock::EmptyHeapPhiDef) { - handlerStart->bbHeapSsaPhiFunc = new (m_pCompiler) BasicBlock::HeapPhiArg(block); + handlerStart->bbHeapSsaPhiFunc = + new (m_pCompiler) BasicBlock::HeapPhiArg(block->bbHeapSsaNumOut); } else { -#ifdef DEBUG - BasicBlock::HeapPhiArg* curArg = handlerStart->bbHeapSsaPhiFunc; - while (curArg != nullptr) - { - assert(curArg->m_predBB != block); - curArg = curArg->m_nextArg; - } -#endif // DEBUG - handlerStart->bbHeapSsaPhiFunc = - new (m_pCompiler) BasicBlock::HeapPhiArg(block, handlerStart->bbHeapSsaPhiFunc); + // This path has a potential to introduce redundant phi args, due to multiple + // preds of the same try-begin block having the same live-out heap def, and/or + // due to nested try-begins each having preds with the same live-out heap def. + // Avoid doing quadratic processing on handler phis, and instead live with the + // occasional redundancy. + handlerStart->bbHeapSsaPhiFunc = new (m_pCompiler) + BasicBlock::HeapPhiArg(block->bbHeapSsaNumOut, handlerStart->bbHeapSsaPhiFunc); } DBG_SSA_JITDUMP(" Added phi arg for Heap from BB%02u in BB%02u.\n", block->bbNum, handlerStart->bbNum); diff --git a/src/jit/target.h b/src/jit/target.h index 8b448a2b7f..32eb16698c 100644 --- a/src/jit/target.h +++ b/src/jit/target.h @@ -13,6 +13,13 @@ #endif #endif +// If the UNIX_X86_ABI is defined make sure that _TARGET_X86_ is also defined. +#if defined(UNIX_X86_ABI) +#if !defined(_TARGET_X86_) +#error When UNIX_X86_ABI is defined you must define _TARGET_X86_ defined as well. +#endif +#endif + #if (defined(FEATURE_CORECLR) && defined(PLATFORM_UNIX)) #define FEATURE_VARARG 0 #else // !(defined(FEATURE_CORECLR) && defined(PLATFORM_UNIX)) diff --git a/src/mscorlib/model.xml b/src/mscorlib/model.xml index 437d5d6fe4..75846ae612 100644 --- a/src/mscorlib/model.xml +++ b/src/mscorlib/model.xml @@ -683,6 +683,9 @@ <Member Name="GetHashCode(T)" /> <Member MemberType="Property" Name="Default" /> </Type> + <Type Name="System.Collections.Generic.EnumEqualityComparer<T>"> + <Member Name="#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)" /> + </Type> <Type Name="System.Collections.Generic.ICollection<T>"> <Member Name="Add(T)" /> <Member Name="Clear" /> @@ -7408,7 +7411,9 @@ <Member Name="Trim" /> <Member Name="Trim(System.Char[])" /> <Member Name="TrimEnd(System.Char[])" /> + <Member Name="TrimEnd" /> <Member Name="TrimStart(System.Char[])" /> + <Member Name="TrimStart" /> <Member MemberType="Property" Name="Chars(System.Int32)" /> <Member MemberType="Property" Name="Length" /> <Member Status="ImplRoot" Name="System.Collections.IEnumerable.GetEnumerator" /> diff --git a/src/mscorlib/ref/mscorlib.cs b/src/mscorlib/ref/mscorlib.cs index d5a5e96909..3a8ca2dc65 100644 --- a/src/mscorlib/ref/mscorlib.cs +++ b/src/mscorlib/ref/mscorlib.cs @@ -3309,7 +3309,9 @@ namespace System public System.String Trim() { throw null; } public System.String Trim(params char[] trimChars) { throw null; } public System.String TrimEnd(params char[] trimChars) { throw null; } + public System.String TrimEnd() { throw null; } public System.String TrimStart(params char[] trimChars) { throw null; } + public System.String TrimStart() { throw null; } } [System.Runtime.InteropServices.ComVisibleAttribute(true)] public abstract partial class StringComparer : System.Collections.Generic.IComparer<string>, System.Collections.Generic.IEqualityComparer<string>, System.Collections.IComparer, System.Collections.IEqualityComparer diff --git a/src/mscorlib/src/System/String.Manipulation.cs b/src/mscorlib/src/System/String.Manipulation.cs index 194b4f8c59..51007ba983 100644 --- a/src/mscorlib/src/System/String.Manipulation.cs +++ b/src/mscorlib/src/System/String.Manipulation.cs @@ -1553,8 +1553,11 @@ namespace System } return TrimHelper(trimChars,TrimHead); } - - + + // Removes a set of characters from the beginning of this string. + public String TrimStart() => TrimHelper(TrimHead); + + // Removes a set of characters from the end of this string. public String TrimEnd(params char[] trimChars) { if (null==trimChars || trimChars.Length == 0) { @@ -1562,6 +1565,10 @@ namespace System } return TrimHelper(trimChars,TrimTail); } + + // Removes a set of characters from the end of this string. + public String TrimEnd()=> TrimHelper(TrimTail); + // Trims the whitespace from both ends of the string. Whitespace is defined by // Char.IsWhiteSpace. diff --git a/src/mscorlib/src/System/Threading/CancellationTokenSource.cs b/src/mscorlib/src/System/Threading/CancellationTokenSource.cs index fe9e0dec76..2caa4f265a 100644 --- a/src/mscorlib/src/System/Threading/CancellationTokenSource.cs +++ b/src/mscorlib/src/System/Threading/CancellationTokenSource.cs @@ -864,12 +864,19 @@ namespace System.Threading /// <param name="token2">The second <see cref="T:System.Threading.CancellationToken">CancellationToken</see> to observe.</param> /// <returns>A <see cref="T:System.Threading.CancellationTokenSource">CancellationTokenSource</see> that is linked /// to the source tokens.</returns> - public static CancellationTokenSource CreateLinkedTokenSource(CancellationToken token1, CancellationToken token2) - { - return token1.CanBeCanceled || token2.CanBeCanceled ? - new LinkedCancellationTokenSource(token1, token2) : - new CancellationTokenSource(); - } + public static CancellationTokenSource CreateLinkedTokenSource(CancellationToken token1, CancellationToken token2) => + !token1.CanBeCanceled ? CreateLinkedTokenSource(token2) : + token2.CanBeCanceled ? new Linked2CancellationTokenSource(token1, token2) : + (CancellationTokenSource)new Linked1CancellationTokenSource(token1); + + /// <summary> + /// Creates a <see cref="CancellationTokenSource"/> that will be in the canceled state + /// when any of the source tokens are in the canceled state. + /// </summary> + /// <param name="token">The first <see cref="T:System.Threading.CancellationToken">CancellationToken</see> to observe.</param> + /// <returns>A <see cref="CancellationTokenSource"/> that is linked to the source tokens.</returns> + internal static CancellationTokenSource CreateLinkedTokenSource(CancellationToken token) => + token.CanBeCanceled ? new Linked1CancellationTokenSource(token) : new CancellationTokenSource(); /// <summary> /// Creates a <see cref="T:System.Threading.CancellationTokenSource">CancellationTokenSource</see> that will be in the canceled state @@ -884,14 +891,19 @@ namespace System.Threading if (tokens == null) throw new ArgumentNullException(nameof(tokens)); - if (tokens.Length == 0) - throw new ArgumentException(Environment.GetResourceString("CancellationToken_CreateLinkedToken_TokensIsEmpty")); - - // a defensive copy is not required as the array has value-items that have only a single IntPtr field, - // hence each item cannot be null itself, and reads of the payloads cannot be torn. - Contract.EndContractBlock(); - - return new LinkedCancellationTokenSource(tokens); + switch (tokens.Length) + { + case 0: + throw new ArgumentException(Environment.GetResourceString("CancellationToken_CreateLinkedToken_TokensIsEmpty")); + case 1: + return CreateLinkedTokenSource(tokens[0]); + case 2: + return CreateLinkedTokenSource(tokens[0], tokens[1]); + default: + // a defensive copy is not required as the array has value-items that have only a single reference field, + // hence each item cannot be null itself, and reads of the payloads cannot be torn. + return new LinkedNCancellationTokenSource(tokens); + } } @@ -907,35 +919,50 @@ namespace System.Threading } } - private sealed class LinkedCancellationTokenSource : CancellationTokenSource + private sealed class Linked1CancellationTokenSource : CancellationTokenSource { - private static readonly Action<object> s_linkedTokenCancelDelegate = - s => ((CancellationTokenSource)s).NotifyCancellation(throwOnFirstException: false); // skip ThrowIfDisposed() check in Cancel() - private CancellationTokenRegistration[] m_linkingRegistrations; + private readonly CancellationTokenRegistration _reg1; - internal LinkedCancellationTokenSource(CancellationToken token1, CancellationToken token2) + internal Linked1CancellationTokenSource(CancellationToken token1) { - bool token2CanBeCanceled = token2.CanBeCanceled; + _reg1 = token1.InternalRegisterWithoutEC(LinkedNCancellationTokenSource.s_linkedTokenCancelDelegate, this); + } - if (token1.CanBeCanceled) - { - m_linkingRegistrations = new CancellationTokenRegistration[token2CanBeCanceled ? 2 : 1]; // there will be at least 1 and at most 2 linkings - m_linkingRegistrations[0] = token1.InternalRegisterWithoutEC(s_linkedTokenCancelDelegate, this); - } + protected override void Dispose(bool disposing) + { + if (!disposing || m_disposed) return; + _reg1.Dispose(); + base.Dispose(disposing); + } + } - if (token2CanBeCanceled) - { - int index = 1; - if (m_linkingRegistrations == null) - { - m_linkingRegistrations = new CancellationTokenRegistration[1]; // this will be the only linking - index = 0; - } - m_linkingRegistrations[index] = token2.InternalRegisterWithoutEC(s_linkedTokenCancelDelegate, this); - } + private sealed class Linked2CancellationTokenSource : CancellationTokenSource + { + private readonly CancellationTokenRegistration _reg1; + private readonly CancellationTokenRegistration _reg2; + + internal Linked2CancellationTokenSource(CancellationToken token1, CancellationToken token2) + { + _reg1 = token1.InternalRegisterWithoutEC(LinkedNCancellationTokenSource.s_linkedTokenCancelDelegate, this); + _reg2 = token2.InternalRegisterWithoutEC(LinkedNCancellationTokenSource.s_linkedTokenCancelDelegate, this); } - internal LinkedCancellationTokenSource(params CancellationToken[] tokens) + protected override void Dispose(bool disposing) + { + if (!disposing || m_disposed) return; + _reg1.Dispose(); + _reg2.Dispose(); + base.Dispose(disposing); + } + } + + private sealed class LinkedNCancellationTokenSource : CancellationTokenSource + { + internal static readonly Action<object> s_linkedTokenCancelDelegate = + s => ((CancellationTokenSource)s).NotifyCancellation(throwOnFirstException: false); // skip ThrowIfDisposed() check in Cancel() + private CancellationTokenRegistration[] m_linkingRegistrations; + + internal LinkedNCancellationTokenSource(params CancellationToken[] tokens) { m_linkingRegistrations = new CancellationTokenRegistration[tokens.Length]; @@ -968,7 +995,6 @@ namespace System.Threading base.Dispose(disposing); } - } } diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h index 51ac5b9a5d..a449ba78dd 100644 --- a/src/pal/inc/pal.h +++ b/src/pal/inc/pal.h @@ -6496,8 +6496,8 @@ public: typedef BOOL (PALAPI *PHARDWARE_EXCEPTION_HANDLER)(PAL_SEHException* ex); typedef BOOL (PALAPI *PHARDWARE_EXCEPTION_SAFETY_CHECK_FUNCTION)(PCONTEXT contextRecord, PEXCEPTION_RECORD exceptionRecord); -typedef VOID (PALAPI *PTERMINATION_REQUEST_HANDLER)(); -typedef DWORD (PALAPI *PGET_GCMARKER_EXCEPTION_CODE)(LPVOID ip); +typedef VOID (*PTERMINATION_REQUEST_HANDLER)(); +typedef DWORD (*PGET_GCMARKER_EXCEPTION_CODE)(LPVOID ip); PALIMPORT VOID diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt index 9fdddd6c26..4a64fcf10b 100644 --- a/src/vm/CMakeLists.txt +++ b/src/vm/CMakeLists.txt @@ -432,6 +432,8 @@ elseif(CLR_CMAKE_TARGET_ARCH_I386) set(VM_SOURCES_WKS_ARCH ${ARCH_SOURCES_DIR}/jitinterfacex86.cpp ${ARCH_SOURCES_DIR}/profiler.cpp + exceptionhandling.cpp + gcinfodecoder.cpp ) elseif(CLR_CMAKE_TARGET_ARCH_ARM) set(VM_SOURCES_DAC_AND_WKS_ARCH diff --git a/src/vm/codeman.cpp b/src/vm/codeman.cpp index cdb7cc89aa..c615d668cb 100644 --- a/src/vm/codeman.cpp +++ b/src/vm/codeman.cpp @@ -3020,7 +3020,7 @@ void * EEJitManager::allocCodeFragmentBlock(size_t blockSize, unsigned alignment { CrstHolder ch(&m_CodeHeapCritSec); - mem = (TADDR) allocCodeRaw(&requestInfo, sizeof(TADDR), blockSize, alignment, &pCodeHeap); + mem = (TADDR) allocCodeRaw(&requestInfo, sizeof(CodeHeader), blockSize, alignment, &pCodeHeap); // CodeHeader comes immediately before the block CodeHeader * pCodeHdr = (CodeHeader *) (mem - sizeof(CodeHeader)); diff --git a/src/vm/codeman.h b/src/vm/codeman.h index 0fe261a92f..5fb8da1e47 100644 --- a/src/vm/codeman.h +++ b/src/vm/codeman.h @@ -69,6 +69,10 @@ Abstract: #include "pedecoder.h" #include "gcinfo.h" +#if defined(WIN64EXCEPTIONS) && !defined(USE_INDIRECT_CODEHEADER) +#error "WIN64EXCEPTIONS requires USE_INDIRECT_CODEHEADER" +#endif // WIN64EXCEPTIONS && !USE_INDIRECT_CODEHEADER + class MethodDesc; class ICorJitCompiler; class IJitManager; diff --git a/src/vm/eetwain.cpp b/src/vm/eetwain.cpp index 2ce7b59578..16b9de457f 100644 --- a/src/vm/eetwain.cpp +++ b/src/vm/eetwain.cpp @@ -3048,7 +3048,7 @@ unsigned SKIP_ALLOC_FRAME(int size, PTR_CBYTE base, unsigned offset) #endif // !USE_GC_INFO_DECODER -#if !defined(_TARGET_X86_) && !defined(CROSSGEN_COMPILE) +#if defined(WIN64EXCEPTIONS) && !defined(CROSSGEN_COMPILE) void EECodeManager::EnsureCallerContextIsValid( PREGDISPLAY pRD, StackwalkCacheEntry* pCacheEntry, EECodeInfo * pCodeInfo /*= NULL*/ ) { @@ -3105,7 +3105,7 @@ size_t EECodeManager::GetCallerSp( PREGDISPLAY pRD ) return (size_t) (GetSP(pRD->pCallerContext)); } -#endif // !defined(_TARGET_X86_) && !defined(CROSSGEN_COMPILE) +#endif // WIN64EXCEPTIONS && !CROSSGEN_COMPILE /* * Light unwind the current stack frame, using provided cache entry. @@ -5360,6 +5360,7 @@ PTR_VOID EECodeManager::GetExactGenericsToken(SIZE_T baseStackSlot, { LIMITED_METHOD_DAC_CONTRACT; +#ifdef USE_GC_INFO_DECODER GCInfoToken gcInfoToken = pCodeInfo->GetGCInfoToken(); GcInfoDecoder gcInfoDecoder( @@ -5409,6 +5410,10 @@ PTR_VOID EECodeManager::GetExactGenericsToken(SIZE_T baseStackSlot, return PTR_VOID(taExactGenericsToken); } return NULL; +#else // USE_GC_INFO_DECODER + PORTABILITY_ASSERT("EECodeManager::GetExactGenericsToken"); + return NULL; +#endif // USE_GC_INFO_DECODER } diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp index 1d24237c02..cd154c0618 100644 --- a/src/vm/excep.cpp +++ b/src/vm/excep.cpp @@ -7264,11 +7264,13 @@ IsDebuggerFault(EXCEPTION_RECORD *pExceptionRecord, #ifdef WIN64EXCEPTIONS +#ifndef _TARGET_X86_ EXTERN_C void JIT_MemSet_End(); EXTERN_C void JIT_MemCpy_End(); EXTERN_C void JIT_WriteBarrier_End(); EXTERN_C void JIT_CheckedWriteBarrier_End(); +#endif // _TARGET_X86_ #if defined(_TARGET_AMD64_) && defined(_DEBUG) EXTERN_C void JIT_WriteBarrier_Debug(); @@ -7288,11 +7290,13 @@ bool IsIPInMarkedJitHelper(UINT_PTR uControlPc) #define CHECK_RANGE(name) \ if (GetEEFuncEntryPoint(name) <= uControlPc && uControlPc < GetEEFuncEntryPoint(name##_End)) return true; +#ifndef _TARGET_X86_ CHECK_RANGE(JIT_MemSet) CHECK_RANGE(JIT_MemCpy) CHECK_RANGE(JIT_WriteBarrier) CHECK_RANGE(JIT_CheckedWriteBarrier) +#endif // _TARGET_X86_ #if defined(_TARGET_AMD64_) && defined(_DEBUG) CHECK_RANGE(JIT_WriteBarrier_Debug) @@ -7314,8 +7318,7 @@ AdjustContextForWriteBarrier( { WRAPPER_NO_CONTRACT; -#ifdef _TARGET_X86_ - +#if defined(_TARGET_X86_) && !defined(PLATFORM_UNIX) void* f_IP = (void *)GetIP(pContext); if (((f_IP >= (void *) JIT_WriteBarrierStart) && (f_IP <= (void *) JIT_WriteBarrierLast)) || @@ -7329,11 +7332,8 @@ AdjustContextForWriteBarrier( // put ESP back to what it was before the call. SetSP(pContext, PCODE((BYTE*)GetSP(pContext) + sizeof(void*))); } - return FALSE; - -#elif defined(WIN64EXCEPTIONS) - +#elif defined(WIN64EXCEPTIONS) // _TARGET_X86_ && !PLATFORM_UNIX void* f_IP = dac_cast<PTR_VOID>(GetIP(pContext)); CONTEXT tempContext; @@ -7377,7 +7377,7 @@ AdjustContextForWriteBarrier( // Now we save the address back into the context so that it gets used // as the faulting address. SetIP(pContext, ControlPCPostAdjustment); -#endif // _TARGET_ARM_ +#endif // _TARGET_ARM_ || _TARGET_ARM64_ // Unwind the frame chain - On Win64, this is required since we may handle the managed fault and to do so, // we will replace the exception context with the managed context and "continue execution" there. Thus, we do not @@ -7399,13 +7399,10 @@ AdjustContextForWriteBarrier( } return FALSE; - -#else // ! _X86_ && !WIN64EXCEPTIONS - - PORTABILITY_WARNING("AdjustContextForWriteBarrier() not implemented on this platform"); +#else // WIN64EXCEPTIONS + PORTABILITY_ASSERT("AdjustContextForWriteBarrier"); return FALSE; - -#endif +#endif // ELSE } struct SavedExceptionInfo @@ -7556,7 +7553,8 @@ void InitSavedExceptionInfo() void FaultingExceptionFrame::Init(CONTEXT *pContext) { WRAPPER_NO_CONTRACT; -#if defined(_TARGET_X86_) +#ifndef WIN64EXCEPTIONS +#ifdef _TARGET_X86_ CalleeSavedRegisters *pRegs = GetCalleeSavedRegisters(); pRegs->ebp = pContext->Ebp; pRegs->ebx = pContext->Ebx; @@ -7564,12 +7562,13 @@ void FaultingExceptionFrame::Init(CONTEXT *pContext) pRegs->edi = pContext->Edi; m_ReturnAddress = ::GetIP(pContext); m_Esp = (DWORD)GetSP(pContext); -#elif defined(WIN64EXCEPTIONS) +#else // _TARGET_X86_ + PORTABILITY_ASSERT("FaultingExceptionFrame::Init"); +#endif // _TARGET_???_ (ELSE) +#else // !WIN64EXCEPTIONS m_ReturnAddress = ::GetIP(pContext); CopyOSContext(&m_ctx, pContext); -#else - PORTABILITY_ASSERT("FaultingExceptionFrame::InitAndLink"); -#endif +#endif // !WIN64EXCEPTIONS } // @@ -13113,9 +13112,9 @@ StackWalkAction TAResetStateCallback(CrawlFrame* pCf, void* data) // there is no more managed code on the stack. // // Note: This function should be invoked ONLY during unwind. -#if defined(_TARGET_X86_) +#ifndef WIN64EXCEPTIONS void ResetThreadAbortState(PTR_Thread pThread, void *pEstablisherFrame) -#elif defined(WIN64EXCEPTIONS) +#else void ResetThreadAbortState(PTR_Thread pThread, CrawlFrame *pCf, StackFrame sfCurrentStackFrame) #endif { @@ -13125,9 +13124,9 @@ void ResetThreadAbortState(PTR_Thread pThread, CrawlFrame *pCf, StackFrame sfCur GC_NOTRIGGER; MODE_ANY; PRECONDITION(pThread != NULL); -#if defined(_TARGET_X86_) +#ifndef WIN64EXCEPTIONS PRECONDITION(pEstablisherFrame != NULL); -#elif defined(WIN64EXCEPTIONS) +#else PRECONDITION(pCf != NULL); PRECONDITION(!sfCurrentStackFrame.IsNull()); #endif @@ -13138,14 +13137,14 @@ void ResetThreadAbortState(PTR_Thread pThread, CrawlFrame *pCf, StackFrame sfCur if (pThread->IsAbortRequested()) { -#if defined(_TARGET_X86_) +#ifndef WIN64EXCEPTIONS if (GetNextCOMPlusSEHRecord(static_cast<EXCEPTION_REGISTRATION_RECORD *>(pEstablisherFrame)) == EXCEPTION_CHAIN_END) { // Topmost handler and abort requested. fResetThreadAbortState = TRUE; LOG((LF_EH, LL_INFO100, "ResetThreadAbortState: Topmost handler resets abort as no more managed code beyond %p.\n", pEstablisherFrame)); } -#elif defined(WIN64EXCEPTIONS) +#else // !WIN64EXCEPTIONS // Get the active exception tracker PTR_ExceptionTracker pCurEHTracker = pThread->GetExceptionState()->GetCurrentExceptionTracker(); _ASSERTE(pCurEHTracker != NULL); @@ -13200,9 +13199,7 @@ void ResetThreadAbortState(PTR_Thread pThread, CrawlFrame *pCf, StackFrame sfCur LOG((LF_EH, LL_INFO100, "ResetThreadAbortState: Resetting thread abort state since there is no more managed code beyond stack frames:\n")); LOG((LF_EH, LL_INFO100, "sf.SP = %p ", dataCallback.sfSeedCrawlFrame.SP)); } -#else // WIN64EXCEPTIONS -#error Unsupported platform -#endif // WIN64EXCEPTIONS +#endif // !WIN64EXCEPTIONS } if (fResetThreadAbortState) diff --git a/src/vm/excep.h b/src/vm/excep.h index e50a770e27..53fa20160a 100644 --- a/src/vm/excep.h +++ b/src/vm/excep.h @@ -415,7 +415,7 @@ VOID DECLSPEC_NORETURN RealCOMPlusThrowInvalidCastException(TypeHandle thCastFro VOID DECLSPEC_NORETURN RealCOMPlusThrowInvalidCastException(OBJECTREF *pObj, TypeHandle thCastTo); -#ifdef _TARGET_X86_ +#ifndef WIN64EXCEPTIONS #include "eexcp.h" #include "exinfo.h" @@ -454,7 +454,7 @@ struct NestedHandlerExRecord : public FrameHandlerExRecord } }; -#endif // _TARGET_X86_ +#endif // !WIN64EXCEPTIONS #if defined(ENABLE_CONTRACTS_IMPL) @@ -520,10 +520,6 @@ extern "C" BOOL ExceptionIsOfRightType(TypeHandle clauseType, TypeHandle thrownT // The stuff below is what works "behind the scenes" of the public macros. //========================================================================== -#ifdef _TARGET_X86_ -LPVOID COMPlusEndCatchWorker(Thread *pCurThread); -EXTERN_C LPVOID STDCALL COMPlusEndCatch(LPVOID ebp, DWORD ebx, DWORD edi, DWORD esi, LPVOID* pRetAddress); -#endif // Specify NULL for uTryCatchResumeAddress when not checking for a InducedThreadRedirectAtEndOfCatch EXTERN_C LPVOID COMPlusCheckForAbort(UINT_PTR uTryCatchResumeAddress = NULL); @@ -946,9 +942,9 @@ public: #ifndef DACCESS_COMPILE -#if defined(_TARGET_X86_) +#ifndef WIN64EXCEPTIONS void ResetThreadAbortState(PTR_Thread pThread, void *pEstablisherFrame); -#elif defined(WIN64EXCEPTIONS) +#else void ResetThreadAbortState(PTR_Thread pThread, CrawlFrame *pCf, StackFrame sfCurrentStackFrame); #endif diff --git a/src/vm/exceptionhandling.cpp b/src/vm/exceptionhandling.cpp index 56c784a37f..475bf3be09 100644 --- a/src/vm/exceptionhandling.cpp +++ b/src/vm/exceptionhandling.cpp @@ -1293,7 +1293,11 @@ void ExceptionTracker::InitializeCurrentContextForCrawlFrame(CrawlFrame* pcfThis *(pRD->pCallerContext) = *(pDispatcherContext->ContextRecord); pRD->IsCallerContextValid = TRUE; +#ifndef _TARGET_X86_ pRD->SP = sfEstablisherFrame.SP; +#else + pRD->Esp = sfEstablisherFrame.SP; +#endif pRD->ControlPC = pDispatcherContext->ControlPc; #if defined(_TARGET_ARM_) || defined(_TARGET_ARM64_) diff --git a/src/vm/exinfo.cpp b/src/vm/exinfo.cpp index 9e07cebaf3..1ae011e85a 100644 --- a/src/vm/exinfo.cpp +++ b/src/vm/exinfo.cpp @@ -9,6 +9,7 @@ #include "exinfo.h" #include "dbginterface.h" +#ifndef WIN64EXCEPTIONS #ifndef DACCESS_COMPILE // // Destroy the handle within an ExInfo. This respects the fact that we can have preallocated global handles living @@ -312,3 +313,4 @@ void ExInfo::SetExceptionCode(const EXCEPTION_RECORD *pCER) DacError(E_UNEXPECTED); #endif // !DACCESS_COMPILE } +#endif // !WIN64EXCEPTIONS diff --git a/src/vm/exstate.cpp b/src/vm/exstate.cpp index bde71db884..29c7a063f5 100644 --- a/src/vm/exstate.cpp +++ b/src/vm/exstate.cpp @@ -498,7 +498,7 @@ BOOL DebuggerExState::SetDebuggerInterceptInfo(IJitManager *pJitManager, int nestingLevel = 0; -#if defined(_TARGET_X86_) +#ifndef WIN64EXCEPTIONS // // Get the SEH frame that covers this location on the stack. Note: we pass a skip count of 1. We know that when // this is called, there is a nested exception handler on pThread's stack that is only there during exception @@ -517,11 +517,7 @@ BOOL DebuggerExState::SetDebuggerInterceptInfo(IJitManager *pJitManager, nestingLevel = ComputeEnclosingHandlerNestingLevel(pJitManager, methodToken, natOffset); -#elif !defined(WIN64EXCEPTIONS) - // !_TARGET_X86_ && !WIN64EXCEPTIONS - PORTABILITY_ASSERT("SetDebuggerInterceptInfo() (ExState.cpp) - continuable exceptions NYI\n"); - return FALSE; -#endif // !_TARGET_X86_ +#endif // !WIN64EXCEPTIONS // // These values will override the normal information used by the EH subsystem to handle the exception. diff --git a/src/vm/exstatecommon.h b/src/vm/exstatecommon.h index 7c505b8bac..270293669d 100644 --- a/src/vm/exstatecommon.h +++ b/src/vm/exstatecommon.h @@ -51,10 +51,10 @@ public: m_pDebuggerContext = NULL; m_pDebuggerInterceptNativeOffset = 0; + #ifndef WIN64EXCEPTIONS // x86-specific fields - #if defined(_TARGET_X86_) m_pDebuggerInterceptFrame = EXCEPTION_CHAIN_END; - #endif // defined(_TARGET_X86_) + #endif // !WIN64EXCEPTIONS m_dDebuggerInterceptHandlerDepth = 0; } @@ -133,9 +133,9 @@ public: // void GetDebuggerInterceptInfo( - #if defined(_TARGET_X86_) + #ifndef WIN64EXCEPTIONS PEXCEPTION_REGISTRATION_RECORD *pEstablisherFrame, - #endif // _TARGET_X86_ + #endif // !WIN64EXCEPTIONS MethodDesc **ppFunc, int *pdHandler, BYTE **ppStack, @@ -144,12 +144,12 @@ public: { LIMITED_METHOD_CONTRACT; -#if defined(_TARGET_X86_) +#ifndef WIN64EXCEPTIONS if (pEstablisherFrame != NULL) { *pEstablisherFrame = m_pDebuggerInterceptFrame; } -#endif // _TARGET_X86_ +#endif // !WIN64EXCEPTIONS if (ppFunc != NULL) { @@ -195,10 +195,10 @@ private: ULONG_PTR m_pDebuggerInterceptNativeOffset; // The remaining fields are only used on x86. -#if defined(_TARGET_X86_) +#ifndef WIN64EXCEPTIONS // the exception registration record covering the stack range containing the interception point PEXCEPTION_REGISTRATION_RECORD m_pDebuggerInterceptFrame; -#endif // defined(_TARGET_X86_) +#endif // !WIN64EXCEPTIONS // the nesting level at which we want to resume execution int m_dDebuggerInterceptHandlerDepth; diff --git a/src/vm/frames.h b/src/vm/frames.h index 91ab3c3e5f..e37f980b9f 100644 --- a/src/vm/frames.h +++ b/src/vm/frames.h @@ -1114,17 +1114,19 @@ class FaultingExceptionFrame : public Frame { friend class CheckAsmOffsets; -#if defined(_TARGET_X86_) +#ifndef WIN64EXCEPTIONS +#ifdef _TARGET_X86_ DWORD m_Esp; CalleeSavedRegisters m_regs; TADDR m_ReturnAddress; -#endif - -#ifdef WIN64EXCEPTIONS +#else // _TARGET_X86_ + #error "Unsupported architecture" +#endif // _TARGET_X86_ +#else // WIN64EXCEPTIONS BOOL m_fFilterExecuted; // Flag for FirstCallToHandler TADDR m_ReturnAddress; T_CONTEXT m_ctx; -#endif // WIN64EXCEPTIONS +#endif // !WIN64EXCEPTIONS VPTR_VTABLE_CLASS(FaultingExceptionFrame, Frame) @@ -1156,13 +1158,17 @@ public: return FRAME_ATTR_EXCEPTION | FRAME_ATTR_FAULTED; } -#if defined(_TARGET_X86_) +#ifndef WIN64EXCEPTIONS CalleeSavedRegisters *GetCalleeSavedRegisters() { +#ifdef _TARGET_X86_ LIMITED_METHOD_DAC_CONTRACT; return &m_regs; +#else + PORTABILITY_ASSERT("GetCalleeSavedRegisters"); +#endif // _TARGET_X86_ } -#endif +#endif // WIN64EXCEPTIONS #ifdef WIN64EXCEPTIONS T_CONTEXT *GetExceptionContext () diff --git a/src/vm/gcenv.ee.cpp b/src/vm/gcenv.ee.cpp index 5fb83bfa04..792e748f9d 100644 --- a/src/vm/gcenv.ee.cpp +++ b/src/vm/gcenv.ee.cpp @@ -204,6 +204,7 @@ bool FindFirstInterruptiblePointStateCB( // the end is exclusive). Return -1 if no such point exists. unsigned FindFirstInterruptiblePoint(CrawlFrame* pCF, unsigned offs, unsigned endOffs) { +#ifdef USE_GC_INFO_DECODER GCInfoToken gcInfoToken = pCF->GetGCInfoToken(); GcInfoDecoder gcInfoDecoder(gcInfoToken, DECODE_FOR_RANGES_CALLBACK); @@ -215,6 +216,10 @@ unsigned FindFirstInterruptiblePoint(CrawlFrame* pCF, unsigned offs, unsigned en gcInfoDecoder.EnumerateInterruptibleRanges(&FindFirstInterruptiblePointStateCB, &state); return state.returnOffs; +#else + PORTABILITY_ASSERT("FindFirstInterruptiblePoint"); + return -1; +#endif // USE_GC_INFO_DECODER } #endif // WIN64EXCEPTIONS @@ -283,7 +288,7 @@ StackWalkAction GcStackCrawlCallBack(CrawlFrame* pCF, VOID* pData) #endif // _DEBUG DWORD relOffsetOverride = NO_OVERRIDE_OFFSET; -#if defined(WIN64EXCEPTIONS) +#if defined(WIN64EXCEPTIONS) && defined(USE_GC_INFO_DECODER) if (pCF->ShouldParentToFuncletUseUnwindTargetLocationForGCReporting()) { GCInfoToken gcInfoToken = pCF->GetGCInfoToken(); @@ -313,7 +318,7 @@ StackWalkAction GcStackCrawlCallBack(CrawlFrame* pCF, VOID* pData) } } -#endif // WIN64EXCEPTIONS +#endif // WIN64EXCEPTIONS && USE_GC_INFO_DECODER pCM->EnumGcRefs(pCF->GetRegisterSet(), pCF->GetCodeInfo(), diff --git a/src/vm/i386/cgencpu.h b/src/vm/i386/cgencpu.h index 99f4eb498f..38a88a7401 100644 --- a/src/vm/i386/cgencpu.h +++ b/src/vm/i386/cgencpu.h @@ -86,6 +86,10 @@ BOOL Runtime_Test_For_SSE2(); #define JUMP_ALLOCATE_SIZE 8 // # bytes to allocate for a jump instruction #define BACK_TO_BACK_JUMP_ALLOCATE_SIZE 8 // # bytes to allocate for a back to back jump instruction +#ifdef WIN64EXCEPTIONS +#define USE_INDIRECT_CODEHEADER +#endif // WIN64EXCEPTIONS + #define HAS_COMPACT_ENTRYPOINTS 1 // Needed for PInvoke inlining in ngened images diff --git a/src/vm/i386/cgenx86.cpp b/src/vm/i386/cgenx86.cpp index 08ccd01086..703968c888 100644 --- a/src/vm/i386/cgenx86.cpp +++ b/src/vm/i386/cgenx86.cpp @@ -509,6 +509,7 @@ void FaultingExceptionFrame::UpdateRegDisplay(const PREGDISPLAY pRD) } CONTRACT_END; +#ifndef WIN64EXCEPTIONS CalleeSavedRegisters* regs = GetCalleeSavedRegisters(); // reset pContext; it's only valid for active (top-most) frame @@ -518,9 +519,24 @@ void FaultingExceptionFrame::UpdateRegDisplay(const PREGDISPLAY pRD) pRD->pEsi = (DWORD*) ®s->esi; pRD->pEbx = (DWORD*) ®s->ebx; pRD->pEbp = (DWORD*) ®s->ebp; + pRD->Esp = m_Esp; pRD->PCTAddr = GetReturnAddressPtr(); pRD->ControlPC = *PTR_PCODE(pRD->PCTAddr); - pRD->Esp = m_Esp; +#else + memcpy(pRD->pCurrentContext, &m_ctx, sizeof(CONTEXT)); + + pRD->ControlPC = m_ctx.Eip; + + pRD->Esp = m_ctx.Esp; + + pRD->pCurrentContextPointers->Ebx = &m_ctx.Ebx; + pRD->pCurrentContextPointers->Edi = &m_ctx.Edi; + pRD->pCurrentContextPointers->Esi = &m_ctx.Esi; + pRD->pCurrentContextPointers->Ebp = &m_ctx.Ebp; + + pRD->IsCallerContextValid = FALSE; + pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary. +#endif // WIN64EXCEPTIONS RETURN; } @@ -606,6 +622,7 @@ void ResumableFrame::UpdateRegDisplay(const PREGDISPLAY pRD) CONTEXT* pUnwoundContext = m_Regs; +#ifndef WIN64EXCEPTIONS #if !defined(DACCESS_COMPILE) // "pContextForUnwind" field is only used on X86 since not only is it initialized just for it, // but its used only under the confines of STACKWALKER_MAY_POP_FRAMES preprocessor define, @@ -625,6 +642,7 @@ void ResumableFrame::UpdateRegDisplay(const PREGDISPLAY pRD) pUnwoundContext->Eip = m_Regs->Eip; } #endif // !defined(DACCESS_COMPILE) +#endif // !WIN64EXCEPTIONS pRD->pEax = &pUnwoundContext->Eax; pRD->pEcx = &pUnwoundContext->Ecx; diff --git a/src/vm/i386/excepcpu.h b/src/vm/i386/excepcpu.h index ff540e784b..d70c6620a1 100644 --- a/src/vm/i386/excepcpu.h +++ b/src/vm/i386/excepcpu.h @@ -21,6 +21,7 @@ #define STATUS_CLR_GCCOVER_CODE STATUS_PRIVILEGED_INSTRUCTION +#ifndef WIN64EXCEPTIONS class Thread; #if defined(_MSC_VER) @@ -28,19 +29,6 @@ class Thread; // Actually, the handler getting set is properly registered #endif -#ifdef FEATURE_PAL - -extern VOID SetSEHRecord(PEXCEPTION_REGISTRATION_RECORD record); -extern VOID ResetSEHRecord(PEXCEPTION_REGISTRATION_RECORD record); - -#define INSTALL_SEH_RECORD(record) \ - SetSEHRecord(record); \ - -#define UNINSTALL_SEH_RECORD(record) \ - ResetSEHRecord(record); - -#else // FEATURE_PAL - #define INSTALL_SEH_RECORD(record) \ { \ (record)->Next = (PEXCEPTION_REGISTRATION_RECORD)__readfsdword(0); \ @@ -52,8 +40,6 @@ extern VOID ResetSEHRecord(PEXCEPTION_REGISTRATION_RECORD record); __writefsdword(0, (DWORD) ((record)->Next)); \ } -#endif // FEATURE_PAL - #define INSTALL_EXCEPTION_HANDLING_RECORD(record) \ { \ PEXCEPTION_REGISTRATION_RECORD __record = (record); \ @@ -90,14 +76,32 @@ extern VOID ResetSEHRecord(PEXCEPTION_REGISTRATION_RECORD record); #endif + +PEXCEPTION_REGISTRATION_RECORD GetCurrentSEHRecord(); +PEXCEPTION_REGISTRATION_RECORD GetFirstCOMPlusSEHRecord(Thread*); + +LPVOID COMPlusEndCatchWorker(Thread *pCurThread); +EXTERN_C LPVOID STDCALL COMPlusEndCatch(LPVOID ebp, DWORD ebx, DWORD edi, DWORD esi, LPVOID* pRetAddress); + +#else // WIN64EXCEPTIONS +#define INSTALL_EXCEPTION_HANDLING_RECORD(record) +#define UNINSTALL_EXCEPTION_HANDLING_RECORD(record) +#define DECLARE_CPFH_EH_RECORD(pCurThread) + +#endif // WIN64EXCEPTIONS + // // Retrieves the redirected CONTEXT* from the stack frame of one of the // RedirectedHandledJITCaseForXXX_Stub's. // PTR_CONTEXT GetCONTEXTFromRedirectedStubStackFrame(CONTEXT * pContext); +#ifdef WIN64EXCEPTIONS +PTR_CONTEXT GetCONTEXTFromRedirectedStubStackFrame(T_DISPATCHER_CONTEXT * pDispatcherContext); -PEXCEPTION_REGISTRATION_RECORD GetCurrentSEHRecord(); -PEXCEPTION_REGISTRATION_RECORD GetFirstCOMPlusSEHRecord(Thread*); +class FaultingExceptionFrame; + +FaultingExceptionFrame *GetFrameFromRedirectedStubStackFrame (DISPATCHER_CONTEXT *pDispatcherContext); +#endif // WIN64EXCEPTIONS // Determine the address of the instruction that made the current call. inline diff --git a/src/vm/i386/excepx86.cpp b/src/vm/i386/excepx86.cpp index c6a95ef555..0f05aa29cd 100644 --- a/src/vm/i386/excepx86.cpp +++ b/src/vm/i386/excepx86.cpp @@ -38,6 +38,7 @@ #include "asmconstants.h" #include "virtualcallstub.h" +#ifndef WIN64EXCEPTIONS MethodDesc * GetUserMethodForILStub(Thread * pThread, UINT_PTR uStubSP, MethodDesc * pILStubMD, Frame ** ppFrameOut); #if !defined(DACCESS_COMPILE) @@ -2018,20 +2019,6 @@ PEXCEPTION_REGISTRATION_RECORD GetCurrentSEHRecord() return (EXCEPTION_REGISTRATION_RECORD*) fs0; } -#ifdef FEATURE_PAL -VOID SetSEHRecord(PEXCEPTION_REGISTRATION_RECORD record) -{ - WRAPPER_NO_CONTRACT; - record->Next = CurrentSEHRecord; - CurrentSEHRecord = record; -} - -VOID ResetSEHRecord(PEXCEPTION_REGISTRATION_RECORD record) -{ - CurrentSEHRecord = record->Next; -} -#endif // FEATURE_PAL - PEXCEPTION_REGISTRATION_RECORD GetFirstCOMPlusSEHRecord(Thread *pThread) { WRAPPER_NO_CONTRACT; #ifndef FEATURE_PAL @@ -3622,33 +3609,11 @@ EXCEPTION_HANDLER_IMPL(UMThunkPrestubHandler) return retval; } -LONG CLRNoCatchHandler(EXCEPTION_POINTERS* pExceptionInfo, PVOID pv) -{ - WRAPPER_NO_CONTRACT; - STATIC_CONTRACT_ENTRY_POINT; - - LONG result = EXCEPTION_CONTINUE_SEARCH; - - // This function can be called during the handling of a SO - //BEGIN_ENTRYPOINT_VOIDRET; - - result = CLRVectoredExceptionHandler(pExceptionInfo); - - if (EXCEPTION_EXECUTE_HANDLER == result) - { - result = EXCEPTION_CONTINUE_SEARCH; - } - - //END_ENTRYPOINT_VOIDRET; - - return result; -} - #ifdef FEATURE_COMINTEROP // The reverse COM interop path needs to be sure to pop the ComMethodFrame that is pushed, but we do not want -// to have an additional FS:0 handler between the COM callsite and the call into managed. So we push this -// FS:0 handler, which will defer to the usual COMPlusFrameHandler and then perform the cleanup of the -// ComMethodFrame, if needed. +// to have an additional FS:0 handler between the COM callsite and the call into managed. So we push this +// FS:0 handler, which will defer to the usual COMPlusFrameHandler and then perform the cleanup of the +// ComMethodFrame, if needed. EXCEPTION_HANDLER_IMPL(COMPlusFrameHandlerRevCom) { STATIC_CONTRACT_THROWS; @@ -3667,7 +3632,36 @@ EXCEPTION_HANDLER_IMPL(COMPlusFrameHandlerRevCom) return result; } #endif // FEATURE_COMINTEROP +#endif // !DACCESS_COMPILE +#endif // !WIN64EXCEPTIONS + +#ifndef DACCESS_COMPILE +LONG CLRNoCatchHandler(EXCEPTION_POINTERS* pExceptionInfo, PVOID pv) +{ +#ifndef WIN64EXCEPTIONS + WRAPPER_NO_CONTRACT; + STATIC_CONTRACT_ENTRY_POINT; + + LONG result = EXCEPTION_CONTINUE_SEARCH; + + // This function can be called during the handling of a SO + //BEGIN_ENTRYPOINT_VOIDRET; + + result = CLRVectoredExceptionHandler(pExceptionInfo); + + if (EXCEPTION_EXECUTE_HANDLER == result) + { + result = EXCEPTION_CONTINUE_SEARCH; + } + //END_ENTRYPOINT_VOIDRET; + + return result; +#else // !WIN64EXCEPTIONS + return EXCEPTION_CONTINUE_SEARCH; +#endif // !WIN64EXCEPTIONS +} +#endif // !DACCESS_COMPILE // Returns TRUE if caller should resume execution. BOOL @@ -3724,11 +3718,3 @@ AdjustContextForVirtualStub( return TRUE; } - -#ifdef FEATURE_PAL -VOID DECLSPEC_NORETURN DispatchManagedException(PAL_SEHException& ex, bool isHardwareException) -{ - UNREACHABLE(); -} -#endif -#endif // !DACCESS_COMPILE diff --git a/src/vm/i386/jithelp.S b/src/vm/i386/jithelp.S index 66ae9fb451..35a02613ea 100644 --- a/src/vm/i386/jithelp.S +++ b/src/vm/i386/jithelp.S @@ -727,6 +727,7 @@ LEAF_END JIT_PatchedCodeEnd, _TEXT // debugger may need additional support. // void __stdcall JIT_EndCatch(); NESTED_ENTRY JIT_EndCatch, _TEXT, NoHandler +#ifndef WIN64EXCEPTIONS // make temp storage for return address, and push the address of that // as the last arg to COMPlusEndCatch mov ecx, [esp] @@ -746,4 +747,7 @@ NESTED_ENTRY JIT_EndCatch, _TEXT, NoHandler pop edx // edx = new eip mov esp, eax // esp = new esp jmp edx // eip = new eip +#else + int3 +#endif NESTED_END JIT_EndCatch, _TEXT diff --git a/src/vm/i386/unixstubs.cpp b/src/vm/i386/unixstubs.cpp index 3252922249..4025c26216 100644 --- a/src/vm/i386/unixstubs.cpp +++ b/src/vm/i386/unixstubs.cpp @@ -6,7 +6,7 @@ extern "C" { - void ThrowControlForThread() + void ThrowControlForThread(FaultingExceptionFrame *pfef) { PORTABILITY_ASSERT("Implement for PAL"); } @@ -45,19 +45,6 @@ extern "C" { } - _Unwind_Reason_Code - UnhandledExceptionHandlerUnix( - IN int version, - IN _Unwind_Action action, - IN uint64_t exceptionClass, - IN struct _Unwind_Exception *exception, - IN struct _Unwind_Context *context - ) - { - PORTABILITY_ASSERT("UnhandledExceptionHandlerUnix"); - return _URC_FATAL_PHASE1_ERROR; - } - BOOL CallRtlUnwind() { PORTABILITY_ASSERT("CallRtlUnwind"); @@ -94,3 +81,44 @@ EXTERN_C VOID JIT_TailCallLeave() { PORTABILITY_ASSERT("JIT_TailCallLeave"); } + +PTR_CONTEXT GetCONTEXTFromRedirectedStubStackFrame(T_DISPATCHER_CONTEXT * pDispatcherContext) +{ + PORTABILITY_ASSERT("GetCONTEXTFromRedirectedStubStackFrame"); + return NULL; +} + +FaultingExceptionFrame *GetFrameFromRedirectedStubStackFrame(DISPATCHER_CONTEXT *pDispatcherContext) +{ + PORTABILITY_ASSERT("GetFrameFromRedirectedStubStackFrame"); + return NULL; +} + +EXTERN_C ULONG +RtlpGetFunctionEndAddress ( + __in PT_RUNTIME_FUNCTION FunctionEntry, + __in ULONG ImageBase + ) +{ + PORTABILITY_ASSERT("RtlpGetFunctionEndAddress"); + return 0; +} + +EXTERN_C +NTSYSAPI +PEXCEPTION_ROUTINE +NTAPI +RtlVirtualUnwind ( + __in DWORD HandlerType, + __in DWORD ImageBase, + __in DWORD ControlPc, + __in PRUNTIME_FUNCTION FunctionEntry, + __inout PT_CONTEXT ContextRecord, + __out PVOID *HandlerData, + __out PDWORD EstablisherFrame, + __inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers + ) +{ + PORTABILITY_ASSERT("RtlVirtualUnwind"); + return NULL; +} diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index 2f9db3d596..9d57836bac 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -11082,7 +11082,7 @@ void CEEJitInfo::allocUnwindInfo ( RUNTIME_FUNCTION__SetBeginAddress(pRuntimeFunction, currentCodeOffset + startOffset); -#if defined(_TARGET_X86_) || defined(_TARGET_AMD64_) +#if defined(_TARGET_AMD64_) pRuntimeFunction->EndAddress = currentCodeOffset + endOffset; #endif diff --git a/src/vm/jitinterface.h b/src/vm/jitinterface.h index ee13b9cec6..6cc3a05fba 100644 --- a/src/vm/jitinterface.h +++ b/src/vm/jitinterface.h @@ -391,7 +391,10 @@ void ValidateWriteBarrierHelpers(); extern "C" { +#ifdef _TARGET_X86_ + // UNIXTODO: Disable JIT_EndCatch after revising the jitter not to use this (for x86/Linux) void STDCALL JIT_EndCatch(); // JIThelp.asm/JIThelp.s +#endif // _TARGET_X86_ void STDCALL JIT_ByRefWriteBarrier(); // JIThelp.asm/JIThelp.s diff --git a/src/vm/prestub.cpp b/src/vm/prestub.cpp index e0d4096347..9fd7c52446 100644 --- a/src/vm/prestub.cpp +++ b/src/vm/prestub.cpp @@ -829,15 +829,24 @@ Stub * CreateInstantiatingILStub(MethodDesc* pTargetMD, void* pHiddenArg) CreateInstantiatingILStubTargetSig(pTargetMD, typeContext, &stubSigBuilder); // 2. Emit the method body + unsigned int numArgs = msig.NumFixedArgs(); if (msig.HasThis()) { // 2.1 Push the thisptr pCode->EmitLoadThis(); + numArgs++; } - // 2.2 Push the hidden context param - // InstantiatingStub - pCode->EmitLDC((TADDR)pHiddenArg); +#if defined(_TARGET_X86_) + if (numArgs < NUM_ARGUMENT_REGISTERS) + { +#endif // _TARGET_X86_ + // 2.2 Push the hidden context param + // InstantiatingStub + pCode->EmitLDC((TADDR)pHiddenArg); +#if defined(_TARGET_X86_) + } +#endif // _TARGET_X86_ // 2.3 Push the rest of the arguments for (unsigned i = 0; i < msig.NumFixedArgs();i++) @@ -845,10 +854,19 @@ Stub * CreateInstantiatingILStub(MethodDesc* pTargetMD, void* pHiddenArg) pCode->EmitLDARG(i); } - // 2.4 Push the target address +#if defined(_TARGET_X86_) + if (numArgs >= NUM_ARGUMENT_REGISTERS) + { + // 2.4 Push the hidden context param + // InstantiatingStub + pCode->EmitLDC((TADDR)pHiddenArg); + } +#endif // _TARGET_X86_ + + // 2.5 Push the target address pCode->EmitLDC((TADDR)pTargetMD->GetMultiCallableAddrOfCode(CORINFO_ACCESS_ANY)); - // 2.5 Do the calli + // 2.6 Do the calli pCode->EmitCALLI(TOKEN_ILSTUB_TARGET_SIG, msig.NumFixedArgs() + 1, msig.IsReturnTypeVoid() ? 0 : 1); pCode->EmitRET(); diff --git a/src/vm/stackwalk.cpp b/src/vm/stackwalk.cpp index 18a8900039..44e5f99640 100644 --- a/src/vm/stackwalk.cpp +++ b/src/vm/stackwalk.cpp @@ -555,11 +555,9 @@ UINT_PTR Thread::VirtualUnwindCallFrame(PREGDISPLAY pRD, EECodeInfo* pCodeInfo / pRD->pCurrentContext = pRD->pCallerContext; pRD->pCallerContext = temp; -#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM_) || defined(_TARGET_ARM64_) PT_KNONVOLATILE_CONTEXT_POINTERS tempPtrs = pRD->pCurrentContextPointers; pRD->pCurrentContextPointers = pRD->pCallerContextPointers; pRD->pCallerContextPointers = tempPtrs; -#endif // defined(_TARGET_AMD64_) || defined(_TARGET_ARM_) || defined(_TARGET_ARM64_) } else { @@ -722,15 +720,12 @@ PCODE Thread::VirtualUnwindNonLeafCallFrame(T_CONTEXT* pContext, KNONVOLATILE_CO CONTRACTL_END; PCODE uControlPc = GetIP(pContext); -#if defined(_WIN64) +#ifdef BIT64 UINT64 EstablisherFrame; - PVOID HandlerData; -#elif defined(_TARGET_ARM_) +#else // BIT64 DWORD EstablisherFrame; +#endif // BIT64 PVOID HandlerData; -#else - _ASSERTE(!"nyi platform stackwalking"); -#endif if (NULL == pFunctionEntry) { @@ -893,7 +888,7 @@ StackWalkAction Thread::MakeStackwalkerCallback( } -#if !defined(DACCESS_COMPILE) && defined(_TARGET_X86_) +#if !defined(DACCESS_COMPILE) && defined(_TARGET_X86_) && !defined(WIN64EXCEPTIONS) #define STACKWALKER_MAY_POP_FRAMES #endif @@ -2677,9 +2672,10 @@ StackWalkAction StackFrameIterator::NextRaw(void) // We are transitioning from unmanaged code to managed code... lets do some validation of our // EH mechanism on platforms that we can. -#if defined(_DEBUG) && !defined(DACCESS_COMPILE) && (defined(_TARGET_X86_) && !defined(FEATURE_STUBS_AS_IL)) +#if defined(_DEBUG) && !defined(DACCESS_COMPILE) && (defined(_TARGET_X86_) && !defined(FEATURE_PAL)) && !defined(WIN64EXCEPTIONS) + // TODO: Revise this once we enable WIN64EXCEPTIONS for x86/Linux VerifyValidTransitionFromManagedCode(m_crawl.pThread, &m_crawl); -#endif // _DEBUG && !DACCESS_COMPILE && _TARGET_X86_ +#endif // _DEBUG && !DACCESS_COMPILE && _TARGET_X86_ && !WIN64EXCEPTIONS } } diff --git a/src/vm/stubmgr.h b/src/vm/stubmgr.h index f0098c9d55..10cba00de7 100644 --- a/src/vm/stubmgr.h +++ b/src/vm/stubmgr.h @@ -445,7 +445,7 @@ class PrecodeStubManager : public StubManager #ifndef DACCESS_COMPILE virtual BOOL TraceManager(Thread *thread, TraceDestination *trace, - CONTEXT *pContext, + T_CONTEXT *pContext, BYTE **pRetAddr); #endif @@ -509,7 +509,7 @@ class StubLinkStubManager : public StubManager #ifndef DACCESS_COMPILE virtual BOOL TraceManager(Thread *thread, TraceDestination *trace, - CONTEXT *pContext, + T_CONTEXT *pContext, BYTE **pRetAddr); #endif @@ -646,7 +646,7 @@ class RangeSectionStubManager : public StubManager #ifndef DACCESS_COMPILE virtual BOOL TraceManager(Thread *thread, TraceDestination *trace, - CONTEXT *pContext, + T_CONTEXT *pContext, BYTE **pRetAddr); #endif @@ -708,7 +708,7 @@ class ILStubManager : public StubManager virtual BOOL TraceManager(Thread *thread, TraceDestination *trace, - CONTEXT *pContext, + T_CONTEXT *pContext, BYTE **pRetAddr); #endif @@ -752,7 +752,7 @@ class InteropDispatchStubManager : public StubManager #ifndef DACCESS_COMPILE virtual BOOL TraceManager(Thread *thread, TraceDestination *trace, - CONTEXT *pContext, + T_CONTEXT *pContext, BYTE **pRetAddr); #endif @@ -797,7 +797,7 @@ class DelegateInvokeStubManager : public StubManager virtual BOOL CheckIsStub_Internal(PCODE stubStartAddress); #if !defined(DACCESS_COMPILE) - virtual BOOL TraceManager(Thread *thread, TraceDestination *trace, CONTEXT *pContext, BYTE **pRetAddr); + virtual BOOL TraceManager(Thread *thread, TraceDestination *trace, T_CONTEXT *pContext, BYTE **pRetAddr); static BOOL TraceDelegateObject(BYTE *orDel, TraceDestination *trace); #endif // DACCESS_COMPILE @@ -846,7 +846,7 @@ public: TailCallStubManager() : StubManager() {WRAPPER_NO_CONTRACT;} ~TailCallStubManager() {WRAPPER_NO_CONTRACT;} - virtual BOOL TraceManager(Thread * pThread, TraceDestination * pTrace, CONTEXT * pContext, BYTE ** ppRetAddr); + virtual BOOL TraceManager(Thread * pThread, TraceDestination * pTrace, T_CONTEXT * pContext, BYTE ** ppRetAddr); static bool IsTailCallStubHelper(PCODE code); #endif // DACCESS_COMPILE diff --git a/src/vm/threads.h b/src/vm/threads.h index 144e17c591..9754478f0c 100644 --- a/src/vm/threads.h +++ b/src/vm/threads.h @@ -3386,7 +3386,7 @@ public: m_singleStepper.Disable(); } - void ApplySingleStep(CONTEXT *pCtx) + void ApplySingleStep(T_CONTEXT *pCtx) { m_singleStepper.Apply(pCtx); } @@ -3399,7 +3399,7 @@ public: // Fixup code called by our vectored exception handler to complete the emulation of single stepping // initiated by EnableSingleStep above. Returns true if the exception was indeed encountered during // stepping. - bool HandleSingleStep(CONTEXT *pCtx, DWORD dwExceptionCode) + bool HandleSingleStep(T_CONTEXT *pCtx, DWORD dwExceptionCode) { return m_singleStepper.Fixup(pCtx, dwExceptionCode); } diff --git a/src/vm/threadsuspend.cpp b/src/vm/threadsuspend.cpp index 2e6563da1e..18d04db42b 100644 --- a/src/vm/threadsuspend.cpp +++ b/src/vm/threadsuspend.cpp @@ -2190,7 +2190,7 @@ LRetry: | TS_Detached | TS_Unstarted))); -#ifdef _TARGET_X86_ +#if defined(_TARGET_X86_) && !defined(WIN64EXCEPTIONS) // TODO WIN64: consider this if there is a way to detect of managed code on stack. if ((m_pFrame == FRAME_TOP) && (GetFirstCOMPlusSEHRecord(this) == EXCEPTION_CHAIN_END) @@ -2213,7 +2213,7 @@ LRetry: if (!m_fPreemptiveGCDisabled) { if ((m_pFrame != FRAME_TOP) && m_pFrame->IsTransitionToNativeFrame() -#ifdef _TARGET_X86_ +#if defined(_TARGET_X86_) && !defined(WIN64EXCEPTIONS) && ((size_t) GetFirstCOMPlusSEHRecord(this) > ((size_t) m_pFrame) - 20) #endif // _TARGET_X86_ ) diff --git a/src/zap/common.h b/src/zap/common.h index 95655fd9b8..b3db657f87 100644 --- a/src/zap/common.h +++ b/src/zap/common.h @@ -21,11 +21,11 @@ #include <float.h> #include <limits.h> -#if !defined(_TARGET_X86_) +#if !defined(_TARGET_X86_) || defined(FEATURE_PAL) #ifndef WIN64EXCEPTIONS #define WIN64EXCEPTIONS #endif -#endif // !_TARGET_X86_ +#endif // !_TARGET_X86_ || FEATURE_PAL #include "utilcode.h" #include "corjit.h" diff --git a/src/zap/zapcode.cpp b/src/zap/zapcode.cpp index 167c0ed912..e54e884bc2 100644 --- a/src/zap/zapcode.cpp +++ b/src/zap/zapcode.cpp @@ -1130,7 +1130,7 @@ void ZapUnwindInfo::Save(ZapWriter * pZapWriter) pZapWriter->Write(&runtimeFunction, sizeof(runtimeFunction)); } -#if defined(WIN64EXCEPTIONS) && !defined(_TARGET_X86_) +#if defined(WIN64EXCEPTIONS) // Compare the unwind infos by their offset int __cdecl ZapUnwindInfo::CompareUnwindInfo(const void* a_, const void* b_) { |