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:
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)