From d8853a8dd967a222128319c8a95d0ca2be326c62 Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Wed, 12 May 2021 13:23:50 -0700 Subject: [PATCH 1/7] Add clrjit.natvis file --- src/coreclr/jit/CMakeLists.txt | 1 + src/coreclr/jit/clrjit.natvis | 105 +++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 src/coreclr/jit/clrjit.natvis diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt index b33141771fd912..429ba040a5e66a 100644 --- a/src/coreclr/jit/CMakeLists.txt +++ b/src/coreclr/jit/CMakeLists.txt @@ -69,6 +69,7 @@ if(CLR_CMAKE_TARGET_WIN32) endif(CLR_CMAKE_TARGET_WIN32) set( JIT_SOURCES + clrjit.natvis alloc.cpp assertionprop.cpp bitset.cpp diff --git a/src/coreclr/jit/clrjit.natvis b/src/coreclr/jit/clrjit.natvis new file mode 100644 index 00000000000000..9d364c57d17cc5 --- /dev/null +++ b/src/coreclr/jit/clrjit.natvis @@ -0,0 +1,105 @@ + + + + + + + + + {{ {info.compFullName,sb} ({info.compMethodHashPrivate,x})}} + info.compFullName,sb + + + + BB{bbNum,d}->BB{bbJumpDest->bbNum,d}; {bbJumpKind,en} + BB{bbNum,d};--- {bbJumpKind} + + + + type={ebdHandlerType} + + + + + {{{gtOper,en}, {gtType,en}}}} + + + {{IntCon= {((GenTreeIntCon*)this)->gtIconVal, d}}} + + + {{DblCon= {((GenTreeDblCon*)this)->gtDconVal, g}}} + + + CNS_STR + + + {{LngCon= {((GenTreeLngCon*)this)->gtLconVal, l}}} + + + {{{((GenTreeUnOp*)this)->gtOper,en}={this->gtOp2,na}}} + {{{((GenTreeCast*)this)->gtCastType,en} <- {((GenTreeUnOp*)this)->gtOp1->gtType,en}}} + + + + {{ {lvType,en} - {lvReason,s} }} + + + + {{{gtType,en} V{((GenTreeLclVar*)this)->_gtLclNum, 02u}}} + + + + + {{#{rpNum,d} - {refType,en}}} + + (RegRecord*)this->referent + (Interval*)this->referent + + + + + ((regNumber)regIndex),en + regIndex++ + reg = reg >> 1 + + + + + + + [V{this->varNum,d}, #{this->intervalIndex, d}, reg= {(regNumber)physReg, en}] + [C{this->intervalIndex, d}, reg= {(regNumber)physReg, en}] + [I{this->intervalIndex, d}, reg= {(regNumber)physReg, en}] + + + + [reg= {((regNumber)regNum),en}, type= {registerType, en}] + + assignedInterval + previousInterval + + + + + + IG{igNum,d}} + + + + + Size = {m_nSize} + Empty + + + m_nSize + this->m_pHead + this->m_pNext + this->m_value + + + + + From acea8a5d278d7ea37b409ddae9e166d888c4eb9b Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Wed, 12 May 2021 15:08:04 -0700 Subject: [PATCH 2/7] Review comments --- src/coreclr/jit/clrjit.natvis | 63 +++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/src/coreclr/jit/clrjit.natvis b/src/coreclr/jit/clrjit.natvis index 9d364c57d17cc5..3babe1d640465c 100644 --- a/src/coreclr/jit/clrjit.natvis +++ b/src/coreclr/jit/clrjit.natvis @@ -9,13 +9,13 @@ The .NET Foundation licenses this file to you under the MIT license. - {{ {info.compFullName,sb} ({info.compMethodHashPrivate,x})}} + [{info.compFullName,sb} ({info.compMethodHashPrivate,x})] info.compFullName,sb BB{bbNum,d}->BB{bbJumpDest->bbNum,d}; {bbJumpKind,en} - BB{bbNum,d};--- {bbJumpKind} + BB{bbNum,d}; {bbJumpKind,en} @@ -24,36 +24,64 @@ The .NET Foundation licenses this file to you under the MIT license. - {{{gtOper,en}, {gtType,en}}}} + [{gtOper,en}, {gtType,en}}] - {{IntCon= {((GenTreeIntCon*)this)->gtIconVal, d}}} + [IntCon={((GenTreeIntCon*)this)->gtIconVal, d}] - {{DblCon= {((GenTreeDblCon*)this)->gtDconVal, g}}} + [DblCon={((GenTreeDblCon*)this)->gtDconVal, g}] CNS_STR - {{LngCon= {((GenTreeLngCon*)this)->gtLconVal, l}}} + [LngCon={((GenTreeLngCon*)this)->gtLconVal, l}] - {{{((GenTreeUnOp*)this)->gtOper,en}={this->gtOp2,na}}} - {{{((GenTreeCast*)this)->gtCastType,en} <- {((GenTreeUnOp*)this)->gtOp1->gtType,en}}} + [{((GenTreeUnOp*)this)->gtOper,en}={this->gtOp2,na}] + [{((GenTreeCast*)this)->gtCastType,en} <- {((GenTreeUnOp*)this)->gtOp1->gtType,en}] + [{gtOper,en}, {gtType,en}] - {{ {lvType,en} - {lvReason,s} }} + [{lvType,en}] + [{lvType,en}-{lvReason,s}] - {{{gtType,en} V{((GenTreeLclVar*)this)->_gtLclNum, 02u}}} + [{gtOper,en}, {gtType,en} V{((GenTreeLclVar*)this)->_gtLclNum,u}] + + LinearScan + + this->m_AvailableRegs + + + + + ((regNumber)regIndex),en + regIndex++ + reg = reg >> 1 + + + this->m_RegistersWithConstants + + + + + ((regNumber)regIndex),en + regIndex++ + reg = reg >> 1 + + + + + - {{#{rpNum,d} - {refType,en}}} + [#{rpNum,d} - {refType,en}] (RegRecord*)this->referent (Interval*)this->referent @@ -70,13 +98,13 @@ The .NET Foundation licenses this file to you under the MIT license. - [V{this->varNum,d}, #{this->intervalIndex, d}, reg= {(regNumber)physReg, en}] - [C{this->intervalIndex, d}, reg= {(regNumber)physReg, en}] - [I{this->intervalIndex, d}, reg= {(regNumber)physReg, en}] + [V{this->varNum,d}, #{this->intervalIndex, d}, reg={(regNumber)physReg, en}] + [C{this->intervalIndex, d}, reg={(regNumber)physReg, en}] + [I{this->intervalIndex, d}, reg={(regNumber)physReg, en}] - [reg= {((regNumber)regNum),en}, type= {registerType, en}] + [reg={((regNumber)regNum),en}, type={registerType, en}] assignedInterval previousInterval @@ -85,12 +113,13 @@ The .NET Foundation licenses this file to you under the MIT license. - IG{igNum,d}} + IG{igNum,d} [extend] + IG{igNum,d] - Size = {m_nSize} + Size={m_nSize} Empty From 709e730b792b33f9b113fa463d9a7e255de3a5b3 Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Thu, 13 May 2021 10:51:12 -0700 Subject: [PATCH 3/7] pass /NATVIS flag to linker --- src/coreclr/jit/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt index 429ba040a5e66a..5ee89be59023c0 100644 --- a/src/coreclr/jit/CMakeLists.txt +++ b/src/coreclr/jit/CMakeLists.txt @@ -363,6 +363,15 @@ convert_to_absolute_path(JIT_ARM_SOURCES ${JIT_ARM_SOURCES}) convert_to_absolute_path(JIT_I386_SOURCES ${JIT_I386_SOURCES}) convert_to_absolute_path(JIT_ARM64_SOURCES ${JIT_ARM64_SOURCES}) +# Set natvis file + +set(JIT_NATVIS_SOURCE + clrjit.natvis +) + +convert_to_absolute_path(JIT_NATVIS_SOURCE ${JIT_NATVIS_SOURCE}) +add_linker_flag("/NATVIS:${JIT_NATVIS_SOURCE}") + set(JIT_DLL_MAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/dllmain.cpp) if(CLR_CMAKE_TARGET_WIN32) From a210ad7e07264fbd5926c83a9ada340562c9a8db Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Thu, 13 May 2021 11:11:29 -0700 Subject: [PATCH 4/7] Include clrjit.natvis only for windows --- src/coreclr/jit/CMakeLists.txt | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt index 5ee89be59023c0..d2f9c4cdb63851 100644 --- a/src/coreclr/jit/CMakeLists.txt +++ b/src/coreclr/jit/CMakeLists.txt @@ -69,7 +69,6 @@ if(CLR_CMAKE_TARGET_WIN32) endif(CLR_CMAKE_TARGET_WIN32) set( JIT_SOURCES - clrjit.natvis alloc.cpp assertionprop.cpp bitset.cpp @@ -252,6 +251,10 @@ if (CLR_CMAKE_TARGET_WIN32) vartype.h ) + # Append clrjit.natvis file + list (APPEND JIT_SOURCES + clrjit.natvis) + if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_ARM) list (APPEND JIT_HEADERS emitarm.h @@ -363,14 +366,14 @@ convert_to_absolute_path(JIT_ARM_SOURCES ${JIT_ARM_SOURCES}) convert_to_absolute_path(JIT_I386_SOURCES ${JIT_I386_SOURCES}) convert_to_absolute_path(JIT_ARM64_SOURCES ${JIT_ARM64_SOURCES}) -# Set natvis file - -set(JIT_NATVIS_SOURCE - clrjit.natvis -) - -convert_to_absolute_path(JIT_NATVIS_SOURCE ${JIT_NATVIS_SOURCE}) -add_linker_flag("/NATVIS:${JIT_NATVIS_SOURCE}") +# Include natvis file for Windows +if (CLR_CMAKE_TARGET_WIN32) + set(JIT_NATVIS_SOURCE + clrjit.natvis + ) + convert_to_absolute_path(JIT_NATVIS_SOURCE ${JIT_NATVIS_SOURCE}) + add_linker_flag("/NATVIS:${JIT_NATVIS_SOURCE}") +endif(CLR_CMAKE_TARGET_WIN32) set(JIT_DLL_MAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/dllmain.cpp) From 92fbd58783beaff9306461413393912ee3a2ff28 Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Fri, 14 May 2021 00:27:45 +0530 Subject: [PATCH 5/7] Update src/coreclr/jit/CMakeLists.txt Co-authored-by: Jeremy Koritzinsky --- src/coreclr/jit/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt index d2f9c4cdb63851..1d8e8645f50462 100644 --- a/src/coreclr/jit/CMakeLists.txt +++ b/src/coreclr/jit/CMakeLists.txt @@ -367,13 +367,13 @@ convert_to_absolute_path(JIT_I386_SOURCES ${JIT_I386_SOURCES}) convert_to_absolute_path(JIT_ARM64_SOURCES ${JIT_ARM64_SOURCES}) # Include natvis file for Windows -if (CLR_CMAKE_TARGET_WIN32) +if (CLR_CMAKE_HOST_WIN32) set(JIT_NATVIS_SOURCE clrjit.natvis ) convert_to_absolute_path(JIT_NATVIS_SOURCE ${JIT_NATVIS_SOURCE}) add_linker_flag("/NATVIS:${JIT_NATVIS_SOURCE}") -endif(CLR_CMAKE_TARGET_WIN32) +endif(CLR_CMAKE_HOST_WIN32) set(JIT_DLL_MAIN_FILE ${CMAKE_CURRENT_LIST_DIR}/dllmain.cpp) From d8c7a7a6035dd312c9613ba71f2ad4809ba9bb48 Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Thu, 13 May 2021 14:35:15 -0700 Subject: [PATCH 6/7] Add the missing review comment --- src/coreclr/jit/clrjit.natvis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/jit/clrjit.natvis b/src/coreclr/jit/clrjit.natvis index 3babe1d640465c..a0f73442cbc443 100644 --- a/src/coreclr/jit/clrjit.natvis +++ b/src/coreclr/jit/clrjit.natvis @@ -39,7 +39,7 @@ The .NET Foundation licenses this file to you under the MIT license. [LngCon={((GenTreeLngCon*)this)->gtLconVal, l}] - [{((GenTreeUnOp*)this)->gtOper,en}={this->gtOp2,na}] + [{this->gtOp1,na}={this->gtOp2,na}] [{((GenTreeCast*)this)->gtCastType,en} <- {((GenTreeUnOp*)this)->gtOp1->gtType,en}] [{gtOper,en}, {gtType,en}] From 710fef4d6d0ca738ae865c3a563f803299bc763e Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Thu, 13 May 2021 15:06:00 -0700 Subject: [PATCH 7/7] minor typo --- src/coreclr/jit/clrjit.natvis | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/jit/clrjit.natvis b/src/coreclr/jit/clrjit.natvis index a0f73442cbc443..c242727719bc8f 100644 --- a/src/coreclr/jit/clrjit.natvis +++ b/src/coreclr/jit/clrjit.natvis @@ -114,7 +114,7 @@ The .NET Foundation licenses this file to you under the MIT license. IG{igNum,d} [extend] - IG{igNum,d] + IG{igNum,d}