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:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2018-02-23 22:51:04 +0300
committerJan Kotas <jkotas@microsoft.com>2018-02-23 22:51:04 +0300
commit883475b5b49761e2312573eec2a4990fc6c302af (patch)
tree856fba1e7ce13fa370660fdc3429e9a1cd671e24 /src/JitInterface/src/CorInfoImpl.cs
parent722dcf7e82602793a039986bf6e8e707f88166f7 (diff)
Generate a constructed EEType for constrained tokens (#5437)
`CorInfoTokenKind.CORINFO_TOKENKIND_Constrained` means RyuJIT is asking for a type handle with the purpose of boxing it. This fixes: ```csharp struct Foo { } void Main() { Foo f = default; f.GetHashCode() } ``` We were trying to execute bogus memory because unconstructed types don't have vtables.
Diffstat (limited to 'src/JitInterface/src/CorInfoImpl.cs')
-rw-r--r--src/JitInterface/src/CorInfoImpl.cs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/JitInterface/src/CorInfoImpl.cs b/src/JitInterface/src/CorInfoImpl.cs
index 95b25f804..a9eaceaab 100644
--- a/src/JitInterface/src/CorInfoImpl.cs
+++ b/src/JitInterface/src/CorInfoImpl.cs
@@ -2904,6 +2904,7 @@ namespace Internal.JitInterface
if (pResolvedToken.tokenType == CorInfoTokenKind.CORINFO_TOKENKIND_NewObj
|| pResolvedToken.tokenType == CorInfoTokenKind.CORINFO_TOKENKIND_Box
+ || pResolvedToken.tokenType == CorInfoTokenKind.CORINFO_TOKENKIND_Constrained
|| (pResolvedToken.tokenType == CorInfoTokenKind.CORINFO_TOKENKIND_Ldtoken && ConstructedEETypeNode.CreationAllowed(td)))
{
helperId = ReadyToRunHelperId.TypeHandle;