diff options
Diffstat (limited to 'tests/src/JIT/Directed/PREFIX/unaligned/1')
32 files changed, 3036 insertions, 0 deletions
diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/Box_Unbox.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/Box_Unbox.il new file mode 100644 index 0000000000..44aa92f614 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/Box_Unbox.il @@ -0,0 +1,126 @@ +// 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 legacy library mscorlib {} +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly box_unbox{} + +//####################################### +//# -- valClass -- ################################# +//####################################### +.class public value sealed valClass { +//--------------------------# +// String used in testing -# +//--------------------------# +//--------------------------# +// Fields -# +//--------------------------# +.field int32 Field1 +.field float32 Field2 +//---------------------------# +//- Initialization routine -# +//---------------------------# +.method void _init() { +.maxstack 4 +// -- store a value in int32 Field1 + ldarg 0 + ldc.i4 0xFF + unaligned. 0x1 + stfld int32 valClass::Field1 + +// -- store a value in float32 Field2 + ldarg 0 + ldc.r4 float32(0x00ABCDEF) + unaligned. 0x1 + stfld float32 valClass::Field2 + +// -- initialization complete... return + ret +} + +//----------------------------# +//- Return the string at RVA -# +//- TestString -# +//- This overrides -# +//- Object.ToString -# +//----------------------------# +.method public virtual class [mscorlib]System.String ToString() { +.maxstack 4 +// -- load the string at RVA TestString _and return it + ldstr "Some Test String" + + + ret +} + + + +//####################### +//# -- BOX_UNBOX -- ############################################### +//####################### + +} +.class public Box_Unbox { +//--------------------------# +// String used in testing -# +// should be the same as -# +// the string used in -# +// valClass -# +//--------------------------# +//--------------------------# +// ref to valClass -# +//--------------------------# +.field static value class valClass vc +//--------------------------# +// entry point -# +//--------------------------# +.method static int32 main(class [mscorlib]System.String[]) { +.entrypoint +.maxstack 10 +// -- initialize the val class + ldsflda value class valClass Box_Unbox::vc + call instance void valClass::_init() +// -- see if Field1 of valClass has the correct value + ldsflda value class valClass Box_Unbox::vc + unaligned. 0x1 + ldfld int32 valClass::Field1 + ldc.i4 0xFF + ceq + brfalse FAIL +// -- see if Field2 of valClass has the correct value + ldsflda value class valClass Box_Unbox::vc + unaligned. 0x1 + ldfld float32 valClass::Field2 + ldc.r4 float32(0x00ABCDEF) + ceq + brfalse FAIL +// -- get the constant string from valClass _and +// -- compare it to the constant string in this +// -- if they are _not the same. FAIL + ldsfld value class valClass Box_Unbox::vc + box valClass + callvirt instance class [mscorlib]System.String [mscorlib]System.Object::ToString() + ldstr "Some Test String" + + + callvirt instance bool [mscorlib]System.String::Equals(class [mscorlib]System.String) + brfalse FAIL + +// -- PASS -- +PASS: + ldc.i4 0x64 + ret + +// -- FAIL -- +FAIL: + ldc.i4 0x0 + ret + +} +} +// --------------------------------------------------------- diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/Box_Unbox.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/Box_Unbox.ilproj new file mode 100644 index 0000000000..17f5fe8b4f --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/Box_Unbox.ilproj @@ -0,0 +1,40 @@ +<?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> + <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="Box_Unbox.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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/Desktop/add.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/Desktop/add.il new file mode 100644 index 0000000000..53a30e5fae --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/Desktop/add.il @@ -0,0 +1,121 @@ +// 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 legacy library mscorlib {} +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly 'add'{ + //This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration: + //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )] + } + +.class explicit _add { + +.field [0] int32 global0 +.field [4] int32 global1 + +.method public void .ctor() +{ +ret +} + +//------------------------- +// Entry point - Main - +//------------------------- +.method static int32 main(class [mscorlib]System.String[]) { +.entrypoint +.maxstack 6 +.locals init (class _add target) +//---------------- +// begin testing - +//---------------- + + // creating new instance of _add and storing it + newobj instance void _add::.ctor() + stloc.0 + + // -- I4 + I2 -- Make sure we can _add smaller types to larger types + ldc.i4 0xAABB + conv.i2 + ldc.i4 0x1111 + add + ldc.i4 0xFFFFBBCC + ceq + brfalse FAIL + // -- I4 + I4 -- + ldc.i4 0x11223344 + ldc.i4 0x11111111 + add + ldc.i4 0x22334455 + ceq + brfalse FAIL + + // -- I4 + & -- Managed ptr + + // -- I4 + * -- Unmanaged ptr + ldloc target + ldflda int32 _add::global0 + ldc.i4 0xAAAAAAAA + unaligned. 0x1 + stind.i4 + + ldloc target + ldflda int32 _add::global1 + ldc.i4 0x44444444 + unaligned. 0x1 + stind.i4 + + ldloc target + ldflda int32 _add::global0 + ldc.i4 0x4 + add + unaligned. 0x1 + ldind.i4 + ldc.i4 0x44444444 + ceq + brfalse FAIL + + // -- I8 + I8 -- + ldc.i8 0x0011223344556677 + ldc.i8 0x7766554433221100 + add + ldc.i8 0x7777777777777777 + ceq + brfalse FAIL + + // -- R4 + R4 -- + ldc.r4 float32(0x3F800000) + ldc.r4 float32(0x00000000) + add + ldc.r4 float32(0x3F800000) + ceq + brfalse FAIL + + // -- R8 + R8 -- + ldc.r8 float64(0xBFF0000000000000) + ldc.r8 float64(0x0000000000000000) + add + ldc.r8 float64(0xBFF0000000000000) + ceq + brfalse FAIL + + +//---------------- +PASS: + ldstr "Test SUCCESS" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4 0x64 + ret +//---------------- +FAIL: + ldstr "Test FAILED" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4 0x0 + ret +} +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/Desktop/add.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/Desktop/add.ilproj new file mode 100644 index 0000000000..6038771f5b --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/Desktop/add.ilproj @@ -0,0 +1,40 @@ +<?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> + <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="add.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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/add.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/add.il new file mode 100644 index 0000000000..53a30e5fae --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/add.il @@ -0,0 +1,121 @@ +// 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 legacy library mscorlib {} +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly 'add'{ + //This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration: + //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )] + } + +.class explicit _add { + +.field [0] int32 global0 +.field [4] int32 global1 + +.method public void .ctor() +{ +ret +} + +//------------------------- +// Entry point - Main - +//------------------------- +.method static int32 main(class [mscorlib]System.String[]) { +.entrypoint +.maxstack 6 +.locals init (class _add target) +//---------------- +// begin testing - +//---------------- + + // creating new instance of _add and storing it + newobj instance void _add::.ctor() + stloc.0 + + // -- I4 + I2 -- Make sure we can _add smaller types to larger types + ldc.i4 0xAABB + conv.i2 + ldc.i4 0x1111 + add + ldc.i4 0xFFFFBBCC + ceq + brfalse FAIL + // -- I4 + I4 -- + ldc.i4 0x11223344 + ldc.i4 0x11111111 + add + ldc.i4 0x22334455 + ceq + brfalse FAIL + + // -- I4 + & -- Managed ptr + + // -- I4 + * -- Unmanaged ptr + ldloc target + ldflda int32 _add::global0 + ldc.i4 0xAAAAAAAA + unaligned. 0x1 + stind.i4 + + ldloc target + ldflda int32 _add::global1 + ldc.i4 0x44444444 + unaligned. 0x1 + stind.i4 + + ldloc target + ldflda int32 _add::global0 + ldc.i4 0x4 + add + unaligned. 0x1 + ldind.i4 + ldc.i4 0x44444444 + ceq + brfalse FAIL + + // -- I8 + I8 -- + ldc.i8 0x0011223344556677 + ldc.i8 0x7766554433221100 + add + ldc.i8 0x7777777777777777 + ceq + brfalse FAIL + + // -- R4 + R4 -- + ldc.r4 float32(0x3F800000) + ldc.r4 float32(0x00000000) + add + ldc.r4 float32(0x3F800000) + ceq + brfalse FAIL + + // -- R8 + R8 -- + ldc.r8 float64(0xBFF0000000000000) + ldc.r8 float64(0x0000000000000000) + add + ldc.r8 float64(0xBFF0000000000000) + ceq + brfalse FAIL + + +//---------------- +PASS: + ldstr "Test SUCCESS" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4 0x64 + ret +//---------------- +FAIL: + ldstr "Test FAILED" + call void [System.Console]System.Console::WriteLine(string) + ldc.i4 0x0 + ret +} +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/add.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/add.ilproj new file mode 100644 index 0000000000..7d99b09f4a --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/add.ilproj @@ -0,0 +1,40 @@ +<?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> + <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></DebugType> + </PropertyGroup> + <ItemGroup> + <Compile Include="add.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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/arglist.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/arglist.il new file mode 100644 index 0000000000..9b993bfcd6 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/arglist.il @@ -0,0 +1,111 @@ +// 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. + + +/* +CompareArgs() works as such: + +CompareArgs(3,1,2,3,1,2,3) +Where arg0 is 1/2 the number of the +remaining arguments. + +And the arguments 1,2,3 and 1,2,3 are +treated as two separate lists of size +arg0 whose elements are compared to one +another. + +ie. in this case CompareArgs checks that +arg1==arg4, arg2==arg5, arg3==arg6. +*/ + +.assembly extern legacy library mscorlib {} +.assembly arglist.exe{ //This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration: + //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )] + } + +.method static vararg int32 CompareArgs(int32){ +.locals(int32 currentindex, int32 loopconstant) +.maxstack 10 +.try{ + ldc.i4 1 + stloc currentindex + ldarg 0 + stloc loopconstant +LOOP: ldloc currentindex + ldc.i4 4 + mul + arglist + add + unaligned. 0x1 + ldind.i4 + ldloc currentindex + ldloc loopconstant + add + ldc.i4 4 + mul + arglist + add + unaligned. 0x1 + ldind.i4 + ceq + brfalse EXITWITHFAIL + ldloc currentindex + ldloc loopconstant + beq EXITWITHPASS + ldc.i4 1 + ldloc currentindex + add + stloc currentindex + br LOOP + EXITWITHPASS: + leave SUCCESS + EXITWITHFAIL: + leave FAIL +}catch [mscorlib]System.NullReferenceException{ + pop + leave FAIL +} +SUCCESS: + ldc.i4 0x64 + ret +FAIL: + ldc.i4 0x0 +REALLYDONE: + ret +} + +//------------------------- +// Entry point - Main - +//------------------------- +.method static int32 main() { +.entrypoint +.locals () +.maxstack 10 + + ldc.i4 1 + ldc.i4 1 + ldc.i4 1 + call vararg int32 CompareArgs(int32,...,int32,int32) + brfalse FAIL + + ldc.i4 4 + ldc.i4 2 + ldc.i4 3 + ldc.i4 4 + ldc.i4 5 + ldc.i4 2 + ldc.i4 3 + ldc.i4 4 + ldc.i4 5 + call vararg int32 CompareArgs(int32,...,int32,int32,int32,int32,int32,int32,int32,int32) + brfalse FAIL + + +PASS: + ldc.i4 0x64 + ret +FAIL: + ldc.i4 0x0 + ret +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/arglist.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/arglist.ilproj new file mode 100644 index 0000000000..fac158928f --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/arglist.ilproj @@ -0,0 +1,43 @@ +<?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> + <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 Condition="'$(BuildArch)' == 'x86'" Include="arglist.il" /> + <Compile Condition="'$(BuildArch)' == 'x64'" Include="arglist64.il" /> + <Compile Condition="'$(BuildArch)' == 'arm'" Include="arglistARM.il" /> + <Compile Condition="'$(BuildArch)' == 'arm64'" Include="arglist64.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> diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/arglist64.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/arglist64.il new file mode 100644 index 0000000000..54822dd73d --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/arglist64.il @@ -0,0 +1,121 @@ +// 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. + + +/* +CompareArgs() works as such: + +CompareArgs(3,1,2,3,1,2,3) +Where arg0 is 1/2 the number of the +remaining arguments. + +And the arguments 1,2,3 and 1,2,3 are +treated as two separate lists of size +arg0 whose elements are compared to one +another. + +ie. in this case CompareArgs checks that +arg1==arg4, arg2==arg5, arg3==arg6. +*/ + +.assembly extern legacy library mscorlib {} +.assembly arglist.exe{ //This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration: + //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )] + } + +/* +CompareArgs(5,1,2,3,4,5,1,2,3,4,5) +arglist on x86: 5,4,3,2,1,5,4,3,2,1,5 + ^ index 1 +arglist on ia64: 5,1,2,3,4,5,1,2,3,4,5 + ^ index 1 +*/ + +.method static vararg int32 CompareArgs(int32){ +.locals(int32 currentindex, int32 loopconstant) +.maxstack 10 +.try{ + ldc.i4 2 + stloc currentindex + ldarg 0 + stloc loopconstant +LOOP: ldloc currentindex + ldc.i4 8 + mul + arglist + add + unaligned. 0x1 + ldind.i4 + ldloc currentindex + ldloc loopconstant + add + ldc.i4 8 + mul + arglist + add + unaligned. 0x1 + ldind.i4 + ceq + brfalse EXITWITHFAIL + ldloc currentindex + ldloc loopconstant + ldc.i4 1 + add + beq EXITWITHPASS + ldc.i4 1 + ldloc currentindex + add + stloc currentindex + br LOOP + EXITWITHPASS: + leave SUCCESS + EXITWITHFAIL: + leave FAIL +}catch [mscorlib]System.NullReferenceException{ + pop + leave FAIL +} +SUCCESS: + ldc.i4 0x64 + ret +FAIL: + ldc.i4 0x0 +REALLYDONE: + ret +} + +//------------------------- +// Entry point - Main - +//------------------------- +.method static int32 main() { +.entrypoint +.locals () +.maxstack 10 + + ldc.i4 1 + ldc.i4 1 + ldc.i4 1 + call vararg int32 CompareArgs(int32,...,int32,int32) + brfalse FAIL + + ldc.i4 4 + ldc.i4 2 + ldc.i4 3 + ldc.i4 4 + ldc.i4 5 + ldc.i4 2 + ldc.i4 3 + ldc.i4 4 + ldc.i4 5 + call vararg int32 CompareArgs(int32,...,int32,int32,int32,int32,int32,int32,int32,int32) + brfalse FAIL + + +PASS: + ldc.i4 0x64 + ret +FAIL: + ldc.i4 0x0 + ret +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/arglistARM.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/arglistARM.il new file mode 100644 index 0000000000..86c23ca4b9 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/arglistARM.il @@ -0,0 +1,122 @@ +// 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. + + +/* +CompareArgs() works as such: + +CompareArgs(3,1,2,3,1,2,3) +Where arg0 is 1/2 the number of the +remaining arguments. + +And the arguments 1,2,3 and 1,2,3 are +treated as two separate lists of size +arg0 whose elements are compared to one +another. + +ie. in this case CompareArgs checks that +arg1==arg4, arg2==arg5, arg3==arg6. + +The vararg cookie in the case of x86 and ARM +is after/before the declared arguments respectively: +(from Compiler::lvaInitTypeRef() in lclvars.cpp) +x86 args look something like this: +[this ptr] [hidden return buffer] [declared arguments]* [generic context] [var arg cookie] +ARM is closer to the native ABI: +[hidden return buffer] [this ptr] [generic context] [var arg cookie] [declared arguments]* + +*/ + +.assembly extern legacy library mscorlib {} +.assembly arglist.exe{ //This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration: + //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )] + } + +.method static vararg int32 CompareArgs(int32){ +.locals(int32 currentindex, int32 loopconstant) +.maxstack 10 +.try{ + ldc.i4 2 + stloc currentindex + ldarg 0 + stloc loopconstant +LOOP: ldloc currentindex + ldc.i4 4 + mul + arglist + add + unaligned. 0x1 + ldind.i4 + ldloc currentindex + ldloc loopconstant + add + ldc.i4 4 + mul + arglist + add + unaligned. 0x1 + ldind.i4 + ceq + brfalse EXITWITHFAIL + ldloc currentindex + ldloc loopconstant + ldc.i4 1 + add + beq EXITWITHPASS + ldc.i4 1 + ldloc currentindex + add + stloc currentindex + br LOOP + EXITWITHPASS: + leave SUCCESS + EXITWITHFAIL: + leave FAIL +}catch [mscorlib]System.NullReferenceException{ + pop + leave FAIL +} +SUCCESS: + ldc.i4 0x64 + ret +FAIL: + ldc.i4 0x0 +REALLYDONE: + ret +} + +//------------------------- +// Entry point - Main - +//------------------------- +.method static int32 main() { +.entrypoint +.locals () +.maxstack 10 + + ldc.i4 1 + ldc.i4 1 + ldc.i4 1 + call vararg int32 CompareArgs(int32,...,int32,int32) + brfalse FAIL + + ldc.i4 4 + ldc.i4 2 + ldc.i4 3 + ldc.i4 4 + ldc.i4 5 + ldc.i4 2 + ldc.i4 3 + ldc.i4 4 + ldc.i4 5 + call vararg int32 CompareArgs(int32,...,int32,int32,int32,int32,int32,int32,int32,int32) + brfalse FAIL + + +PASS: + ldc.i4 0x64 + ret +FAIL: + ldc.i4 0x0 + ret +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/array_tests.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/array_tests.il new file mode 100644 index 0000000000..cb97ea6d6f --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/array_tests.il @@ -0,0 +1,333 @@ +// 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 legacy library mscorlib {} +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly array_tests{} + +.class value sealed valClass { + .field int32 Field +} + +.class array_tests { + +.field static int8[] i1 +.field static unsigned int8[] u1 +.field static int16[] i2 +.field static unsigned int16[] u2 +.field static int32[] i4 +.field static int64[] i8 +.field static float32[] r4 +.field static float64[] r8 +.field static class array_tests[] obj +.field static value class valClass[] val + +.field static native int[] i + +//------------------------- +// Constructor - +//------------------------- +.method void .ctor() { + +.maxstack 10 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret +} + + +//------------------------- +// Initialize - +//------------------------- +.method static void initialize() { +.maxstack 10 +.locals (int32, value class valClass) + + ldc.i4 0x00000004 + newarr [mscorlib]System.SByte + stsfld int8[] array_tests::i1 + + ldc.i4 0x00000004 + newarr [mscorlib]System.Byte + stsfld unsigned int8[] array_tests::u1 + + ldc.i4 0x00000004 + newarr [mscorlib]System.Int16 + stsfld int16[] array_tests::i2 + + ldc.i4 0x00000004 + newarr [mscorlib]System.UInt16 + stsfld unsigned int16[] array_tests::u2 + + ldc.i4 0x00000004 + newarr [mscorlib]System.Int32 + stsfld int32[] array_tests::i4 + + ldc.i4 0x00000004 + newarr [mscorlib]System.Int64 + stsfld int64[] array_tests::i8 + + ldc.i4 0x00000004 + newarr [mscorlib]System.Single + stsfld float32[] array_tests::r4 + + ldc.i4 0x00000004 + newarr [mscorlib]System.Double + stsfld float64[] array_tests::r8 + + ldc.i4 0x00000004 + newarr array_tests + stsfld class array_tests[] array_tests::obj + + ldc.i4 0x00000004 + newarr valClass + stsfld value class valClass[] array_tests::val + + ldc.i4 0x00000004 + newarr [mscorlib]System.IntPtr + stsfld native int[] array_tests::i + +//--------------------------------- + +BEGIN: + ldc.i4 0x00000000 + stloc 0 + +LOOP: + // -- initialize 4 element array of i1 -- + ldsfld int8[] array_tests::i1 + ldloc 0 + dup + ldc.i4 0x10 + add + stelem.i1 + // -- initialize 4 element array of u1 -- + ldsfld unsigned int8[] array_tests::u1 + ldloc 0 + dup + ldc.i4 0x10 + add + stelem.i1 + // -- initialize 4 element array of i2 -- + ldsfld int16[] array_tests::i2 + ldloc 0 + dup + ldc.i4 0x1000 + add + stelem.i2 + // -- initialize 4 element array of u2 -- + ldsfld unsigned int16[] array_tests::u2 + ldloc 0 + dup + ldc.i4 0x1000 + add + stelem.i2 + // -- initialize 4 element array of i4 -- + ldsfld int32[] array_tests::i4 + ldloc 0 + dup + ldc.i4 0x10000000 + add + stelem.i4 + // -- initialize 4 element array of i8 -- + ldsfld int64[] array_tests::i8 + ldloc 0 + dup + conv.i8 + ldc.i8 0x1000000000000000 + add + stelem.i8 + // -- initialize 4 element array of r4 -- + ldsfld float32[] array_tests::r4 + ldloc 0 + dup + conv.r4 + ldc.r4 float32(0x00000000) + add + stelem.r4 + // -- initialize 4 element array of r8 -- + ldsfld float64[] array_tests::r8 + ldloc 0 + dup + conv.r8 + ldc.r8 float64(0x0000000000000000) + add + stelem.r8 + // -- initialize class array_tests array -- + ldsfld class array_tests[] array_tests::obj + ldloc 0 + newobj instance void array_tests::.ctor() + stelem.ref + // -- initialize value class valClass array -- + ldsfld value class valClass[] array_tests::val + ldloc 0x0 + ldelema valClass + ldloc 0x1 + stobj valClass + + // -- initialize 4 element array of i -- + ldsfld native int[] array_tests::i + ldloc 0 + dup + ldc.i4 0x10000000 + add + // THIS WILL FAIL NON-32 BIT MACHINES!!!!!! + stelem.i +//------------- + + ldloc 0 + ldc.i4 0x00000003 + ceq + brtrue END + ldloc 0 + ldc.i4 0x00000001 + add + stloc 0 + br LOOP +END: + ret +} + +//------------------------- +// Entry point - Main - +//------------------------- +.method static int32 main(class [mscorlib]System.String[]) { +.entrypoint +.maxstack 10 +.locals (int32) +//---------------- +// begin testing - +//---------------- + call void array_tests::initialize() +//---------------- +BEGIN: + ldc.i4 0x00 + stloc 0 +//--------------------------------- +LOOP: + ldsfld int8[] array_tests::i1 + ldloc 0 + ldelem.i1 + ldloc 0 + ldc.i4 0x00000010 + add + ceq + brfalse FAIL + //---------------- + ldsfld unsigned int8[] array_tests::u1 + ldloc 0 + ldelem.u1 + ldloc 0 + ldc.i4 0x00000010 + add + ceq + brfalse FAIL + //---------------- + ldsfld int16[] array_tests::i2 + ldloc 0 + ldelem.i2 + ldloc 0 + ldc.i4 0x00001000 + add + ceq + brfalse FAIL + //---------------- + ldsfld unsigned int16[] array_tests::u2 + ldloc 0 + ldelem.u2 + ldloc 0 + ldc.i4 0x00001000 + add + ceq + brfalse FAIL + //---------------- + ldsfld int32[] array_tests::i4 + ldloc 0 + ldelem.i4 + ldloc 0 + ldc.i4 0x10000000 + add + ceq + brfalse FAIL + //---------------- + ldsfld int64[] array_tests::i8 + ldloc 0 + ldelem.i8 + ldloc 0 + conv.i8 + ldc.i8 0x1000000000000000 + add + ceq + brfalse FAIL + //---------------- + ldsfld float32[] array_tests::r4 + ldloc 0 + ldelem.r4 + ldloc 0 + conv.r4 + ldc.r4 float32(0x00000000) + add + ceq + brfalse FAIL + //---------------- + ldsfld float64[] array_tests::r8 + ldloc 0 + ldelem.r8 + ldloc 0 + conv.r8 + ldc.r8 float64(0x0000000000000000) + add + ceq + brfalse FAIL + //---------------- + ldsfld class array_tests[] array_tests::obj + ldloc 0 + ldelem.ref + isinst array_tests + brfalse FAIL + //---------------- + ldsfld value class valClass[] array_tests::val + ldloc 0 + ldelema valClass + unaligned. 1 + ldobj valClass + box valClass + isinst valClass + brfalse FAIL + + ldsfld native int[] array_tests::i + ldloc 0 + //WARNING - THIS WILL FAIL ON NON-32 BIT MACHINES!!! + ldelem.i + ldloc 0 + ldc.i4 0x10000000 + add + ceq + brfalse FAIL +//---------------------------------- + ldloc 0 + ldc.i4 0x00000003 + ceq + brtrue PASS + ldloc 0 + ldc.i4 0x00000001 + add + stloc 0 + br LOOP + + +//---------------- +PASS: + ldc.i4 0x64 + ret +//---------------- +FAIL: + ldc.i4 0x0 + ret +} +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/array_tests.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/array_tests.ilproj new file mode 100644 index 0000000000..728d48bbb7 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/array_tests.ilproj @@ -0,0 +1,40 @@ +<?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> + <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="array_tests.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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/cpblk.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/cpblk.il new file mode 100644 index 0000000000..af7e8b3d39 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/cpblk.il @@ -0,0 +1,111 @@ +// 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 legacy library mscorlib {} +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly 'cpblk'{ +//This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration: + //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )] + } + + + +.class _cpblk { + +//------------------------- +// Global Data - +//------------------------- + +// .data DATA = int32(0) +// .data int32(0) + + .field static int32 DATA + .field static int32 DATA2 + +//------------------------- +// initialization routine - +//------------------------- +.method static int32 initialize() { + // -- init first 4 bytes to 0xAAAAAAAA + ldsflda int32 _cpblk::DATA + ldc.i4 0xAA + ldc.i4 4 + unaligned. 0x1 + initblk + // -- init next 4 bytes to 0xFFFFFFFF + ldsflda int32 _cpblk::DATA + ldc.i4 4 + add + ldc.i4 0xFF + ldc.i4 4 + unaligned. 0x1 + initblk + //-- be sure memory is properly initialized -- + ldsflda int32 _cpblk::DATA + ldind.i4 + ldc.i4 0xAAAAAAAA + ceq + brfalse FAIL + ldsflda int32 _cpblk::DATA + ldc.i4 4 + add + unaligned. 0x1 + ldind.i4 + ldc.i4 0xFFFFFFFF + ceq + brfalse FAIL + ldc.i4 0x00000001 + ret +FAIL: + ldc.i4 0x00000000 + ret +} + +//------------------------- +// Entry point - Main - +//------------------------- +.method static int32 main(class [mscorlib]System.String[]) { +.entrypoint +.maxstack 10 +//---------------- +// initialize - +//---------------- + call int32 _cpblk::initialize() + brfalse FAIL + +//---------------- +// begin testing - +//---------------- + // -- copy first chunk into second chunk + ldsflda int32 _cpblk::DATA + ldc.i4 4 + add + ldsflda int32 _cpblk::DATA + ldc.i4 4 + unaligned. 0x1 + cpblk + // -- Second chunk should now be 0xAAAAAAAA + ldsflda int32 _cpblk::DATA + ldc.i4 4 + add + unaligned. 0x1 + ldind.i4 + ldc.i4 0xAAAAAAAA + ceq + brfalse FAIL + +//---------------- +PASS: + ldc.i4 0x64 + ret +//---------------- +FAIL: + ldc.i4 0x0 + ret +} +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/cpblk.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/cpblk.ilproj new file mode 100644 index 0000000000..e029b51eef --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/cpblk.ilproj @@ -0,0 +1,40 @@ +<?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> + <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="cpblk.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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/cpobj.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/cpobj.il new file mode 100644 index 0000000000..ce8d56e6be --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/cpobj.il @@ -0,0 +1,142 @@ +// 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 +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} + +.assembly extern legacy library mscorlib {} +.assembly 'cpobj'{} + +.class public _cpobj { + +.field static value class valClass Instance1 +.field static value class valClass Instance2 + +.method static int32 main() { +.entrypoint +.locals (class [mscorlib]System.IO.TextWriter) +.maxstack 2 + call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out() + stloc 0 + + ldsflda value class valClass _cpobj::Instance1 + ldc.i4 0x89ABCDEF + unaligned. 0x1 + stfld int32 valClass::Field + ldc.i4 0x01234567 + stsfld int32 valClass::SField + ldsflda value class valClass _cpobj::Instance1 + unaligned. 0x1 + ldfld int32 valClass::Field + ldc.i4 0x89ABCDEF + ceq + brfalse Init1Failure + ldsfld int32 valClass::SField + ldc.i4 0x01234567 + ceq + brtrue InitInstance2 +Init1Failure: + ldloc 0 + ldstr "Initialization failure in instance 1" + + + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + br fail + +InitInstance2: + ldsflda value class valClass _cpobj::Instance2 + ldc.i4 0xABABABAB + unaligned. 0x1 + stfld int32 valClass::Field + ldsflda value class valClass _cpobj::Instance2 + unaligned. 0x1 + ldfld int32 valClass::Field + ldc.i4 0xABABABAB + ceq + brfalse Init2Failure + ldsfld int32 valClass::SField + ldc.i4 0x01234567 + ceq + brtrue CheckInst1Field +Init2Failure: + ldloc 0 + ldstr "Initialization failure in instance 2" + + + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + br fail + +CheckInst1Field: + ldsflda value class valClass _cpobj::Instance1 + unaligned. 0x1 + ldfld int32 valClass::Field + ldc.i4 0x89ABCDEF + ceq + brtrue cpobjTests + ldloc 0 + ldstr "Initialization failure in instance 1" + + + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + br fail + +cpobjTests: + ldsflda value class valClass _cpobj::Instance2 + ldsflda value class valClass _cpobj::Instance1 + cpobj valClass + ldsflda value class valClass _cpobj::Instance1 + unaligned. 0x1 + ldfld int32 valClass::Field + ldc.i4 0x89ABCDEF + ceq + brfalse cpobjFailure + ldsflda value class valClass _cpobj::Instance2 + unaligned. 0x1 + ldfld int32 valClass::Field + ldc.i4 0x89ABCDEF + ceq + brfalse cpobjFailure + ldsfld int32 valClass::SField + ldc.i4 0x01234567 + ceq + brtrue pass + +cpobjFailure: + ldloc 0 + ldstr "_cpobj failed. inst1 fields != inst2 fields" + + + + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + br fail + +pass: + ldloc 0 + ldstr "_cpobj tests PASS" + + + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldc.i4 0x64 + br end +fail: + ldloc 0 + ldstr "!!! FAILURE !!! CPOBJ TEST(S) HAVE FAILED !!! FAILURE !!!" + + + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldc.i4 0x0 + br end +end: + ret +} + + +} +.class public value sealed valClass { +.field int32 Field +.field static int32 SField +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/cpobj.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/cpobj.ilproj new file mode 100644 index 0000000000..a936ae2fb8 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/cpobj.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\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="cpobj.il" /> + </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/Directed/PREFIX/unaligned/1/field_tests.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/field_tests.il new file mode 100644 index 0000000000..a9d68e1ecc --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/field_tests.il @@ -0,0 +1,214 @@ +// 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 legacy library mscorlib {} +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly field_tests{} + +.class field_tests { + +.field int8 i1Field +.field int16 i2Field +.field int32 i4Field +.field int64 i8Field +.field float32 r4Field +.field float64 r8Field +.field class field_tests ptrField + +.field static int8 i1SField +.field static int16 i2SField +.field static int32 i4SField +.field static int64 i8SField +.field static float32 r4SField +.field static float64 r8SField +.field static class field_tests ptrSField + + +//------------------------- +// Constructor - +//------------------------- +.method void .ctor() { + +.maxstack 10 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret +} + +//------------------------- +// Initialize - +//------------------------- +.method void initialize() { +.maxstack 10 + + ldarg 0 + ldc.i4 0x1 + unaligned. 0x1 + stfld int8 field_tests::i1Field + //------ + ldarg 0 + ldc.i4 0x2 + unaligned. 0x1 + stfld int16 field_tests::i2Field + //------ + ldarg 0 + ldc.i4 0x4 + unaligned. 0x1 + stfld int32 field_tests::i4Field + //------ + ldarg 0 + ldc.i8 0x8 + unaligned. 0x1 + stfld int64 field_tests::i8Field + //------ + ldarg 0 + ldc.r4 4.4 + unaligned. 0x1 + stfld float32 field_tests::r4Field + //------ + ldarg 0 + ldc.r8 8.8 + unaligned. 0x1 + stfld float64 field_tests::r8Field + //------ + ldarg 0 + ldarg 0 + unaligned. 0x1 + stfld class field_tests field_tests::ptrField +//----------------- + ldc.i4 0x1 + stsfld int8 field_tests::i1SField + //------ + ldc.i4 0x2 + stsfld int16 field_tests::i2SField + //------ + ldc.i4 0x4 + stsfld int32 field_tests::i4SField + //------ + ldc.i8 0x8 + stsfld int64 field_tests::i8SField + //------ + ldc.r4 4.4 + stsfld float32 field_tests::r4SField + //------ + ldc.r8 8.8 + stsfld float64 field_tests::r8SField + //------ + ldarg 0 + stsfld class field_tests field_tests::ptrSField + + ret +} + +//------------------------- +// Entry point - Main - +//------------------------- +.method static int32 main(class [mscorlib]System.String[]) { +.entrypoint +.maxstack 10 +.locals (class field_tests) +//---------------- +// begin field_testsing - +//---------------- + newobj instance void field_tests::.ctor() + dup + stloc 0 + call instance void field_tests::initialize() + //------------ + ldloc 0 + unaligned. 0x1 + ldfld int8 field_tests::i1Field + ldc.i4 0x1 + ceq + brfalse FAIL + //----- + ldloc 0 + unaligned. 0x1 + ldfld int16 field_tests::i2Field + ldc.i4 0x2 + ceq + brfalse FAIL + //----- + ldloc 0 + unaligned. 0x1 + ldfld int32 field_tests::i4Field + ldc.i4 0x4 + ceq + brfalse FAIL + //----- + ldloc 0 + unaligned. 0x1 + ldfld int64 field_tests::i8Field + ldc.i8 0x8 + ceq + brfalse FAIL + //----- + ldloc 0 + unaligned. 0x1 + ldfld float32 field_tests::r4Field + ldc.r4 4.4 + ceq + brfalse FAIL + //----- + ldloc 0 + unaligned. 0x1 + ldfld float64 field_tests::r8Field + ldc.r8 8.8 + ceq + brfalse FAIL + //----- + ldloc 0 + unaligned. 0x1 + ldfld class field_tests field_tests::ptrField + isinst field_tests + brfalse FAIL +//-------------------------------- + ldsfld int8 field_tests::i1SField + ldc.i4 0x1 + ceq + brfalse FAIL + //----- + ldsfld int16 field_tests::i2SField + ldc.i4 0x2 + ceq + brfalse FAIL + //----- + ldsfld int32 field_tests::i4SField + ldc.i4 0x4 + ceq + brfalse FAIL + //----- + ldsfld int64 field_tests::i8SField + ldc.i8 0x8 + ceq + brfalse FAIL + //----- + ldsfld float32 field_tests::r4SField + ldc.r4 4.4 + ceq + brfalse FAIL + //----- + ldsfld float64 field_tests::r8SField + ldc.r8 8.8 + ceq + brfalse FAIL + //----- + ldsfld class field_tests field_tests::ptrSField + isinst field_tests + brfalse FAIL + +//---------------- +PASS: + ldc.i4 0x64 + ret +//---------------- +FAIL: + ldc.i4 0x0 + ret +} +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/field_tests.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/field_tests.ilproj new file mode 100644 index 0000000000..6e503944ca --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/field_tests.ilproj @@ -0,0 +1,40 @@ +<?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> + <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="field_tests.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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/fielda_tests.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/fielda_tests.il new file mode 100644 index 0000000000..fe219fd317 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/fielda_tests.il @@ -0,0 +1,235 @@ +// 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 legacy library mscorlib {} +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly fielda_tests{} + +.class field_tests { + +.field int8 i1Field +.field int16 i2Field +.field int32 i4Field +.field int64 i8Field +.field float32 r4Field +.field float64 r8Field +.field class field_tests ptrField + +.field static int8 i1SField +.field static int16 i2SField +.field static int32 i4SField +.field static int64 i8SField +.field static float32 r4SField +.field static float64 r8SField +.field static class field_tests ptrSField + + +//------------------------- +// Constructor - +//------------------------- +.method void .ctor() { + +.maxstack 10 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret +} + +//------------------------- +// Initialize - +//------------------------- +.method void initialize() { +.maxstack 10 + + ldarg 0 + ldc.i4 0x1 + unaligned. 0x1 + stfld int8 field_tests::i1Field + //------ + ldarg 0 + ldc.i4 0x2 + unaligned. 0x1 + stfld int16 field_tests::i2Field + //------ + ldarg 0 + ldc.i4 0x4 + unaligned. 0x1 + stfld int32 field_tests::i4Field + //------ + ldarg 0 + ldc.i8 0x8 + unaligned. 0x1 + stfld int64 field_tests::i8Field + //------ + ldarg 0 + ldc.r4 4.4 + unaligned. 0x1 + stfld float32 field_tests::r4Field + //------ + ldarg 0 + ldc.r8 8.8 + unaligned. 0x1 + stfld float64 field_tests::r8Field + //------ + ldarg 0 + ldarg 0 + unaligned. 0x1 + stfld class field_tests field_tests::ptrField +//----------------- + ldc.i4 0x1 + stsfld int8 field_tests::i1SField + //------ + ldc.i4 0x2 + stsfld int16 field_tests::i2SField + //------ + ldc.i4 0x4 + stsfld int32 field_tests::i4SField + //------ + ldc.i8 0x8 + stsfld int64 field_tests::i8SField + //------ + ldc.r4 4.4 + stsfld float32 field_tests::r4SField + //------ + ldc.r8 8.8 + stsfld float64 field_tests::r8SField + //------ + ldarg 0 + stsfld class field_tests field_tests::ptrSField + + + ret +} + +//------------------------- +// Entry point - Main - +//------------------------- +.method static int32 main(class [mscorlib]System.String[]) { +.entrypoint +.maxstack 10 +.locals (class field_tests) +//---------------- +// begin field_testsing - +//---------------- + newobj instance void field_tests::.ctor() + dup + stloc 0 + call instance void field_tests::initialize() + //------------ + ldloc 0 + ldflda int8 field_tests::i1Field + unaligned. 0x1 + ldind.i1 + ldc.i4 0x1 + ceq + brfalse FAIL + //----- + ldloc 0 + ldflda int16 field_tests::i2Field + unaligned. 0x1 + ldind.i2 + ldc.i4 0x2 + ceq + brfalse FAIL + //----- + ldloc 0 + ldflda int32 field_tests::i4Field + unaligned. 0x1 + ldind.i4 + ldc.i4 0x4 + ceq + brfalse FAIL + //----- + ldloc 0 + ldflda int64 field_tests::i8Field + unaligned. 0x1 + ldind.i8 + ldc.i8 0x8 + ceq + brfalse FAIL + //----- + ldloc 0 + ldflda float32 field_tests::r4Field + unaligned. 0x1 + ldind.r4 + ldc.r4 4.4 + ceq + brfalse FAIL + //----- + ldloc 0 + ldflda float64 field_tests::r8Field + unaligned. 0x1 + ldind.r8 + ldc.r8 8.8 + ceq + brfalse FAIL + //----- + ldloc 0 + ldflda class field_tests field_tests::ptrField + ldind.ref + isinst field_tests + brfalse FAIL +//-------------------------------- + ldsflda int8 field_tests::i1SField + unaligned. 0x1 + ldind.i1 + ldc.i4 0x1 + ceq + brfalse FAIL + //----- + ldsflda int16 field_tests::i2SField + unaligned. 0x1 + ldind.i2 + ldc.i4 0x2 + ceq + brfalse FAIL + //----- + ldsflda int32 field_tests::i4SField + unaligned. 0x1 + ldind.i4 + ldc.i4 0x4 + ceq + brfalse FAIL + //----- + ldsflda int64 field_tests::i8SField + unaligned. 0x1 + ldind.i8 + ldc.i8 0x8 + ceq + brfalse FAIL + //----- + ldsflda float32 field_tests::r4SField + unaligned. 0x1 + ldind.r4 + ldc.r4 4.4 + ceq + brfalse FAIL + //----- + ldsflda float64 field_tests::r8SField + unaligned. 0x1 + ldind.r8 + ldc.r8 8.8 + ceq + brfalse FAIL + //----- + ldsflda class field_tests field_tests::ptrSField + unaligned. 0x1 + ldind.ref + isinst field_tests + brfalse FAIL + +//---------------- +PASS: + ldc.i4 0x64 + ret +//---------------- +FAIL: + ldc.i4 0x0 + ret +} +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/fielda_tests.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/fielda_tests.ilproj new file mode 100644 index 0000000000..d69861314d --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/fielda_tests.ilproj @@ -0,0 +1,40 @@ +<?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> + <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="fielda_tests.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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/initblk.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/initblk.il new file mode 100644 index 0000000000..b4aeec08ff --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/initblk.il @@ -0,0 +1,53 @@ +// 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 legacy library mscorlib {} +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly initblk.exe{ //This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration: + //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )] + } + +.class _initblk { + + +// .data DATA = int32(0x00000000) + .field static int32 DATA + +//------------------------- +// Entry point - Main - +//------------------------- +.method static int32 main(class [mscorlib]System.String[]) { +.entrypoint +.maxstack 10 +//---------------- +// begin testing - +//---------------- + // -- init a 4 byte block of memory to 0xAAAAAAAA + ldsflda int32 _initblk::DATA + ldc.i4 0xAA + ldc.i4 4 + unaligned. 0x1 + initblk + // -- load the 4 bytes of memory _and be sure it is 0xAAAAAAAA + ldsflda int32 _initblk::DATA + unaligned. 0x1 + ldind.i4 + ldc.i4 0xAAAAAAAA + ceq + brfalse FAIL + +//---------------- +PASS: + ldc.i4 0x64 + ret +//---------------- +FAIL: + ldc.i4 0x0 + ret +} +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/initblk.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/initblk.ilproj new file mode 100644 index 0000000000..4f47047d18 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/initblk.ilproj @@ -0,0 +1,40 @@ +<?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> + <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="initblk.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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/initobj.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/initobj.il new file mode 100644 index 0000000000..c5d760b56c --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/initobj.il @@ -0,0 +1,137 @@ +// 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 legacy library mscorlib {} +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly initobj.exe{ //This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration: + //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )] + } + +.class public value sealed valClass{ + .field public int32 int32_Field + .field public static int32 int32_SField + .field public float32 float32_Field + .field public static float32 float32_SField + .field public int32* int32_ptr_Field + .field public static int32* int32_ptr_SField +} + +.class public _initoj { + + //------------------------- + // Entry point - Main - + //------------------------- + .method public static int32 main(class [mscorlib]System.String[]) { + .entrypoint + .locals (value class valClass, int32) + .maxstack 10 + //---------------- + // begin testing - + //---------------- + +//Set all valClass fields to a known state + ldloca 0 + ldc.i4 0xAB + unaligned. 0x1 + stfld int32 valClass::int32_Field + + ldc.i4 0xCD + stsfld int32 valClass::int32_SField + + ldloca 0 + ldc.r4 8.8 + unaligned. 0x1 + stfld float32 valClass::float32_Field + + ldc.r4 9.9 + stsfld float32 valClass::float32_SField + + ldloca 0 + ldloca 1 + unaligned. 0x1 + stfld int32* valClass::int32_ptr_Field + + ldloca 1 + stsfld int32* valClass::int32_ptr_SField + +//Check the state of all valClass fields to be sure they were initialized correctly + ldloc 0 + unaligned. 0x1 + ldfld int32 valClass::int32_Field + ldc.i4 0xAB + bne.un FAIL + + ldsfld int32 valClass::int32_SField + ldc.i4 0xCD + bne.un FAIL + + ldloc 0 + unaligned. 0x1 + ldfld float32 valClass::float32_Field + ldc.r4 8.8 + bne.un FAIL + + ldsfld float32 valClass::float32_SField + ldc.r4 9.9 + bne.un FAIL + + ldloc 0 + unaligned. 0x1 + ldfld int32* valClass::int32_ptr_Field + ldloca 1 + bne.un FAIL + + ldsfld int32* valClass::int32_ptr_SField + ldloca 1 + bne.un FAIL + +//Call initobj + ldloca 0 + initobj valClass + +//Make sure all fields are set to zero or null and all static fields are unchanged. + ldloc 0 + unaligned. 0x1 + ldfld int32 valClass::int32_Field + ldc.i4 0x0 + bne.un FAIL + + ldsfld int32 valClass::int32_SField + ldc.i4 0xCD + bne.un FAIL + + ldloc 0 + unaligned. 0x1 + ldfld float32 valClass::float32_Field + ldc.r4 0.0 + bne.un FAIL + + ldsfld float32 valClass::float32_SField + ldc.r4 9.9 + bne.un FAIL + + ldloc 0 + unaligned. 0x1 + ldfld int32* valClass::int32_ptr_Field + ldnull + bne.un FAIL + + ldsfld int32* valClass::int32_ptr_SField + ldloca 1 + bne.un FAIL + + + PASS: + ldc.i4 0x64 + ret + //---------------- + FAIL: + ldc.i4 0x0 + ret + } +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/initobj.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/initobj.ilproj new file mode 100644 index 0000000000..4907c7c3c1 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/initobj.ilproj @@ -0,0 +1,40 @@ +<?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> + <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="initobj.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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/ldind_stind.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/ldind_stind.il new file mode 100644 index 0000000000..183032da49 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/ldind_stind.il @@ -0,0 +1,152 @@ +// 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 legacy library mscorlib {} +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly ldind_stind.exe{ //This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration: + //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )] + } + +.class ldind_stind { + +//------------------------- +// Global Data - +//------------------------- +/* + .data I1 = int32(0x00000000) + + .data I2 = int32(0x00000000) + + .data I4 = int32(0x00000000) + + .data I8 = int64(0x0000000000000000) + + .data R4 = int32(0x00000000) + + .data R8 = int64(0x0000000000000000) + + .data I = int32(0xAAAAAAAA) +*/ + + .field static int32 I1 + .field static int32 I2 + .field static int32 I4 + .field static int64 I8 + .field static float32 R4 + .field static float64 R8 + .field static int32 I + + +//------------------------- +// Entry point - Main - +//------------------------- +.method static int32 main(class [mscorlib]System.String[]) { +.entrypoint +.maxstack 10 +//---------------- +// begin testing - +//---------------- +// --- Store values --- + ldsflda int32 ldind_stind::I1 + ldc.i4 0x00000011 + unaligned. 0x1 + stind.i1 + + ldsflda int32 ldind_stind::I2 + ldc.i4 0x00002222 + unaligned. 0x1 + stind.i2 + + ldsflda int32 ldind_stind::I4 + ldc.i4 0x44444444 + unaligned. 0x1 + stind.i4 + + ldsflda int64 ldind_stind::I8 + ldc.i8 0x8888888888888888 + unaligned. 0x1 + stind.i8 + + ldsflda float32 ldind_stind::R4 + ldc.r4 float32(0x3F800000) + unaligned. 0x1 + stind.r4 + + ldsflda float64 ldind_stind::R8 + ldc.r8 float64(0x3FF0000000000000) + unaligned. 0x1 + stind.r8 + + ldsflda int32 ldind_stind::I + ldsflda int32 ldind_stind::I + unaligned. 0x1 + stind.i + +//---------------------------------- + + ldsflda int32 ldind_stind::I1 + unaligned. 0x1 + ldind.i1 + ldc.i4 0x00000011 + ceq + brfalse FAIL + + ldsflda int32 ldind_stind::I2 + unaligned. 0x1 + ldind.i2 + ldc.i4 0x00002222 + ceq + brfalse FAIL + + ldsflda int32 ldind_stind::I4 + unaligned. 0x1 + ldind.i4 + ldc.i4 0x44444444 + ceq + brfalse FAIL + + ldsflda int64 ldind_stind::I8 + unaligned. 0x1 + ldind.i8 + ldc.i8 0x8888888888888888 + ceq + brfalse FAIL + + ldsflda float32 ldind_stind::R4 + unaligned. 0x1 + ldind.r4 + ldc.r4 float32(0x3F800000) + ceq + brfalse FAIL + + ldsflda float64 ldind_stind::R8 + unaligned. 0x1 + ldind.r8 + ldc.r8 float64(0x3FF0000000000000) + ceq + brfalse FAIL + + ldsflda int32 ldind_stind::I + unaligned. 0x1 + ldind.i + conv.i4 + ldsflda int32 ldind_stind::I + conv.i4 + ceq + brfalse FAIL + +//---------------- +PASS: + ldc.i4 0x64 + ret +//---------------- +FAIL: + ldc.i4 0x0 + ret +} +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/ldind_stind.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/ldind_stind.ilproj new file mode 100644 index 0000000000..0d66c870a4 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/ldind_stind.ilproj @@ -0,0 +1,40 @@ +<?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> + <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="ldind_stind.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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/ldloca.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/ldloca.il new file mode 100644 index 0000000000..422c799f74 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/ldloca.il @@ -0,0 +1,57 @@ +// 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 legacy library mscorlib {} +.assembly extern System.Console +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} +.assembly 'ldloca'{ + //This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration: + //[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )] + } + +.class _ldloca { +//------------------------- +// Entry point - Main - +//------------------------- +.method static int32 main(class [mscorlib]System.String[]) { +.entrypoint +.maxstack 10 +.locals (int32,int32&) +//---------------- +// begin testing - +//---------------- + ldloca 0 + stloc 1 + + ldc.i4 0xFF + stloc 0 + ldloc 1 + unaligned. 0x1 + ldind.i4 + ldc.i4 0xFF + ceq + brfalse FAIL + + ldc.i4 0xAA + stloc 0 + ldloc 1 + unaligned. 0x1 + ldind.i4 + ldc.i4 0xAA + ceq + brfalse FAIL + +//---------------- +PASS: + ldc.i4 0x64 + ret +//---------------- +FAIL: + ldc.i4 0x0 + ret +} +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/ldloca.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/ldloca.ilproj new file mode 100644 index 0000000000..5283e08701 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/ldloca.ilproj @@ -0,0 +1,40 @@ +<?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> + <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="ldloca.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>
\ No newline at end of file diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/ldobj.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/ldobj.il new file mode 100644 index 0000000000..491918f722 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/ldobj.il @@ -0,0 +1,132 @@ +// 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 +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} + +.assembly extern legacy library mscorlib {} +.assembly 'ldobj' { + } + + +.class public _ldobj { + +.method public static int32 main() { +.entrypoint +.locals (class [mscorlib]System.IO.TextWriter,value class valClass,value class valClass) +.maxstack 2 + call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out() + stloc 0 + + ldloca 1 + ldc.i4 0xFAFAFAFA + unaligned. 0x1 + stfld int32 valClass::Field + ldc.i4 0xDBDBDBDB + stsfld int32 valClass::SField + + ldloca 2 + ldc.i4 0x00000000 + unaligned. 0x1 + stfld int32 valClass::Field + + ldloca 1 + ldfld int32 valClass::Field + ldc.i4 0xFAFAFAFA + ceq + brfalse failInit + ldsfld int32 valClass::SField + ldc.i4 0xDBDBDBDB + ceq + brfalse failInit + ldloca 2 + unaligned. 0x1 + ldfld int32 valClass::Field + ldc.i4 0x00000000 + ceq + brtrue ldlocaTest +failInit: + ldloc 0 + ldstr "one _or both val classes failed initialization." + + + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + br fail + +ldlocaTest: + ldloca 1 + unaligned. 0x1 + ldobj valClass + + ldloca 2 + call void _ldobj::changeData(value class valClass,value class valClass*) + + ldloca 1 + unaligned. 0x1 + ldfld int32 valClass::Field + ldc.i4 0xFAFAFAFA + ceq + brfalse failTest + ldloca 2 + unaligned. 0x1 + ldfld int32 valClass::Field + ldc.i4 0xBBBBBBBB + ceq + brfalse failTest + ldsfld int32 valClass::SField + ldc.i4 0xDDDDDDDD + ceq + brtrue pass +failTest: + ldloc 0 + ldstr "failure after initialization." + + + + + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + br fail + +pass: + ldloc 0 + ldstr "_ldobj tests PASS" + + + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldc.i4 0x64 + br end +fail: + ldloc 0 + ldstr "!!! FAILURE !!! LDOBJ TEST(S) FAILED !!! FAILURE !!!" + + + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldc.i4 0x0 + br end +end: + ret +} + +.method public static void changeData(value class valClass,value class valClass*) { +.maxstack 2 + ldarga 0 + ldc.i4 0xBBBBBBBB + unaligned. 0x1 + stfld int32 valClass::Field + ldc.i4 0xDDDDDDDD + stsfld int32 valClass::SField + ldarg 1 + ldarga 0 + cpobj valClass + ret +} + +} +.class public value sealed valClass { +.field public int32 Field +.field public static int32 SField +} diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/ldobj.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/ldobj.ilproj new file mode 100644 index 0000000000..d914f68568 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/ldobj.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\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="ldobj.il" /> + </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/Directed/PREFIX/unaligned/1/localloc.il b/tests/src/JIT/Directed/PREFIX/unaligned/1/localloc.il new file mode 100644 index 0000000000..9548b3e8a5 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/localloc.il @@ -0,0 +1,130 @@ +// 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 +{ + .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) + .ver 4:0:0:0 +} + +.assembly extern legacy library mscorlib {} +.assembly 'localloc' { + } + + + +.class _localloc { + +.method void .ctor() { + +.maxstack 10 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret +} + +.method static int32 main(string[]) { +.locals (class [mscorlib]System.IO.TextWriter,int32*,int32,class [mscorlib]System.Text.StringBuilder,int32,string) +.entrypoint + call class [mscorlib]System.IO.TextWriter [System.Console]System.Console::get_Out() + stloc 0 + ldc.i4 0x0 + stloc 2 + newobj instance void [mscorlib]System.Text.StringBuilder::.ctor() + stloc 3 + +TryStart: + ldc.i4 0xFF + localloc + stloc 1 + +LOOP0: + ldloc 2 + ldc.i4 0xFF + bgt END0 + + ldloc 1 + ldloc 2 + add + + ldloc 2 + conv.i1 + unaligned. 0x1 + stind.i1 + + ldc.i4 0x1 + ldloc 2 + add + stloc 2 + + br LOOP0 + +END0: + + ldc.i4 0x0 + stloc 2 + +LOOP1: + ldloc 2 + ldc.i4 0xFF + bgt EXITWITHPASS + + ldloc 1 + ldloc 2 + add + + unaligned. 0x1 + ldind.i1 + + ldloc 2 + conv.i1 + + bne.un EXITWITHFAIL + + ldc.i4 0x1 + ldloc 2 + add + stloc 2 + + br LOOP1 + +END1: + EXITWITHPASS: + leave Pass + EXITWITHFAIL: + leave Fail + +TryEnd: + br Pass + +Filter: + pop + ldc.i4 0x1 + endfilter + +Handler: + pop + leave EndHandler +EndHandler: + br Fail + +Pass: + ldloc 0 + ldstr "LOCALLOC Tests PASS" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldc.i4 0x64 + br End + +Fail: + ldloc 0 + ldstr "!!!! FAILURE !!!! -- LOCALLOC Tests FAIL -- !!!! FAILURE !!!!" + callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string) + ldc.i4 0x0 + br End + +End: + ret +.try TryStart to TryEnd filter Filter handler Handler to EndHandler +} +}
\ No newline at end of file diff --git a/tests/src/JIT/Directed/PREFIX/unaligned/1/localloc.ilproj b/tests/src/JIT/Directed/PREFIX/unaligned/1/localloc.ilproj new file mode 100644 index 0000000000..b249d83731 --- /dev/null +++ b/tests/src/JIT/Directed/PREFIX/unaligned/1/localloc.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\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="localloc.il" /> + </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 |