Skip to content

Commit

Permalink
JIT: fix bug introduced by recent throw helper block changes (dotnet#…
Browse files Browse the repository at this point in the history
…93897)

`compUsesThrowHelper` indicates codegen will likely need to create a call to a helper,
whether or not such calls are shared.

In dotnet#93371 I didn't appreciate this, and so the JIT was failing to set `compUsesThrowHelper`
in cases where a throw helper was going to be needed but throw helper calls were not going to
be shared.

Fixes dotnet#93710.
  • Loading branch information
AndyAyersMS authored and liveans committed Nov 9, 2023
1 parent 3d75819 commit 8e82e06
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/coreclr/jit/flowgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3537,9 +3537,15 @@ const char* sckName(SpecialCodeKind codeKind)
//
void Compiler::fgAddCodeRef(BasicBlock* srcBlk, SpecialCodeKind kind)
{
// Record that the code will call a THROW_HELPER
// so on Windows Amd64 we can allocate the 4 outgoing
// arg slots on the stack frame if there are no other calls.
//
compUsesThrowHelper = true;

if (!fgUseThrowHelperBlocks() && (kind != SCK_FAIL_FAST))
{
// FailFast will still use a thrwo helper, even in debuggable modes.
// FailFast will still use a common throw helper, even in debuggable modes.
//
return;
}
Expand All @@ -3548,11 +3554,6 @@ void Compiler::fgAddCodeRef(BasicBlock* srcBlk, SpecialCodeKind kind)

unsigned const refData = (kind == SCK_FAIL_FAST) ? 0 : bbThrowIndex(srcBlk);

// Record that the code will call a THROW_HELPER
// so on Windows Amd64 we can allocate the 4 outgoing
// arg slots on the stack frame if there are no other calls.
compUsesThrowHelper = true;

// Look for an existing entry that matches what we're looking for
//
AddCodeDsc* add = fgFindExcptnTarget(kind, refData);
Expand Down

0 comments on commit 8e82e06

Please sign in to comment.