From 5355fa82a56616aa07eb750f351e02a66eb53d90 Mon Sep 17 00:00:00 2001 From: Sergey Andreenko Date: Mon, 15 Apr 2019 12:15:26 -0700 Subject: [PATCH] Another surgery fix for genPutArgStk to fix desktop build. Commit migrated from https://github.com/dotnet/coreclr/commit/1e7f8986b94fbdfc89f4e6f8ef4d43686ec18599 --- src/coreclr/src/jit/codegenarmarch.cpp | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/coreclr/src/jit/codegenarmarch.cpp b/src/coreclr/src/jit/codegenarmarch.cpp index 66d5b22..b787ad6 100644 --- a/src/coreclr/src/jit/codegenarmarch.cpp +++ b/src/coreclr/src/jit/codegenarmarch.cpp @@ -704,6 +704,22 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode) varNode = addrNode->AsLclVarCommon(); addrNode = nullptr; } + else // addrNode is used + { + // Generate code to load the address that we need into a register + genConsumeAddress(addrNode); + addrReg = addrNode->gtRegNum; + +#ifdef _TARGET_ARM64_ + // If addrReg equal to loReg, swap(loReg, hiReg) + // This reduces code complexity by only supporting one addrReg overwrite case + if (loReg == addrReg) + { + loReg = hiReg; + hiReg = addrReg; + } +#endif // _TARGET_ARM64_ + } } // Either varNode or addrNOde must have been setup above, @@ -727,8 +743,9 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode) gcPtrCount = treeNode->gtNumberReferenceSlots; #endif // Setup the structSize, isHFa, and gcPtrCount - if (varNode != nullptr) + if (source->OperGet() == GT_LCL_VAR) { + assert(varNode != nullptr); varNumInp = varNode->gtLclNum; assert(varNumInp < compiler->lvaCount); LclVarDsc* varDsc = &compiler->lvaTable[varNumInp]; @@ -747,27 +764,10 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode) gcPtrs[i] = varDsc->lvGcLayout[i]; #endif // _TARGET_ARM_ } - else // addrNode is used + else // we must have a GT_OBJ { - assert(addrNode != nullptr); - - // Generate code to load the address that we need into a register - genConsumeAddress(addrNode); - addrReg = addrNode->gtRegNum; - -#ifdef _TARGET_ARM64_ - // If addrReg equal to loReg, swap(loReg, hiReg) - // This reduces code complexity by only supporting one addrReg overwrite case - if (loReg == addrReg) - { - loReg = hiReg; - hiReg = addrReg; - } -#endif // _TARGET_ARM64_ - } + assert(source->OperGet() == GT_OBJ); - if (source->OperIs(GT_OBJ)) - { // If the source is an OBJ node then we need to use the type information // it provides (size and GC layout) even if the node wraps a lclvar. Due // to struct reinterpretation (e.g. Unsafe.As) it is possible that -- 2.7.4