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
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 /src/ILCompiler.WebAssembly
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 'src/ILCompiler.WebAssembly')
-rw-r--r--src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
index 420d12f2e..71da8d50a 100644
--- a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
+++ b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
@@ -1651,6 +1651,32 @@ namespace Internal.IL
private void ImportCpOpj(int token)
{
+ var type = ResolveTypeToken(token);
+
+ if (!type.IsValueType)
+ {
+ throw new InvalidOperationException();
+ }
+
+ var src = _stack.Pop();
+
+ if (src.Kind != StackValueKind.NativeInt && src.Kind != StackValueKind.ByRef && src.Kind != StackValueKind.ObjRef)
+ {
+ throw new InvalidOperationException();
+ }
+
+ var dest = _stack.Pop();
+
+ if (dest.Kind != StackValueKind.NativeInt && dest.Kind != StackValueKind.ByRef && dest.Kind != StackValueKind.ObjRef)
+ {
+ throw new InvalidOperationException();
+ }
+
+ var pointerType = GetLLVMTypeForTypeDesc(type.MakePointerType());
+
+ var value = LLVM.BuildLoad(_builder, src.ValueAsType(pointerType, _builder), "cpobj.load");
+
+ LLVM.BuildStore(_builder, value, dest.ValueAsType(pointerType, _builder));
}
private void ImportUnbox(int token, ILOpcode opCode)