From 2769526763914d7031eb4bbdea8af544fc037c2a Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Thu, 4 Nov 2021 22:59:57 -0700 Subject: [PATCH] couple tweaks --- src/coreclr/vm/typehash.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/coreclr/vm/typehash.cpp b/src/coreclr/vm/typehash.cpp index 12b146064c8c22..4453163ee5236d 100644 --- a/src/coreclr/vm/typehash.cpp +++ b/src/coreclr/vm/typehash.cpp @@ -161,8 +161,6 @@ static DWORD HashPossiblyInstantiatedType(mdTypeDef token, Instantiation inst) dwHash = ((dwHash << 5) + dwHash) ^ token; if (!inst.IsEmpty()) { - dwHash = ((dwHash << 5) + dwHash) ^ inst.GetNumArgs(); - // Hash n type parameters for (DWORD i = 0; i < inst.GetNumArgs(); i++) { @@ -224,10 +222,6 @@ static DWORD HashTypeHandle(TypeHandle t) { retVal = HashParamType(t.GetInternalCorElementType(), t.GetTypeParam()); } - else if (t.IsGenericVariable()) - { - retVal = (dac_cast(t.AsTypeDesc())->GetToken()); - } else if (t.HasInstantiation()) { retVal = HashPossiblyInstantiatedType(t.GetCl(), t.GetInstantiation()); @@ -237,6 +231,11 @@ static DWORD HashTypeHandle(TypeHandle t) FnPtrTypeDesc* pTD = t.AsFnPtrType(); retVal = HashFnPtrType(pTD->GetCallConv(), pTD->GetNumArgs(), pTD->GetRetAndArgTypesPointer()); } + else if (t.IsGenericVariable()) + { + _ASSERTE(!"Generic variables are unexpected here."); + retVal = t.AsTAddr(); + } else retVal = HashPossiblyInstantiatedType(t.GetCl(), Instantiation());