From fc54efb5d9cb89eb9cc135868e26ed60867f3877 Mon Sep 17 00:00:00 2001 From: Pat Gavlin Date: Tue, 22 Nov 2016 08:12:17 -0800 Subject: [PATCH] PR feedback. Commit migrated from https://github.com/dotnet/coreclr/commit/d50f349d80b7e05421233f9085422963b4b78ec2 --- src/coreclr/src/jit/morph.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/coreclr/src/jit/morph.cpp b/src/coreclr/src/jit/morph.cpp index 53a0834..43e6302 100644 --- a/src/coreclr/src/jit/morph.cpp +++ b/src/coreclr/src/jit/morph.cpp @@ -7060,13 +7060,14 @@ void Compiler::fgMorphTailCall(GenTreeCall* call) } #endif // _TARGET_X86_ -#if !defined(_TARGET_X86_) - if (call->NeedsNullCheck()) -#else - // When targeting x86, we always need to perform a null check on the `this` argument before tail calling to a - // virtual dispatch stub. +#if defined(_TARGET_X86_) + // When targeting x86, the runtime requires that we perforrm a null check on the `this` argument before tail + // calling to a virtual dispatch stub. This requirement is a consequence of limitations in the runtime's + // ability to map an AV to a NullReferenceException if the AV occurs in a dispatch stub. if (call->NeedsNullCheck() || call->IsVirtualStub()) -#endif // !defined(_TARGET_X86_) +#else + if (call->NeedsNullCheck()) +#endif // defined(_TARGET_X86_) { // clone "this" if "this" has no side effects. if ((thisPtr == nullptr) && !(objp->gtFlags & GTF_SIDE_EFFECT)) -- 2.7.4