From 3c32c8e3136cf803ccd46050a119c97ca5c15030 Mon Sep 17 00:00:00 2001 From: Brian Sullivan Date: Thu, 16 Jan 2020 15:18:26 -0800 Subject: [PATCH 1/2] Fixes runtime issue 1739 Added additional check for Jit Stress mode STRESS_LCL_FLDS This stress mode requires that the types exactly match --- src/coreclr/src/jit/lclvars.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/coreclr/src/jit/lclvars.cpp b/src/coreclr/src/jit/lclvars.cpp index 319564300fa9d8..52ee9eb5c232a4 100644 --- a/src/coreclr/src/jit/lclvars.cpp +++ b/src/coreclr/src/jit/lclvars.cpp @@ -7339,6 +7339,14 @@ Compiler::fgWalkResult Compiler::lvaStressLclFldCB(GenTree** pTree, fgWalkData* return WALK_SKIP_SUBTREES; } + // The assert in the second pass below, requires that these types match, or we have a TYP_BLK + // + if ((varDsc->lvType != lcl->gtType) && varDsc->lvType != TYP_BLK) + { + varDsc->lvNoLclFldStress = true; + return WALK_SKIP_SUBTREES; + } + // Weed out "small" types like TYP_BYTE as we don't mark the GT_LCL_VAR // node with the accurate small type. If we bash lvaTable[].lvType, // then there will be no indication that it was ever a small type. From 8b07b70eb8122cef87b50a673ff6687ed8d0f4c5 Mon Sep 17 00:00:00 2001 From: Brian Sullivan Date: Thu, 16 Jan 2020 16:41:49 -0800 Subject: [PATCH 2/2] Code review feedback --- src/coreclr/src/jit/lclvars.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/src/jit/lclvars.cpp b/src/coreclr/src/jit/lclvars.cpp index 52ee9eb5c232a4..ad831eea28acd3 100644 --- a/src/coreclr/src/jit/lclvars.cpp +++ b/src/coreclr/src/jit/lclvars.cpp @@ -7339,9 +7339,9 @@ Compiler::fgWalkResult Compiler::lvaStressLclFldCB(GenTree** pTree, fgWalkData* return WALK_SKIP_SUBTREES; } - // The assert in the second pass below, requires that these types match, or we have a TYP_BLK + // The noway_assert in the second pass below, requires that these types match, or we have a TYP_BLK // - if ((varDsc->lvType != lcl->gtType) && varDsc->lvType != TYP_BLK) + if ((varDsc->lvType != lcl->gtType) && (varDsc->lvType != TYP_BLK)) { varDsc->lvNoLclFldStress = true; return WALK_SKIP_SUBTREES; @@ -7368,7 +7368,7 @@ Compiler::fgWalkResult Compiler::lvaStressLclFldCB(GenTree** pTree, fgWalkData* else { // Do the morphing - noway_assert(varDsc->lvType == lcl->gtType || varDsc->lvType == TYP_BLK); + noway_assert((varDsc->lvType == lcl->gtType) || (varDsc->lvType == TYP_BLK)); var_types varType = varDsc->TypeGet(); // Calculate padding