diff options
author | Michal Strehovský <MichalStrehovsky@users.noreply.github.com> | 2018-07-03 06:17:24 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2018-07-03 06:17:24 +0300 |
commit | d511215822ff90298d1e1b7b9cd58c0197d54fbe (patch) | |
tree | bbf56096f75946ee661f3b896fcdeeda701de6c2 /src/ILCompiler.CppCodeGen | |
parent | 2152ccc2c599768663281aa67cb2155f1610f248 (diff) |
Fix stack slot kind for ByReference.get_Value in CppCodegen (#6034)
* Fix stack slot kind for ByReference.get_Value in CppCodegen
This should be tracked as a ByRef.
This was the reason why the compiler was considering `MemoryMarshal.GetNonNullPinnableReference` invalid IL and we were generating a throwing body for it.
* Include cast
Diffstat (limited to 'src/ILCompiler.CppCodeGen')
-rw-r--r-- | src/ILCompiler.CppCodeGen/src/CppCodeGen/ILToCppImporter.cs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ILCompiler.CppCodeGen/src/CppCodeGen/ILToCppImporter.cs b/src/ILCompiler.CppCodeGen/src/CppCodeGen/ILToCppImporter.cs index 92ac97902..33ab17d76 100644 --- a/src/ILCompiler.CppCodeGen/src/CppCodeGen/ILToCppImporter.cs +++ b/src/ILCompiler.CppCodeGen/src/CppCodeGen/ILToCppImporter.cs @@ -1003,8 +1003,9 @@ namespace Internal.IL if (IsTypeName(method, "System", "ByReference`1")) { var thisRef = _stack.Pop(); - - PushExpression(StackValueKind.ValueType, ((ExpressionEntry)thisRef).Name + "->_value", method.Signature.ReturnType); + PushExpression(StackValueKind.ByRef, + String.Concat("(", GetSignatureTypeNameAndAddReference(method.Signature.ReturnType), ")", ((ExpressionEntry)thisRef).Name, "->_value"), + method.Signature.ReturnType); return true; } break; |