Skip to content

Commit

Permalink
JIT: Disable implicit tailcalls for throwhelpers (#61006)
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo authored Nov 1, 2021
1 parent f9a2449 commit 2a87ffe
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7132,15 +7132,11 @@ GenTree* Compiler::fgMorphPotentialTailCall(GenTreeCall* call)
return nullptr;
}

// Heuristic: regular calls to noreturn methods can sometimes be
// merged, so if we have multiple such calls, we defer tail calling.
//
// TODO: re-examine this; now that we're merging before morph we
// don't need to worry about interfering with merges.
//
if (call->IsNoReturn() && (optNoReturnCallCount > 1))
if (call->IsNoReturn() && !call->IsTailPrefixedCall())
{
failTailCall("Defer tail calling throw helper; anticipating merge");
// Such tail calls always throw an exception and we won't be able to see current
// Caller() in the stacktrace.
failTailCall("Never returns");
return nullptr;
}

Expand Down

0 comments on commit 2a87ffe

Please sign in to comment.