diff options
Diffstat (limited to 'tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271')
27 files changed, 1443 insertions, 0 deletions
diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/app.config b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/app.config new file mode 100644 index 0000000000..e5622f77ad --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/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> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/bigdat.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/bigdat.il new file mode 100644 index 0000000000..53c9656764 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/bigdat.il @@ -0,0 +1,36 @@ +// 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 System.Console { } +.assembly BIGDAT {} +.assembly extern mscorlib{} +.module BIGDAT +.class public 'BIGDAT' +{ + .class nested private ansi explicit WS_TYPE + { + .field [100000008] public object EXCEPTION_OBJECT_00000242 + .size 100000016 + .method public specialname rtspecialname instance void .ctor () + { + ldarg.0 + call instance void object ::.ctor () + ret + } + } + .field static private class BIGDAT/WS_TYPE WS_DATA + + .method static public int32 BIGDAT() + { + .entrypoint + newobj instance void BIGDAT/WS_TYPE::.ctor () + stsfld class BIGDAT/WS_TYPE BIGDAT::WS_DATA + + ldstr "Pass" + call void [System.Console]System.Console::WriteLine(string) + + ldc.i4 100 + ret + } +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/bigdat.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/bigdat.ilproj new file mode 100644 index 0000000000..7a51b5def7 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/bigdat.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>bigdat</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="bigdat.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test10.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test10.il new file mode 100644 index 0000000000..73fc6001e9 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test10.il @@ -0,0 +1,59 @@ +// 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 System.Console { } +// non-blittable by objref field, large offset +.assembly test10{} +.assembly extern mscorlib{} + +.class public explicit Class1 extends [mscorlib]System.Object{ + .field [0] public int32 i1 + .field [8] public object o1 + .field [0x200008] public int32 i2 + + + .method public specialname rtspecialname void .ctor(){ + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} + +.method public static int32 Main(){ + .entrypoint + + .locals init(class Class1 c1) + + newobj instance void Class1::.ctor() + stloc.0 + + + + ldstr "hello" + call void [System.Console]System.Console::WriteLine(string) + + ldloc.0 + ldc.i4.1 + stfld int32 Class1::i1 + + + ldloc.0 + ldc.i4.2 + stfld int32 Class1::i2 + + + ldstr "field i1: {0}, i2: {1}\n\nPASS" + ldloc.0 + ldfld int32 Class1::i1 + box int32 + ldloc.0 + ldfld int32 Class1::i2 + box int32 + call void [System.Console]System.Console::WriteLine(string,object,object) + + + ldc.i4 100 + ret +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test10.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test10.ilproj new file mode 100644 index 0000000000..f6d9d4be36 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test10.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>test10</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="test10.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test11.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test11.il new file mode 100644 index 0000000000..da7b5793f1 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test11.il @@ -0,0 +1,60 @@ +// 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 System.Console { } +// non-blittable by objref field, really large offset, and force GC collect +.assembly test10{} +.assembly extern mscorlib{} + +.class public explicit Class1 extends [mscorlib]System.Object{ + .field [0] public int32 i1 + .field [8] public object o1 + .field [0x2000008] public int32 i2 + + + .method public specialname rtspecialname void .ctor(){ + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} + +.method public static int32 Main(){ + .entrypoint + + .locals init(class Class1 c1) + + newobj instance void Class1::.ctor() + stloc.0 + + + + ldstr "hello" + call void [System.Console]System.Console::WriteLine(string) + + ldloc.0 + ldc.i4.1 + stfld int32 Class1::i1 + + + ldloc.0 + ldc.i4.2 + stfld int32 Class1::i2 + + call void [mscorlib]System.GC::Collect() + + + ldstr "field i1: {0}, i2: {1}\n\nGC COLLECTED\n\nPASS" + ldloc.0 + ldfld int32 Class1::i1 + box int32 + ldloc.0 + ldfld int32 Class1::i2 + box int32 + call void [System.Console]System.Console::WriteLine(string,object,object) + + ldc.i4 100 + ret +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test11.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test11.ilproj new file mode 100644 index 0000000000..818b4430df --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test11.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>test11</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="test11.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test13.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test13.il new file mode 100644 index 0000000000..2e77e1b7ea --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test13.il @@ -0,0 +1,63 @@ +// 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 System.Console { } +// non-blittable by objref field, large offset, large field size +.assembly test13{} +.assembly extern mscorlib{} + +.class public explicit sealed LargeClass extends [mscorlib]System.ValueType{ + .size 0x200000 +} + +.class public explicit Class1 extends [mscorlib]System.Object{ + .field [0] public int32 i1 + .field [8] public object o1 + .field [16] public int32 i2 + .field [0x200008] public valuetype LargeClass lc + + + .method public specialname rtspecialname void .ctor(){ + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} + +.method public static int32 Main(){ + .entrypoint + + .locals init(class Class1 c1) + + newobj instance void Class1::.ctor() + stloc.0 + + + + ldstr "hello" + call void [System.Console]System.Console::WriteLine(string) + + ldloc.0 + ldc.i4.1 + stfld int32 Class1::i1 + + + ldloc.0 + ldc.i4.2 + stfld int32 Class1::i2 + + + ldstr "field i1: {0}, i2: {1}\n\nPASS" + ldloc.0 + ldfld int32 Class1::i1 + box int32 + ldloc.0 + ldfld int32 Class1::i2 + box int32 + call void [System.Console]System.Console::WriteLine(string,object,object) + + ldc.i4 100 + ret +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test13.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test13.ilproj new file mode 100644 index 0000000000..01ad44f665 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test13.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>test13</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="test13.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test14.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test14.il new file mode 100644 index 0000000000..bc962a3a96 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test14.il @@ -0,0 +1,63 @@ +// 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 System.Console { } +// non-blittable by objref field, small offset, large field size +.assembly test14{} +.assembly extern mscorlib{} + +.class public explicit sealed LargeClass extends [mscorlib]System.ValueType{ + .size 0x200000 +} + +.class public explicit Class1 extends [mscorlib]System.Object{ + .field [0] public int32 i1 + .field [8] public object o1 + .field [16] public int32 i2 + .field [24] public valuetype LargeClass lc + + .method public specialname rtspecialname void .ctor(){ + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} + +.method public static int32 Main(){ + .entrypoint + + .locals init(class Class1 c1) + + newobj instance void Class1::.ctor() + stloc.0 + + + + ldstr "hello" + call void [System.Console]System.Console::WriteLine(string) + + ldloc.0 + ldc.i4.1 + stfld int32 Class1::i1 + + + ldloc.0 + ldc.i4.2 + stfld int32 Class1::i2 + + + ldstr "field i1: {0}, i2: {1}\n\nPASS" + ldloc.0 + ldfld int32 Class1::i1 + box int32 + ldloc.0 + ldfld int32 Class1::i2 + box int32 + call void [System.Console]System.Console::WriteLine(string,object,object) + + ldc.i4 100 + ret + +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test14.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test14.ilproj new file mode 100644 index 0000000000..434c38e97c --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test14.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>test14</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="test14.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test15.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test15.il new file mode 100644 index 0000000000..d8e85a6514 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test15.il @@ -0,0 +1,63 @@ +// 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 System.Console { } +// blittable, small offset, large field size +.assembly test15{} +.assembly extern mscorlib{} + +.class public explicit sealed LargeClass extends [mscorlib]System.ValueType{ + .size 0x200000 +} + +.class public explicit Class1 extends [mscorlib]System.Object{ + .field [0] public int32 i1 + .field [8] public int32 i2 + .field [16] public valuetype LargeClass lc + + + .method public specialname rtspecialname void .ctor(){ + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} + +.method public static int32 Main(){ + .entrypoint + + .locals init(class Class1 c1) + + newobj instance void Class1::.ctor() + stloc.0 + + + + ldstr "hello" + call void [System.Console]System.Console::WriteLine(string) + + ldloc.0 + ldc.i4.1 + stfld int32 Class1::i1 + + + ldloc.0 + ldc.i4.2 + stfld int32 Class1::i2 + + + ldstr "field i1: {0}, i2: {1}\n\nPASS" + ldloc.0 + ldfld int32 Class1::i1 + box int32 + ldloc.0 + ldfld int32 Class1::i2 + box int32 + call void [System.Console]System.Console::WriteLine(string,object,object) + + ldc.i4 100 + ret + +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test15.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test15.ilproj new file mode 100644 index 0000000000..d58ef035cc --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test15.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>test15</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="test15.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test16.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test16.il new file mode 100644 index 0000000000..66a3e2e351 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test16.il @@ -0,0 +1,110 @@ +// 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 System.Console { } +// non-blittable by objref field, small offset, large field size, overlapping objref field +.assembly test16{} +.assembly extern mscorlib{} + +.class public explicit sealed LargeClass extends [mscorlib]System.ValueType{ + .size 0x20000000 // REALLY large, >5 zeros +} + +.class public explicit Class1 extends [mscorlib]System.Object{ + .field [0] public int32 i1 + .field [0] public object o1 + .field [8] public int32 i2 + .field [16] public valuetype LargeClass lc + + + .method public specialname rtspecialname void .ctor(){ + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} + +.method public static int32 Main(){ + .entrypoint + + .locals init (class [mscorlib]System.Exception e2) + + .try{ + call void Go() + ldstr "FAIL: expected TypeLoadException, but no exception was caught" + call void [System.Console]System.Console::WriteLine(string) + leave NOT_CAUGHT + } + catch [mscorlib]System.TypeLoadException{ + pop // throw away the exception object + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + leave CAUGHT_EXPECTED + } + + // on some machines with low memory we will get OutOfMemoryException + catch [mscorlib]System.OutOfMemoryException{ + pop // throw away the exception object + + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + leave CAUGHT_EXPECTED + } + catch [mscorlib]System.Exception{ + stloc e2 + ldstr "FAIL: expected TypeLoadException, but instead caught the following:\n{0}" + ldloc e2 + call void [System.Console]System.Console::WriteLine(string,object) + leave CAUGHT_UNEXPECTED + } + + NOT_CAUGHT: + ldc.i4 101 + br END + + CAUGHT_EXPECTED: + ldc.i4 100 + br END + + CAUGHT_UNEXPECTED: + ldc.i4 102 + br END + + END: + ret +} + +.method public static void Go(){ + .locals init(class Class1 c1) + + newobj instance void Class1::.ctor() + stloc.0 + + + + ldstr "hello" + call void [System.Console]System.Console::WriteLine(string) + + ldloc.0 + ldc.i4.1 + stfld int32 Class1::i1 + + + ldloc.0 + ldc.i4.2 + stfld int32 Class1::i2 + + + ldstr "field i1: {0}, i2: {1}\n\nPASS" + ldloc.0 + ldfld int32 Class1::i1 + box int32 + ldloc.0 + ldfld int32 Class1::i2 + box int32 + call void [System.Console]System.Console::WriteLine(string,object,object) + + ret +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test16.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test16.ilproj new file mode 100644 index 0000000000..9d5b45d097 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test16.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>test16</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="test16.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test2.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test2.il new file mode 100644 index 0000000000..60eeeb5795 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test2.il @@ -0,0 +1,58 @@ +// 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 System.Console { } +// blittable, large field offset. +// this case never caused a stack overflow. +// this test simply ensures continued correct behavior. +.assembly test2{} +.assembly extern mscorlib{} + +.class public explicit Class1 extends [mscorlib]System.Object{ + .field [0] public int32 i1 + .field [0x200004] public int32 i2 + + .method public specialname rtspecialname void .ctor(){ + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } +} + +.method public static int32 Main(){ + .entrypoint + + .locals init(class Class1 c1) + + newobj instance void Class1::.ctor() + stloc.0 + + + + ldstr "hello" + call void [System.Console]System.Console::WriteLine(string) + + ldloc.0 + ldc.i4.1 + stfld int32 Class1::i1 + + + ldloc.0 + ldc.i4.2 + stfld int32 Class1::i2 + + + ldstr "field i1: {0}, i2: {1}\n\n PASS" + ldloc.0 + ldfld int32 Class1::i1 + box int32 + ldloc.0 + ldfld int32 Class1::i2 + box int32 + call void [System.Console]System.Console::WriteLine(string,object,object) + + ldc.i4 100 + ret + +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test2.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test2.ilproj new file mode 100644 index 0000000000..4eb2b3bd49 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test2.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>test2</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="test2.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test21.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test21.il new file mode 100644 index 0000000000..76cc321213 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test21.il @@ -0,0 +1,88 @@ +// 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 System.Console { } +// valuetype non-blittable by objref field, large offset, small field size, overlapped objref +.assembly test21{} +.assembly extern mscorlib{} + +.class public explicit sealed Class1 extends [mscorlib]System.ValueType{ + .field [0] public int32 i1 + .field [0] public object o1 + .field [0x200004] public int32 i2 + +} + +.method public static int32 Main(){ + .entrypoint + + .locals init (class [mscorlib]System.Exception e2) + + .try{ + call void Go() + ldstr "FAIL: expected TypeLoadException, but no exception was caught" + call void [System.Console]System.Console::WriteLine(string) + leave NOT_CAUGHT + } + catch [mscorlib]System.TypeLoadException{ + pop // throw away the exception object + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + leave CAUGHT_EXPECTED + } + catch [mscorlib]System.Exception{ + stloc e2 + ldstr "FAIL: expected TypeLoadException, but instead caught the following:\n{0}" + ldloc e2 + call void [System.Console]System.Console::WriteLine(string,object) + leave CAUGHT_UNEXPECTED + } + + NOT_CAUGHT: + ldc.i4 101 + br END + + CAUGHT_EXPECTED: + ldc.i4 100 + br END + + CAUGHT_UNEXPECTED: + ldc.i4 102 + br END + + END: + ret +} + +.method public static void Go(){ + .locals init(valuetype Class1 c1) + + ldloca c1 + initobj Class1 + + + ldstr "hello" + call void [System.Console]System.Console::WriteLine(string) + + ldloca c1 + ldc.i4.1 + stfld int32 Class1::i1 + + + ldloca c1 + ldc.i4.2 + stfld int32 Class1::i2 + + + ldstr "field i1: {0}, i2: {1}\n\nPASS" + ldloca c1 + ldfld int32 Class1::i1 + box int32 + ldloca c1 + ldfld int32 Class1::i2 + box int32 + call void [System.Console]System.Console::WriteLine(string,object,object) + + ret +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test21.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test21.ilproj new file mode 100644 index 0000000000..38fa8aadee --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test21.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>test21</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="test21.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test23.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test23.il new file mode 100644 index 0000000000..fe0d3fe23d --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test23.il @@ -0,0 +1,67 @@ +// 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 System.Console { } +// non-blittable by objref field, large offset, large field size, +// one field is a valuetype that has an objref member field +// (this is to hit EEClass::CheckValueClassLayout()) +.assembly test23{} +.assembly extern mscorlib{} + +.class public explicit sealed LargeClass extends [mscorlib]System.ValueType{ + .field [0] public object o1 + .size 0x200004 +} + +.class public explicit Class1 extends [mscorlib]System.Object{ + .field [0] public int32 i1 + .field [8] public object o1 + .field [16] public int32 i2 + .field [24] public valuetype LargeClass lc + + + .method public specialname rtspecialname void .ctor(){ + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} + +.method public static int32 Main(){ + .entrypoint + + .locals init(class Class1 c1) + + newobj instance void Class1::.ctor() + stloc.0 + + + + ldstr "hello" + call void [System.Console]System.Console::WriteLine(string) + + ldloc.0 + ldc.i4.1 + stfld int32 Class1::i1 + + + ldloc.0 + ldc.i4.2 + stfld int32 Class1::i2 + + + ldstr "field i1: {0}, i2: {1}\n\nPASS" + ldloc.0 + ldfld int32 Class1::i1 + box int32 + ldloc.0 + ldfld int32 Class1::i2 + box int32 + call void [System.Console]System.Console::WriteLine(string,object,object) + + ldc.i4 100 + ret + +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test23.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test23.ilproj new file mode 100644 index 0000000000..250af5cb79 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test23.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>test23</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="test23.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test24.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test24.il new file mode 100644 index 0000000000..3bd0ee8e6a --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test24.il @@ -0,0 +1,64 @@ +// 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 System.Console { } +// sequential, non-blittable by objref field, large offset, large field size +.assembly test24{} +.assembly extern mscorlib{} + +.class public explicit sealed LargeClass extends [mscorlib]System.ValueType{ + .size 0x200000 +} + +.class public sequential Class1 extends [mscorlib]System.Object{ + .field [0] public int32 i1 +// .field [4] public object o1 + .field [8] public int32 i2 + .field [16] public valuetype LargeClass lc + + + .method public specialname rtspecialname void .ctor(){ + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} + +.method public static int32 Main(){ + .entrypoint + + .locals init(class Class1 c1) + + newobj instance void Class1::.ctor() + stloc.0 + + + + ldstr "hello" + call void [System.Console]System.Console::WriteLine(string) + + ldloc.0 + ldc.i4.1 + stfld int32 Class1::i1 + + + ldloc.0 + ldc.i4.2 + stfld int32 Class1::i2 + + + ldstr "field i1: {0}, i2: {1}\n\nPASS" + ldloc.0 + ldfld int32 Class1::i1 + box int32 + ldloc.0 + ldfld int32 Class1::i2 + box int32 + call void [System.Console]System.Console::WriteLine(string,object,object) + + ldc.i4 100 + ret + +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test24.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test24.ilproj new file mode 100644 index 0000000000..54de5b6084 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test24.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>test24</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="test24.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test3.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test3.il new file mode 100644 index 0000000000..bacccfd1f4 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test3.il @@ -0,0 +1,95 @@ +// 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 System.Console { } +// blittable, absurdly large field offset, expect TypeLoadException +.assembly test3{} +.assembly extern mscorlib{} + +.class public explicit Class1 extends [mscorlib]System.Object{ + .field [0] public int32 i1 + .field [1073741824] public int32 i2 // offset: 1024*1024*1024 + + .method public specialname rtspecialname void .ctor(){ + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} + + +.method public static int32 Main(){ + .entrypoint + + .locals init (class [mscorlib]System.Exception e2) + + .try{ + call void Go() + ldstr "FAIL: expected TypeLoadException, but no exception was caught" + call void [System.Console]System.Console::WriteLine(string) + leave NOT_CAUGHT + } + catch [mscorlib]System.TypeLoadException{ + pop // throw away the exception object + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + leave CAUGHT_EXPECTED + } + catch [mscorlib]System.Exception{ + stloc e2 + ldstr "FAIL: expected TypeLoadException, but instead caught the following:\n{0}" + ldloc e2 + call void [System.Console]System.Console::WriteLine(string,object) + leave CAUGHT_UNEXPECTED + } + + NOT_CAUGHT: + ldc.i4 101 + br END + + CAUGHT_EXPECTED: + ldc.i4 100 + br END + + CAUGHT_UNEXPECTED: + ldc.i4 102 + br END + + END: + ret +} + +.method public static void Go(){ + .locals init(class Class1 c1) + + newobj instance void Class1::.ctor() + stloc.0 + + + + ldstr "hello" + call void [System.Console]System.Console::WriteLine(string) + + ldloc.0 + ldc.i4.1 + stfld int32 Class1::i1 + + + ldloc.0 + ldc.i4.2 + stfld int32 Class1::i2 + + + ldstr "field i1: {0}, i2: {1}\n\nPASS" + ldloc.0 + ldfld int32 Class1::i1 + box int32 + ldloc.0 + ldfld int32 Class1::i2 + box int32 + call void [System.Console]System.Console::WriteLine(string,object,object) + + ret +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test3.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test3.ilproj new file mode 100644 index 0000000000..2142b2f298 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test3.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>test3</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="test3.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test9.il b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test9.il new file mode 100644 index 0000000000..35c8094a59 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test9.il @@ -0,0 +1,96 @@ +// 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 System.Console { } +// non-blittable by objref field, objref overlaps int32, large offset +.assembly test9{} +.assembly extern mscorlib{} + +.class public explicit Class1 extends [mscorlib]System.Object{ + .field [0] public int32 i1 + .field [0] public object o1 + .field [0x200008] public int32 i2 + + + .method public specialname rtspecialname void .ctor(){ + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } + +} + +.method public static int32 Main(){ + .entrypoint + + .locals init (class [mscorlib]System.Exception e2) + + .try{ + call void Go() + ldstr "FAIL: expected TypeLoadException, but no exception was caught" + call void [System.Console]System.Console::WriteLine(string) + leave NOT_CAUGHT + } + catch [mscorlib]System.TypeLoadException{ + pop // throw away the exception object + ldstr "PASS" + call void [System.Console]System.Console::WriteLine(string) + leave CAUGHT_EXPECTED + } + catch [mscorlib]System.Exception{ + stloc e2 + ldstr "FAIL: expected TypeLoadException, but instead caught the following:\n{0}" + ldloc e2 + call void [System.Console]System.Console::WriteLine(string,object) + leave CAUGHT_UNEXPECTED + } + + NOT_CAUGHT: + ldc.i4 101 + br END + + CAUGHT_EXPECTED: + ldc.i4 100 + br END + + CAUGHT_UNEXPECTED: + ldc.i4 102 + br END + + END: + ret +} + +.method public static void Go(){ + .locals init(class Class1 c1) + + newobj instance void Class1::.ctor() + stloc.0 + + + + ldstr "hello" + call void [System.Console]System.Console::WriteLine(string) + + ldloc.0 + ldc.i4.1 + stfld int32 Class1::i1 + + + ldloc.0 + ldc.i4.2 + stfld int32 Class1::i2 + + + ldstr "field i1: {0}, i2: {1}\n\nPASS" + ldloc.0 + ldfld int32 Class1::i1 + box int32 + ldloc.0 + ldfld int32 Class1::i2 + box int32 + call void [System.Console]System.Console::WriteLine(string,object,object) + + ret +} diff --git a/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test9.ilproj b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test9.ilproj new file mode 100644 index 0000000000..c252413031 --- /dev/null +++ b/tests/src/Loader/classloader/explicitlayout/Regressions/ASURT/ASURT150271/test9.ilproj @@ -0,0 +1,38 @@ +<?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> + <AssemblyName>test9</AssemblyName> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <AllowUnsafeBlocks>true</AllowUnsafeBlocks> + <ReferenceLocalMscorlib>true</ReferenceLocalMscorlib> + <OutputType>Exe</OutputType> + <CLRTestKind>BuildAndRun</CLRTestKind> + <CLRTestPriority>0</CLRTestPriority> + </PropertyGroup> + + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + + <ItemGroup> + <Compile Include="test9.il" /> + </ItemGroup> + + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> +</Project> |