diff options
author | Richard L Ford <richford@microsoft.com> | 2015-12-17 21:23:42 -0800 |
---|---|---|
committer | Richard L Ford <richford@microsoft.com> | 2015-12-22 22:12:54 -0800 |
commit | a60e65ab1549d0c584a357f30a4411502b9c1791 (patch) | |
tree | 1ce7f4527ae36b975bb3e1ea43347d00b3f239ec /tests/src/JIT/jit64/eh | |
parent | 428f413f917a610eae457f44b1870d04ff1f3775 (diff) | |
download | coreclr-a60e65ab1549d0c584a357f30a4411502b9c1791.tar.gz coreclr-a60e65ab1549d0c584a357f30a4411502b9c1791.tar.bz2 coreclr-a60e65ab1549d0c584a357f30a4411502b9c1791.zip |
Port additional desktop tests to CoreClr
Add exclusions for tests that are failing but that
we expect to be able to get working.
Diffstat (limited to 'tests/src/JIT/jit64/eh')
19 files changed, 1471 insertions, 1 deletions
diff --git a/tests/src/JIT/jit64/eh/basics/project.lock.json b/tests/src/JIT/jit64/eh/basics/project.lock.json index 48730e8c4d..a2f423a380 100644 --- a/tests/src/JIT/jit64/eh/basics/project.lock.json +++ b/tests/src/JIT/jit64/eh/basics/project.lock.json @@ -1318,4 +1318,4 @@ ], "DNXCore,Version=v5.0": [] } -} +}
\ No newline at end of file diff --git a/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter1.il b/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter1.il new file mode 100644 index 0000000000..40916f88fb --- /dev/null +++ b/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter1.il @@ -0,0 +1,130 @@ + + + +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly extern mscorlib {} +.assembly test {} +.module test.exe +.assembly extern common {} + + +.method public static int32 Main() +{ + .entrypoint + .maxstack 2 + .locals init ( + class [mscorlib]System.IO.StringWriter expectedOut, + class [common]TestUtil.TestLog testLog + ) + + + newobj instance void [mscorlib]System.IO.StringWriter::.ctor() + stloc.s expectedOut + ldloc.s expectedOut + ldstr "in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in finally" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in filter" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "in finally" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "caught an exception!" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + newobj instance void [common]TestUtil.TestLog::.ctor(object) + stloc.s testLog + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StartRecording() + + .try + { + ldc.i4.0 + call void func(int32) + leave.s DONE + } + catch [mscorlib]System.Exception + { + pop + ldstr "caught an exception!" + call void [System.Console]System.Console::WriteLine(string) + leave.s DONE + } + + DONE: + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StopRecording() + + ldloc.s testLog + callvirt instance int32 [common]TestUtil.TestLog::VerifyOutput() + + ret +} + + +.method public static void func(int32 i) +{ + .maxstack 1 + .try + { + ldstr "in try" + call void [System.Console]System.Console::WriteLine(string) + .try + { + ldstr " in try" + call void [System.Console]System.Console::WriteLine(string) + .try + { + ldstr " in try" + call void [System.Console]System.Console::WriteLine(string) + leave.s TRY_1 + } + finally + { + ldstr " in finally" + call void [System.Console]System.Console::WriteLine(string) + newobj instance void [mscorlib]System.Exception::.ctor() + throw + endfinally + } + TRY_1: leave.s TRY_0 + } + filter + { + pop + ldstr " in filter" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.0 + endfilter + } { + pop + ldstr " in handler" + call void [System.Console]System.Console::WriteLine(string) + leave.s TRY_0 + } + TRY_0: leave.s DONE + } + finally + { + ldstr "in finally" + call void [System.Console]System.Console::WriteLine(string) + endfinally + } + DONE: ret +} diff --git a/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter1.ilproj b/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter1.ilproj new file mode 100644 index 0000000000..38e2de5bd6 --- /dev/null +++ b/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter1.ilproj @@ -0,0 +1,45 @@ +<?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> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + </PropertyGroup> + <ItemGroup> + <Compile Include="throwinfinallyintryfilter1.il" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\common\common.csproj" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter2.il b/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter2.il new file mode 100644 index 0000000000..19441c1ea2 --- /dev/null +++ b/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter2.il @@ -0,0 +1,137 @@ + + + +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly extern mscorlib {} +.assembly test {} +.assembly extern common {} +.module test.exe + + +.method public static int32 Main() +{ + .entrypoint + .maxstack 2 + .locals init ( + class [mscorlib]System.IO.StringWriter expectedOut, + class [common]TestUtil.TestLog testLog + ) + + + newobj instance void [mscorlib]System.IO.StringWriter::.ctor() + stloc.s expectedOut + ldloc.s expectedOut + ldstr "in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in finally" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in filter" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "in filter" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "caught an exception!" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + newobj instance void [common]TestUtil.TestLog::.ctor(object) + stloc.s testLog + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StartRecording() + + .try + { + ldc.i4.0 + call void func(int32) + leave.s DONE + } + catch [mscorlib]System.Exception + { + pop + ldstr "caught an exception!" + call void [System.Console]System.Console::WriteLine(string) + leave.s DONE + } + + DONE: + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StopRecording() + + ldloc.s testLog + callvirt instance int32 [common]TestUtil.TestLog::VerifyOutput() + + ret +} + + +.method public static void func(int32 i) +{ + .maxstack 1 + .try + { + ldstr "in try" + call void [System.Console]System.Console::WriteLine(string) + .try + { + ldstr " in try" + call void [System.Console]System.Console::WriteLine(string) + .try + { + ldstr " in try" + call void [System.Console]System.Console::WriteLine(string) + leave.s TRY_1 + } + finally + { + ldstr " in finally" + call void [System.Console]System.Console::WriteLine(string) + newobj instance void [mscorlib]System.Exception::.ctor() + throw + endfinally + } + TRY_1: leave.s TRY_0 + } + filter + { + pop + ldstr " in filter" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.0 + endfilter + } { + pop + ldstr " in handler" + call void [System.Console]System.Console::WriteLine(string) + leave.s TRY_0 + } + TRY_0: leave.s DONE + } + filter + { + pop + ldstr "in filter" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.0 + endfilter + } { + pop + ldstr "in handler" + call void [System.Console]System.Console::WriteLine(string) + leave.s DONE + } + DONE: ret +} diff --git a/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter2.ilproj b/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter2.ilproj new file mode 100644 index 0000000000..c71efedc41 --- /dev/null +++ b/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter2.ilproj @@ -0,0 +1,45 @@ +<?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> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + </PropertyGroup> + <ItemGroup> + <Compile Include="throwinfinallyintryfilter2.il" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\common\common.csproj" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter3.il b/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter3.il new file mode 100644 index 0000000000..3d42306c1f --- /dev/null +++ b/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter3.il @@ -0,0 +1,159 @@ + + + +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly extern mscorlib {} +.assembly test {} +.assembly extern common {} +.module test.exe + + +.method public static int32 Main() +{ + .entrypoint + .maxstack 2 + .locals init ( + class [mscorlib]System.IO.StringWriter expectedOut, + class [common]TestUtil.TestLog testLog + ) + + + newobj instance void [mscorlib]System.IO.StringWriter::.ctor() + stloc.s expectedOut + ldloc.s expectedOut + ldstr "in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in finally" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in filter" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "in filter" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in finally" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "in filter" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "caught an exception!" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + newobj instance void [common]TestUtil.TestLog::.ctor(object) + stloc.s testLog + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StartRecording() + + .try + { + ldc.i4.0 + call void func(int32) + leave.s DONE + } + catch [mscorlib]System.Exception + { + pop + ldstr "caught an exception!" + call void [System.Console]System.Console::WriteLine(string) + leave.s DONE + } + + DONE: + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StopRecording() + + ldloc.s testLog + callvirt instance int32 [common]TestUtil.TestLog::VerifyOutput() + + ret +} + + +.method public static void func(int32 i) +{ + .maxstack 1 + .try + { + ldstr "in try" + call void [System.Console]System.Console::WriteLine(string) + .try + { + ldstr " in try" + call void [System.Console]System.Console::WriteLine(string) + .try + { + ldstr " in try" + call void [System.Console]System.Console::WriteLine(string) + .try { + ldstr " in try" + call void [System.Console]System.Console::WriteLine(string) + leave.s TRY_2 + } + finally + { + ldstr " in finally" + call void [System.Console]System.Console::WriteLine(string) + newobj instance void [mscorlib]System.Exception::.ctor() + throw + endfinally + } + TRY_2: leave.s TRY_1 + } + filter + { + pop + ldstr " in filter" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.0 + endfilter + } { + pop + ldstr " in handler" + call void [System.Console]System.Console::WriteLine(string) + leave.s TRY_0 + } + TRY_1: leave.s TRY_0 + } + finally + { + ldstr " in finally" + call void [System.Console]System.Console::WriteLine(string) + newobj instance void [mscorlib]System.Exception::.ctor() + throw + endfinally + } + TRY_0: leave.s DONE + } + filter + { + pop + ldstr "in filter" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.0 + endfilter + } { + pop + ldstr "in handler" + call void [System.Console]System.Console::WriteLine(string) + leave.s DONE + } + DONE: ret +} diff --git a/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter3.ilproj b/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter3.ilproj new file mode 100644 index 0000000000..4965274ce1 --- /dev/null +++ b/tests/src/JIT/jit64/eh/basics/throwinfinallyintryfilter3.ilproj @@ -0,0 +1,45 @@ +<?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> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + </PropertyGroup> + <ItemGroup> + <Compile Include="throwinfinallyintryfilter3.il" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\common\common.csproj" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/jit64/eh/basics/throwisfirstinstruction.il b/tests/src/JIT/jit64/eh/basics/throwisfirstinstruction.il new file mode 100644 index 0000000000..84a512125d --- /dev/null +++ b/tests/src/JIT/jit64/eh/basics/throwisfirstinstruction.il @@ -0,0 +1,70 @@ + + +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly extern mscorlib {} +.assembly extern common {} +.assembly test {} +.module throw.exe + +.class private auto ansi beforefieldinit test + extends [mscorlib]System.Object +{ + .field private static class [common]TestUtil.TestLog testLog + .method private hidebysig specialname rtspecialname static void .cctor() cil managed + { + .maxstack 2 + .locals init ( + class [mscorlib]System.IO.StringWriter expectedOut + ) + newobj instance void [mscorlib]System.IO.StringWriter::.ctor() + stloc.s expectedOut + ldloc.s expectedOut + ldstr "in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "after try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + newobj instance void [common]TestUtil.TestLog::.ctor(object) + stsfld class [common]TestUtil.TestLog test::testLog + ret + } + + .method public static int32 Main() cil managed + { + .entrypoint + + ldsfld class [common]TestUtil.TestLog test::testLog + callvirt instance void [common]TestUtil.TestLog::StartRecording() + + .try + { + ldstr "in try" + call void [System.Console]System.Console::WriteLine(string) + leave IL_end + } + + catch [mscorlib]System.Exception + { + throw + } + + + IL_end: + ldstr "after try" + call void [System.Console]System.Console::WriteLine(string) + + ldsfld class [common]TestUtil.TestLog test::testLog + callvirt instance void [common]TestUtil.TestLog::StopRecording() + + ldsfld class [common]TestUtil.TestLog test::testLog + callvirt instance int32 [common]TestUtil.TestLog::VerifyOutput() + + ret + } + +} diff --git a/tests/src/JIT/jit64/eh/basics/throwisfirstinstruction.ilproj b/tests/src/JIT/jit64/eh/basics/throwisfirstinstruction.ilproj new file mode 100644 index 0000000000..5715d5a933 --- /dev/null +++ b/tests/src/JIT/jit64/eh/basics/throwisfirstinstruction.ilproj @@ -0,0 +1,45 @@ +<?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> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + </PropertyGroup> + <ItemGroup> + <Compile Include="throwisfirstinstruction.il" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\common\common.csproj" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitincatch.il b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitincatch.il new file mode 100644 index 0000000000..15af2001e8 --- /dev/null +++ b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitincatch.il @@ -0,0 +1,117 @@ + + + +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly extern mscorlib {} +.assembly extern common {} +.assembly test {} +.module nonlocalexitincatch.exe + + +.method public static int32 Main() +{ + .entrypoint + .maxstack 2 + .locals init ( + class [mscorlib]System.IO.StringWriter expectedOut, + class [common]TestUtil.TestLog testLog + ) + + + newobj instance void [mscorlib]System.IO.StringWriter::.ctor() + stloc.s expectedOut + ldloc.s expectedOut + ldstr "in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "in catch" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try 1" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in finally 1" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try 2" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in finally 2" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + newobj instance void [common]TestUtil.TestLog::.ctor(object) + stloc.s testLog + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StartRecording() + + call void Run() + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StopRecording() + + ldloc.s testLog + callvirt instance int32 [common]TestUtil.TestLog::VerifyOutput() + + ret +} + + +.method public static void Run() +{ + .maxstack 1 + .try + { + ldstr "in try" + call void [System.Console]System.Console::WriteLine(string) + newobj instance void [mscorlib]System.Exception::.ctor() + throw + leave.s DONE + } + catch [mscorlib]System.Exception + { + pop + ldstr "in catch" + call void [System.Console]System.Console::WriteLine(string) + + .try + { + TRY_1: + ldstr " in try 1" + call void [System.Console]System.Console::WriteLine(string) + leave.s TRY_2 + } + finally + { + ldstr " in finally 1" + call void [System.Console]System.Console::WriteLine(string) + endfinally + } + + ldstr "*** UNREACHABLE ***" + call void [System.Console]System.Console::WriteLine(string) + + .try + { + TRY_2: + ldstr " in try 2" + call void [System.Console]System.Console::WriteLine(string) + leave.s CATCH_END + } + finally + { + ldstr " in finally 2" + call void [System.Console]System.Console::WriteLine(string) + endfinally + } + + CATCH_END: + leave.s DONE + } + + DONE: ret +} diff --git a/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitincatch.ilproj b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitincatch.ilproj new file mode 100644 index 0000000000..333e28345d --- /dev/null +++ b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitincatch.ilproj @@ -0,0 +1,45 @@ +<?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> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + </PropertyGroup> + <ItemGroup> + <Compile Include="nonlocalexitincatch.il" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\common\common.csproj" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinfinally.il b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinfinally.il new file mode 100644 index 0000000000..859ec0cf00 --- /dev/null +++ b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinfinally.il @@ -0,0 +1,114 @@ + + + +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly extern mscorlib {} +.assembly extern common {} +.assembly test {} +.module nonlocalexitinfinally.exe + + +.method public static int32 Main() +{ + .entrypoint + .maxstack 2 + .locals init ( + class [mscorlib]System.IO.StringWriter expectedOut, + class [common]TestUtil.TestLog testLog + ) + + + newobj instance void [mscorlib]System.IO.StringWriter::.ctor() + stloc.s expectedOut + ldloc.s expectedOut + ldstr "in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "in finally" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try 1" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in finally 1" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try 2" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in finally 2" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + newobj instance void [common]TestUtil.TestLog::.ctor(object) + stloc.s testLog + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StartRecording() + + call void Run() + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StopRecording() + + ldloc.s testLog + callvirt instance int32 [common]TestUtil.TestLog::VerifyOutput() + + ret +} + + +.method public static void Run() +{ + .maxstack 1 + .try + { + ldstr "in try" + call void [System.Console]System.Console::WriteLine(string) + leave.s DONE + } + finally + { + ldstr "in finally" + call void [System.Console]System.Console::WriteLine(string) + + .try + { + TRY_1: + ldstr " in try 1" + call void [System.Console]System.Console::WriteLine(string) + leave.s TRY_2 + } + finally + { + ldstr " in finally 1" + call void [System.Console]System.Console::WriteLine(string) + endfinally + } + + ldstr "*** UNREACHABLE ***" + call void [System.Console]System.Console::WriteLine(string) + + .try + { + TRY_2: + ldstr " in try 2" + call void [System.Console]System.Console::WriteLine(string) + leave.s FINALLY_END + } + finally + { + ldstr " in finally 2" + call void [System.Console]System.Console::WriteLine(string) + endfinally + } + + FINALLY_END: + endfinally + } + + DONE: ret +} diff --git a/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinfinally.ilproj b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinfinally.ilproj new file mode 100644 index 0000000000..6087e57d72 --- /dev/null +++ b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinfinally.ilproj @@ -0,0 +1,45 @@ +<?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> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + </PropertyGroup> + <ItemGroup> + <Compile Include="nonlocalexitinfinally.il" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\common\common.csproj" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinhandler.il b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinhandler.il new file mode 100644 index 0000000000..6330844fdd --- /dev/null +++ b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinhandler.il @@ -0,0 +1,126 @@ + + + +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly extern mscorlib {} +.assembly extern common {} +.assembly test {} +.module nonlocalexitinhandler.exe + + +.method public static int32 Main() +{ + .entrypoint + .maxstack 2 + .locals init ( + class [mscorlib]System.IO.StringWriter expectedOut, + class [common]TestUtil.TestLog testLog + ) + + + newobj instance void [mscorlib]System.IO.StringWriter::.ctor() + stloc.s expectedOut + ldloc.s expectedOut + ldstr "in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "in filter" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "in handler" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try 1" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in finally 1" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try 2" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in finally 2" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + newobj instance void [common]TestUtil.TestLog::.ctor(object) + stloc.s testLog + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StartRecording() + + call void Run() + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StopRecording() + + ldloc.s testLog + callvirt instance int32 [common]TestUtil.TestLog::VerifyOutput() + + ret +} + + +.method public static void Run() +{ + .maxstack 1 + .try + { + ldstr "in try" + call void [System.Console]System.Console::WriteLine(string) + newobj instance void [mscorlib]System.Exception::.ctor() + throw + leave.s DONE + } + filter + { + pop + ldstr "in filter" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4.1 + endfilter + } { + pop + ldstr "in handler" + call void [System.Console]System.Console::WriteLine(string) + + .try + { + TRY_1: + ldstr " in try 1" + call void [System.Console]System.Console::WriteLine(string) + leave.s TRY_2 + } + finally + { + ldstr " in finally 1" + call void [System.Console]System.Console::WriteLine(string) + endfinally + } + + ldstr "*** UNREACHABLE ***" + call void [System.Console]System.Console::WriteLine(string) + + .try + { + TRY_2: + ldstr " in try 2" + call void [System.Console]System.Console::WriteLine(string) + leave.s HANDLER_END + } + finally + { + ldstr " in finally 2" + call void [System.Console]System.Console::WriteLine(string) + endfinally + } + + HANDLER_END: + leave.s DONE + } + + DONE: ret +} diff --git a/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinhandler.ilproj b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinhandler.ilproj new file mode 100644 index 0000000000..2acfbf7fff --- /dev/null +++ b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinhandler.ilproj @@ -0,0 +1,45 @@ +<?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> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + </PropertyGroup> + <ItemGroup> + <Compile Include="nonlocalexitinhandler.il" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\common\common.csproj" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinroot.il b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinroot.il new file mode 100644 index 0000000000..56e010aa42 --- /dev/null +++ b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinroot.il @@ -0,0 +1,94 @@ + + + +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly extern mscorlib {} +.assembly extern common {} +.assembly test {} +.module nonlocalexitinroot.exe + + +.method public static int32 Main() +{ + .entrypoint + .maxstack 2 + .locals init ( + class [mscorlib]System.IO.StringWriter expectedOut, + class [common]TestUtil.TestLog testLog + ) + + + newobj instance void [mscorlib]System.IO.StringWriter::.ctor() + stloc.s expectedOut + ldloc.s expectedOut + ldstr "in try 1" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "in finally 1" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "in try 2" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "in finally 2" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + newobj instance void [common]TestUtil.TestLog::.ctor(object) + stloc.s testLog + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StartRecording() + + call void Run() + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StopRecording() + + ldloc.s testLog + callvirt instance int32 [common]TestUtil.TestLog::VerifyOutput() + + ret +} + + +.method public static void Run() +{ + .maxstack 1 + + .try + { + TRY_1: + ldstr "in try 1" + call void [System.Console]System.Console::WriteLine(string) + leave.s TRY_2 + } + finally + { + ldstr "in finally 1" + call void [System.Console]System.Console::WriteLine(string) + endfinally + } + + ldstr "*** UNREACHABLE ***" + call void [System.Console]System.Console::WriteLine(string) + + .try + { + TRY_2: + ldstr "in try 2" + call void [System.Console]System.Console::WriteLine(string) + leave.s DONE + } + finally + { + ldstr "in finally 2" + call void [System.Console]System.Console::WriteLine(string) + endfinally + } + + DONE: ret +} diff --git a/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinroot.ilproj b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinroot.ilproj new file mode 100644 index 0000000000..5bb22cfbd3 --- /dev/null +++ b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitinroot.ilproj @@ -0,0 +1,45 @@ +<?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> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + </PropertyGroup> + <ItemGroup> + <Compile Include="nonlocalexitinroot.il" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\common\common.csproj" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitintry.il b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitintry.il new file mode 100644 index 0000000000..dd791cd19f --- /dev/null +++ b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitintry.il @@ -0,0 +1,118 @@ + + + +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly extern mscorlib {} +.assembly extern common {} +.assembly test {} +.module nonlocalexitintry.exe + + +.method public static int32 Main() +{ + .entrypoint + .maxstack 2 + .locals init ( + class [mscorlib]System.IO.StringWriter expectedOut, + class [common]TestUtil.TestLog testLog + ) + + + newobj instance void [mscorlib]System.IO.StringWriter::.ctor() + stloc.s expectedOut + ldloc.s expectedOut + ldstr "in try" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try 1" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in finally 1" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in try 2" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr " in finally 2" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + ldstr "in catch" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldloc.s expectedOut + newobj instance void [common]TestUtil.TestLog::.ctor(object) + stloc.s testLog + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StartRecording() + + call void Run() + + ldloc.s testLog + callvirt instance void [common]TestUtil.TestLog::StopRecording() + + ldloc.s testLog + callvirt instance int32 [common]TestUtil.TestLog::VerifyOutput() + + ret +} + + +.method public static void Run() +{ + .maxstack 1 + .try + { + ldstr "in try" + call void [System.Console]System.Console::WriteLine(string) + + .try + { + TRY_1: + ldstr " in try 1" + call void [System.Console]System.Console::WriteLine(string) + leave.s TRY_2 + } + finally + { + ldstr " in finally 1" + call void [System.Console]System.Console::WriteLine(string) + endfinally + } + + ldstr "*** UNREACHABLE ***" + call void [System.Console]System.Console::WriteLine(string) + + .try + { + TRY_2: + ldstr " in try 2" + call void [System.Console]System.Console::WriteLine(string) + leave.s TRY_END + } + finally + { + ldstr " in finally 2" + call void [System.Console]System.Console::WriteLine(string) + endfinally + } + + TRY_END: + newobj instance void [mscorlib]System.Exception::.ctor() + throw + leave.s DONE + + } + catch [mscorlib]System.Exception + { + pop + ldstr "in catch" + call void [System.Console]System.Console::WriteLine(string) + leave.s DONE + } + + DONE: ret +} diff --git a/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitintry.ilproj b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitintry.ilproj new file mode 100644 index 0000000000..e8a6662d24 --- /dev/null +++ b/tests/src/JIT/jit64/eh/finallyexec/nonlocalexitintry.ilproj @@ -0,0 +1,45 @@ +<?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> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT .0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + </PropertyGroup> + <ItemGroup> + <Compile Include="nonlocalexitintry.il" /> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\common\common.csproj" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> |