}
else
{
- assert(didMerge);
- JITDUMP("Method had try-finallys and some callfinally merges were performed.\n");
+ if (didMerge)
+ {
+ JITDUMP("Method had mergeable try-finallys and some callfinally merges were performed.\n");
#if DEBUG
+ if (verbose)
+ {
+ printf("\n*************** After fgMergeFinallyChains()\n");
+ fgDispBasicBlocks();
+ fgDispHandlerTab();
+ printf("\n");
+ }
- if (verbose)
+#endif // DEBUG
+ }
+ else
{
- printf("\n*************** After fgMergeFinallyChains()\n");
- fgDispBasicBlocks();
- fgDispHandlerTab();
- printf("\n");
+ // We may not end up doing any merges, because we are only
+ // merging continuations for callfinallys that can
+ // actually be invoked, and the importer may leave
+ // unreachable callfinallys around (for instance, if it
+ // is forced to re-import a leave).
+ JITDUMP("Method had mergeable try-finallys but no callfinally merges were performed,\n"
+ "likely the non-canonical callfinallys were unreachable\n");
}
-
-#endif // DEBUG
}
}
// If the block already jumps to the canoncial call finally, no work needed.
if (block->bbJumpDest == canonicalCallFinally)
{
+ JITDUMP("BB%02u already canonical\n", block->bbNum);
return false;
}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+.assembly extern mscorlib {}
+.assembly a {}
+.module a.exe
+
+// Test case triggers reimportation of a leave,
+// leading to an unreachable callfinally pair.
+
+.class FinallyReimp
+{
+.method static int32 Main(class [mscorlib]System.String[]) cil managed
+{
+ .entrypoint
+ .locals init (int32 V0, native int V1)
+ .try
+ {
+ ldarg.0
+ ldlen
+ ldc.i4 1
+ beq FOO
+ ldloca V0
+ br JOIN
+FOO:
+ ldc.i4 0
+JOIN:
+ stloc V1
+ leave AFTER
+ }
+ finally
+ {
+ ldc.i4 100
+ stloc.0
+ endfinally
+ }
+AFTER:
+ ldloc.1
+ ldind.i
+ ret
+}
+}
+
--- /dev/null
+<?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>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="GitHub_9651.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>