From 435e7d4ed4e56f7fcf02919ea55cd326348c28f8 Mon Sep 17 00:00:00 2001 From: vsadov <8218165+VSadov@users.noreply.github.com> Date: Mon, 15 Apr 2024 12:29:27 -0700 Subject: [PATCH] fix x86 build --- src/coreclr/jit/codegenlinear.cpp | 10 +++++++--- src/coreclr/jit/codegenxarch.cpp | 24 ++++++++++++------------ 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/coreclr/jit/codegenlinear.cpp b/src/coreclr/jit/codegenlinear.cpp index 69759a3c14bb8d..fcb2d408dba8e6 100644 --- a/src/coreclr/jit/codegenlinear.cpp +++ b/src/coreclr/jit/codegenlinear.cpp @@ -713,10 +713,14 @@ void CodeGen::genCodeForBBlist() // Considering that the throwing code is typically rare, and is not on the common/fast path // we just add the instruction after all throwing calls. // We will check that invariant in the most common case - when the throw ends the block. - GenTree* call = block->lastNode(); - if ((call != nullptr) && (call->gtOper == GT_CALL)) + GenTree* last = block->lastNode(); + if ((last != nullptr) && (last->gtOper == GT_CALL)) { - assert(GetEmitter()->emitIsLastInsBreakpoint() || call->AsCall()->IsFastTailCall()); + GenTreeCall* call = last->AsCall(); + if (call->IsNoReturn()) + { + assert(GetEmitter()->emitIsLastInsBreakpoint() || call->IsFastTailCall()); + } } } #endif // DEBUG diff --git a/src/coreclr/jit/codegenxarch.cpp b/src/coreclr/jit/codegenxarch.cpp index e6f62eb16f8ddd..a45688c89851bd 100644 --- a/src/coreclr/jit/codegenxarch.cpp +++ b/src/coreclr/jit/codegenxarch.cpp @@ -6043,6 +6043,18 @@ void CodeGen::genCall(GenTreeCall* call) assert((gcInfo.gcRegByrefSetCur & killMask) == 0); #endif + unsigned stackAdjustBias = 0; + +#if defined(TARGET_X86) + // Is the caller supposed to pop the arguments? + if (call->CallerPop() && (stackArgBytes != 0)) + { + stackAdjustBias = stackArgBytes; + } + + SubtractStackLevel(stackArgBytes); +#endif // TARGET_X86 + if (call->IsNoReturn()) { // There are several situations when we need to add another instruction @@ -6181,18 +6193,6 @@ void CodeGen::genCall(GenTreeCall* call) } #endif // FEATURE_EH_WINDOWS_X86 - unsigned stackAdjustBias = 0; - -#if defined(TARGET_X86) - // Is the caller supposed to pop the arguments? - if (call->CallerPop() && (stackArgBytes != 0)) - { - stackAdjustBias = stackArgBytes; - } - - SubtractStackLevel(stackArgBytes); -#endif // TARGET_X86 - genRemoveAlignmentAfterCall(call, stackAdjustBias); }