From bb89b3b209b9f7db7e0fd68b09733841e704a221 Mon Sep 17 00:00:00 2001 From: Sergey Andreenko Date: Mon, 5 Oct 2020 13:22:05 -0700 Subject: [PATCH] Fix SPMI dump. (#42867) * Fix SPMI dump. * add a message when we have collisions. --- .../src/ToolBox/superpmi/superpmi-shared/lightweightmap.h | 7 +++++++ .../src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/lightweightmap.h b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/lightweightmap.h index adce2c1..2cc6536 100644 --- a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/lightweightmap.h +++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/lightweightmap.h @@ -369,7 +369,14 @@ public: else if (res > 0) last = mid - 1; // repeat search in bottom half. else + { + int resItem = memcmp(&pItems[mid], &item, sizeof(_Item)); + if (resItem != 0) + { + LogDebug("Tried to add a new value for an existing key, the new value was ignored"); + } return false; // found it. return position ///// + } } insert = first; if (insert != (unsigned int)first) diff --git a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index 4a134fe..e5bec43 100644 --- a/src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -2453,7 +2453,7 @@ bool MethodContext::repConvertPInvokeCalliToCall(CORINFO_RESOLVED_TOKEN* pResolv key.B = (DWORD)pResolvedToken->token; DWORDLONG value = ConvertPInvokeCalliToCall->Get(key); - DEBUG_REP(dmpGetArgType(key, value)); + DEBUG_REP(dmpConvertPInvokeCalliToCall(key, value)); pResolvedToken->hMethod = (CORINFO_METHOD_HANDLE)value; return value != 0; @@ -3060,7 +3060,7 @@ void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, key.implementingClass = (DWORDLONG)implClass; key.ownerType = (DWORDLONG)ownerType; ResolveVirtualMethod->Add(key, (DWORDLONG)result); - DEBUG_REC(dmpResolveVirtualMethod(key, result)); + DEBUG_REC(dmpResolveVirtualMethod(key, (DWORDLONG)result)); } void MethodContext::dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethod& key, DWORDLONG value) @@ -3458,7 +3458,7 @@ void MethodContext::recGetStaticFieldCurrentClass(CORINFO_FIELD_HANDLE field, value.isSpeculative = isSpeculative; GetStaticFieldCurrentClass->Add((DWORDLONG)field, value); - DEBUG_REC(dmpGetFieldAddress((DWORDLONG)field, value)); + DEBUG_REC(dmpGetStaticFieldCurrentClass((DWORDLONG)field, value)); } void MethodContext::dmpGetStaticFieldCurrentClass(DWORDLONG key, const Agnostic_GetStaticFieldCurrentClass& value) { @@ -3475,7 +3475,7 @@ CORINFO_CLASS_HANDLE MethodContext::repGetStaticFieldCurrentClass(CORINFO_FIELD_ } CORINFO_CLASS_HANDLE result = (CORINFO_CLASS_HANDLE)value.classHandle; - DEBUG_REP(dmpGetStaticFieldCurrentValue((DWORDLONG)field, value)); + DEBUG_REP(dmpGetStaticFieldCurrentClass((DWORDLONG)field, value)); return result; } @@ -5270,6 +5270,7 @@ void MethodContext::recIsMoreSpecificType(CORINFO_CLASS_HANDLE cls1, CORINFO_CLA key.B = (DWORDLONG)cls2; IsMoreSpecificType->Add(key, (DWORD)result); + DEBUG_REC(dmpIsMoreSpecificType(key, (DWORD)result)); } void MethodContext::dmpIsMoreSpecificType(DLDL key, DWORD value) { @@ -5277,6 +5278,9 @@ void MethodContext::dmpIsMoreSpecificType(DLDL key, DWORD value) } BOOL MethodContext::repIsMoreSpecificType(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2) { + AssertCodeMsg(IsMoreSpecificType != nullptr, EXCEPTIONCODE_MC, "Didn't find %016llX %016llX", (DWORDLONG)cls1, + (DWORDLONG)cls2); + DLDL key; ZeroMemory(&key, sizeof(DLDL)); // We use the input structs as a key and use memcmp to compare.. so we need to zero // out padding too @@ -5290,6 +5294,7 @@ BOOL MethodContext::repIsMoreSpecificType(CORINFO_CLASS_HANDLE cls1, CORINFO_CLA value = IsMoreSpecificType->Get(key); + DEBUG_REP(dmpIsMoreSpecificType(key, value)); return (BOOL)value; } -- 2.7.4