diff options
author | Jeff Greene <hippiehunterenator@gmail.com> | 2017-12-08 13:44:13 +0300 |
---|---|---|
committer | Morgan Brown <morganbr@users.noreply.github.com> | 2017-12-08 13:44:13 +0300 |
commit | 8300e1f69fc36b2fb913cf2b56859a7d7990cce6 (patch) | |
tree | 4e4fb8f685cc856c357d9310486de24328527092 /src/ILCompiler.WebAssembly | |
parent | b2068273c52ca7392bb5ca3aac4299c007d9a743 (diff) |
Added real support for Unbox stubs to WebAssembly (#5052)
* Added real support for Unbox stubs to WebAssembly
Diffstat (limited to 'src/ILCompiler.WebAssembly')
-rw-r--r-- | src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs | 8 | ||||
-rw-r--r-- | src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyCodegenNodeFactory.cs | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs index e225554e4..d7c177242 100644 --- a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs +++ b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs @@ -985,7 +985,10 @@ namespace Internal.IL TypeDesc argType; if (index == 0 && !callee.Signature.IsStatic) { - argType = callee.OwningType; + if(callee.OwningType.IsValueType) + argType = callee.OwningType.MakeByRefType(); + else + argType = callee.OwningType; } else { @@ -1518,8 +1521,9 @@ namespace Internal.IL { var unboxResult = _stack.Pop().ValueAsType(LLVM.PointerType(LLVM.Int8Type(), 0), _builder); LLVMValueRef unboxData = LLVM.BuildGEP(_builder, unboxResult, new LLVMValueRef[] { BuildConstInt32(type.Context.Target.PointerSize) }, "unboxData"); + var expressionType = type.MakeByRefType(); //push the pointer to the data, but it shouldnt be implicitly dereferenced - PushExpression(GetStackValueKind(type), "unboxed", unboxData, type); + PushExpression(GetStackValueKind(expressionType), "unboxed", unboxData, expressionType); } else //unbox_any { diff --git a/src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyCodegenNodeFactory.cs b/src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyCodegenNodeFactory.cs index a8674d021..a43a1e572 100644 --- a/src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyCodegenNodeFactory.cs +++ b/src/ILCompiler.WebAssembly/src/Compiler/DependencyAnalysis/WebAssemblyCodegenNodeFactory.cs @@ -51,8 +51,7 @@ namespace ILCompiler.DependencyAnalysis protected override IMethodNode CreateUnboxingStubNode(MethodDesc method) { - // TODO: this is wrong: this returns an unstubbed node - return new WebAssemblyMethodCodeNode(method); + return new WebAssemblyMethodCodeNode(TypeSystemContext.GetUnboxingThunk(method, CompilationModuleGroup.GeneratedAssembly)); } protected override ISymbolNode CreateReadyToRunHelperNode(ReadyToRunHelperKey helperCall) |