Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWayde Reitsma <pootisspencerherenao@gmail.com>2017-12-31 06:52:17 +0300
committerMorgan Brown <morganbr@users.noreply.github.com>2017-12-31 06:52:16 +0300
commit875551cf874443ecc8077783785264f11d6c4a52 (patch)
tree85b6897500627d1c2606c7b63b501a0303b4a805 /tests
parent2c0a57703a96af79b3c7ac4184c737bbb9a6fc09 (diff)
Implement cpobj opcode for wasm (#5151)
* Implement cpobj opcode for wasm Implements the ILToWebAssembly.ImportCpObj method using an LLVM load and store. Adds a test for for wasm cpobj to the HelloWasm test using an IL project.
Diffstat (limited to 'tests')
-rw-r--r--tests/src/Simple/HelloWasm/CpObj.il34
-rw-r--r--tests/src/Simple/HelloWasm/CpObj.ilproj20
-rw-r--r--tests/src/Simple/HelloWasm/HelloWasm.csproj3
-rw-r--r--tests/src/Simple/HelloWasm/Program.cs9
4 files changed, 66 insertions, 0 deletions
diff --git a/tests/src/Simple/HelloWasm/CpObj.il b/tests/src/Simple/HelloWasm/CpObj.il
new file mode 100644
index 000000000..ca6444dee
--- /dev/null
+++ b/tests/src/Simple/HelloWasm/CpObj.il
@@ -0,0 +1,34 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )
+ .ver 4:0:0:0
+}
+
+.assembly extern System.Private.CoreLib
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
+ .ver 4:0:0:0
+}
+
+.assembly CpObj { }
+
+.class public CpObj.CpObjTest
+{
+ .method public hidebysig static void CpObj(valuetype CpObj.TestValue& dest, valuetype CpObj.TestValue& src) cil managed
+ {
+ .maxstack 8
+ ldarg.0
+ ldarg.1
+ cpobj CpObj.TestValue
+ ret
+ }
+}
+
+.class public value sealed CpObj.TestValue
+{
+ .field public int32 Field;
+} \ No newline at end of file
diff --git a/tests/src/Simple/HelloWasm/CpObj.ilproj b/tests/src/Simple/HelloWasm/CpObj.ilproj
new file mode 100644
index 000000000..e21390e95
--- /dev/null
+++ b/tests/src/Simple/HelloWasm/CpObj.ilproj
@@ -0,0 +1,20 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <TargetFramework>netstandard2.0</TargetFramework>
+ <OutputType>Library</OutputType>
+ <DebugType>portable</DebugType>
+ <OutputPath>$(MSBuildProjectDirectory)\bin\$(Configuration)\$(Platform)\</OutputPath>
+ <IntermediateOutputPath>$(MSBuildProjectDirectory)\obj\$(Configuration)\$(Platform)\</IntermediateOutputPath>
+ </PropertyGroup>
+
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+
+ <ItemGroup>
+ <Compile Include="CpObj.il" />
+ <PackageReference Include="Microsoft.NETCore.App">
+ <Version>$(MicrosoftNETCoreAppPackageVersion)</Version>
+ </PackageReference>
+ </ItemGroup>
+
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/Simple/HelloWasm/HelloWasm.csproj b/tests/src/Simple/HelloWasm/HelloWasm.csproj
index 45ebce05d..b767a5dbd 100644
--- a/tests/src/Simple/HelloWasm/HelloWasm.csproj
+++ b/tests/src/Simple/HelloWasm/HelloWasm.csproj
@@ -1,6 +1,9 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Compile Include="*.cs" />
+
+ <ProjectReference Include="CpObj.ilproj" />
+ <IlcArg Include="-r:$(IntermediateOutputPath)\CpObj.dll" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), SimpleTest.targets))\SimpleTest.targets" />
diff --git a/tests/src/Simple/HelloWasm/Program.cs b/tests/src/Simple/HelloWasm/Program.cs
index 145694210..25886330c 100644
--- a/tests/src/Simple/HelloWasm/Program.cs
+++ b/tests/src/Simple/HelloWasm/Program.cs
@@ -4,6 +4,7 @@
using System;
using System.Runtime.InteropServices;
+using CpObj;
internal static class Program
{
@@ -108,6 +109,14 @@ internal static class Program
{
PrintLine("SwitchOpDefault test: Ok.");
}
+
+ var cpObjTestA = new TestValue { Field = 1234 };
+ var cpObjTestB = new TestValue { Field = 5678 };
+ CpObjTest.CpObj(ref cpObjTestB, ref cpObjTestA);
+ if (cpObjTestB.Field == 1234)
+ {
+ PrintLine("CpObj test: Ok.");
+ }
}
private static unsafe void PrintString(string s)