Skip to content

Commit cf50059

Browse files
AndyAyersMSCopilot
andcommitted
JIT: don't skip top-level catchrets when marking try resumption
In FlowGraphTryRegions::Build, the BBJ_EHCATCHRET check sat below the early bailout on hasTryIndex, so the catchret of an outer catch was never marking its try region as requiring runtime resumption. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 24547a7 commit cf50059

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/coreclr/jit/flowgraph.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7744,6 +7744,19 @@ FlowGraphTryRegions* FlowGraphTryRegions::Build(Compiler* comp, FlowGraphDfsTree
77447744

77457745
for (BasicBlock* block : comp->Blocks())
77467746
{
7747+
// If this block is a BBJ_EHCATCHRET, mark the "dispatching try" region
7748+
// as requiring runtime resumption.
7749+
//
7750+
if (block->KindIs(BBJ_EHCATCHRET))
7751+
{
7752+
assert(block->hasHndIndex());
7753+
unsigned const ehRegionIndex = block->getHndIndex();
7754+
BasicBlock* const dispatchingTryBlock = comp->ehGetDsc(ehRegionIndex)->ebdTryBeg;
7755+
FlowGraphTryRegion* const dispatchingTryRegion = regions->GetTryRegionByHeader(dispatchingTryBlock);
7756+
7757+
dispatchingTryRegion->SetRequiresRuntimeResumption();
7758+
}
7759+
77477760
if (!block->hasTryIndex())
77487761
{
77497762
continue;
@@ -7825,19 +7838,6 @@ FlowGraphTryRegions* FlowGraphTryRegions::Build(Compiler* comp, FlowGraphDfsTree
78257838
// This is a handler block inside a try.
78267839
// For flow purposes we may consider it to be outside the try.
78277840
}
7828-
7829-
// If this block is a BBJ_EHCATCHRET, mark the "dispatching try" region
7830-
// as requiring runtime resumption.
7831-
//
7832-
if (block->KindIs(BBJ_EHCATCHRET))
7833-
{
7834-
assert(block->hasHndIndex());
7835-
unsigned const ehRegionIndex = block->getHndIndex();
7836-
BasicBlock* const dispatchingTryBlock = comp->ehGetDsc(ehRegionIndex)->ebdTryBeg;
7837-
FlowGraphTryRegion* const dispatchingTryRegion = regions->GetTryRegionByHeader(dispatchingTryBlock);
7838-
7839-
dispatchingTryRegion->SetRequiresRuntimeResumption();
7840-
}
78417841
}
78427842

78437843
return regions;

0 commit comments

Comments
 (0)