summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/jit/importer.cpp60
-rw-r--r--tests/src/JIT/opt/Inline/regression/mismatch32/app.config27
-rw-r--r--tests/src/JIT/opt/Inline/regression/mismatch32/mismatch32.il52
-rw-r--r--tests/src/JIT/opt/Inline/regression/mismatch32/mismatch32.ilproj48
-rw-r--r--tests/src/JIT/opt/Inline/regression/mismatch64/app.config27
-rw-r--r--tests/src/JIT/opt/Inline/regression/mismatch64/mismatch64.il52
-rw-r--r--tests/src/JIT/opt/Inline/regression/mismatch64/mismatch64.ilproj48
7 files changed, 254 insertions, 60 deletions
diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp
index 9cc9aa11e7..abcf396920 100644
--- a/src/jit/importer.cpp
+++ b/src/jit/importer.cpp
@@ -950,66 +950,6 @@ GenTreeArgList* Compiler::impPopList(unsigned count,
info.compCompHnd->classMustBeLoadedBeforeCodeIsRun(argRealClass);
}
-#ifdef DEBUG
- // Ensure that IL is half-way sane (what was pushed is what the function expected)
- var_types argType = genActualType(args->Current()->TypeGet());
- unsigned argSize = genTypeSize(argType);
- if (varTypeIsStruct(argType))
- {
- if (args->Current()->gtOper == GT_LDOBJ)
- argSize = info.compCompHnd->getClassSize(args->Current()->gtLdObj.gtClass);
- else if (args->Current()->gtOper == GT_MKREFANY)
- argSize = 2 * sizeof(void*);
- else if (args->Current()->gtOper == GT_RET_EXPR)
- {
- CORINFO_SIG_INFO *callArgs = &args->Current()->gtRetExpr.gtInlineCandidate->gtCall.gtInlineCandidateInfo->methInfo.args;
- assert(callArgs->retType == CORINFO_TYPE_VALUECLASS);
- argSize = info.compCompHnd->getClassSize(callArgs->retTypeClass);
- }
- else if (args->Current()->gtOper == GT_LCL_VAR)
- {
- argSize = lvaLclSize(args->Current()->gtLclVarCommon.gtLclNum);
- }
- else if (args->Current()->gtOper == GT_CALL)
- {
- if (args->Current()->gtCall.gtInlineCandidateInfo)
- {
- CORINFO_SIG_INFO *callArgs = &args->Current()->gtCall.gtInlineCandidateInfo->methInfo.args;
- assert(callArgs->retType == CORINFO_TYPE_VALUECLASS);
- argSize = info.compCompHnd->getClassSize(callArgs->retTypeClass);
- }
- else if (!(args->Current()->gtCall.gtCallMoreFlags & GTF_CALL_M_RETBUFFARG))
- {
- assert((var_types)args->Current()->gtCall.gtReturnType != TYP_STRUCT);
- argSize = genTypeSize((var_types)args->Current()->gtCall.gtReturnType);
- }
- else
- {
- // No easy way to recover the return type size, so just give up
- goto SKIP_SIZE_CHECK;
- }
- }
- else
- {
- assert(!"Unexpeced tree node with type TYP_STRUCT");
- goto SKIP_SIZE_CHECK;
- }
- }
-
- sigSize = compGetTypeSize(corType, argClass);
- if (argSize != sigSize)
- {
- var_types sigType = genActualType(JITtype2varType(corType));
- char buff[400];
- sprintf_s(buff, sizeof(buff), "Arg type mismatch: Wanted %s (size %d), Got %s (size %d) for call at IL offset 0x%x\n",
- varTypeName(sigType), sigSize, varTypeName(argType), argSize, impCurOpcOffs);
- assertAbort(buff, __FILE__, __LINE__);
- }
-
-SKIP_SIZE_CHECK:
-
-#endif // DEBUG
-
argLst = info.compCompHnd->getArgNext(argLst);
}
}
diff --git a/tests/src/JIT/opt/Inline/regression/mismatch32/app.config b/tests/src/JIT/opt/Inline/regression/mismatch32/app.config
new file mode 100644
index 0000000000..8077c95440
--- /dev/null
+++ b/tests/src/JIT/opt/Inline/regression/mismatch32/app.config
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration> \ No newline at end of file
diff --git a/tests/src/JIT/opt/Inline/regression/mismatch32/mismatch32.il b/tests/src/JIT/opt/Inline/regression/mismatch32/mismatch32.il
new file mode 100644
index 0000000000..e23b0a8346
--- /dev/null
+++ b/tests/src/JIT/opt/Inline/regression/mismatch32/mismatch32.il
@@ -0,0 +1,52 @@
+// 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.
+
+// When the jit considers inlining B it can get itself into
+// trouble because of the type mismatch. This test tries to
+// ensure the jit backs out of the inline successfully.
+
+.assembly extern mscorlib { }
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly main {}
+.module main.exe
+
+.class public sealed F extends System.ValueType
+{
+
+.method public instance void .ctor()
+{
+ ret
+}
+
+.field public string A
+}
+
+.method private static int32 B(int32 X, int32 Y)
+{
+ ldarg.0
+ ret
+}
+
+.method public hidebysig static int32 Main(string[] args) cil managed
+{
+ .entrypoint
+ .locals init (valuetype F v_0)
+ ldarg.0
+ ldlen
+ ldc.i4 1
+ bgt DONE
+ newobj instance void F::.ctor()
+ ldc.i4 33
+ call int32 B(int32, int32)
+ pop
+
+DONE:
+
+ ldc.i4 100
+ ret
+}
diff --git a/tests/src/JIT/opt/Inline/regression/mismatch32/mismatch32.ilproj b/tests/src/JIT/opt/Inline/regression/mismatch32/mismatch32.ilproj
new file mode 100644
index 0000000000..f29406291f
--- /dev/null
+++ b/tests/src/JIT/opt/Inline/regression/mismatch32/mismatch32.ilproj
@@ -0,0 +1,48 @@
+<?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\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ <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="mismatch32.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" />
+ <None Include="app.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file
diff --git a/tests/src/JIT/opt/Inline/regression/mismatch64/app.config b/tests/src/JIT/opt/Inline/regression/mismatch64/app.config
new file mode 100644
index 0000000000..8077c95440
--- /dev/null
+++ b/tests/src/JIT/opt/Inline/regression/mismatch64/app.config
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration> \ No newline at end of file
diff --git a/tests/src/JIT/opt/Inline/regression/mismatch64/mismatch64.il b/tests/src/JIT/opt/Inline/regression/mismatch64/mismatch64.il
new file mode 100644
index 0000000000..f952856909
--- /dev/null
+++ b/tests/src/JIT/opt/Inline/regression/mismatch64/mismatch64.il
@@ -0,0 +1,52 @@
+// 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.
+
+// When the jit considers inlining B it can get itself into
+// trouble because of the type mismatch. This test tries to
+// ensure the jit backs out of the inline successfully.
+
+.assembly extern mscorlib { }
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+.assembly main {}
+.module main.exe
+
+.class public sealed F extends System.ValueType
+{
+
+.method public instance void .ctor()
+{
+ ret
+}
+
+.field public string A
+}
+
+.method private static int64 B(int64 X, int64 Y)
+{
+ ldarg.0
+ ret
+}
+
+.method public hidebysig static int32 Main(string[] args) cil managed
+{
+ .entrypoint
+ .locals init (valuetype F v_0)
+ ldarg.0
+ ldlen
+ ldc.i4 1
+ bgt DONE
+ newobj instance void F::.ctor()
+ ldc.i8 44
+ call int64 B(int64, int64)
+ pop
+
+DONE:
+
+ ldc.i4 100
+ ret
+}
diff --git a/tests/src/JIT/opt/Inline/regression/mismatch64/mismatch64.ilproj b/tests/src/JIT/opt/Inline/regression/mismatch64/mismatch64.ilproj
new file mode 100644
index 0000000000..73984e1fa8
--- /dev/null
+++ b/tests/src/JIT/opt/Inline/regression/mismatch64/mismatch64.ilproj
@@ -0,0 +1,48 @@
+<?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\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ <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="mismatch64.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" />
+ <None Include="app.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project> \ No newline at end of file