Skip to content

Commit 583658e

Browse files
committed
fix an assert for (callInfo.SynchronizationContextLclNum != BAD_VAR_NUM)
1 parent f5c42ee commit 583658e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/coreclr/jit/async.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ PhaseStatus Compiler::SaveAsyncContexts()
169169
// Await is inside a try, need to insert try-finally around it.
170170
restoreBB = InsertTryFinallyForContextRestore(curBB, stmt, restoreAfterStmt);
171171
restoreAfterStmt = nullptr;
172+
// we have split the block that could have another await.
173+
nextBB = restoreBB->Next();
172174
#endif
173175
}
174176

@@ -1520,8 +1522,9 @@ void AsyncTransformation::FillInGCPointersOnSuspension(GenTreeCall*
15201522
if (layout.ContinuationContextGCDataIndex != UINT_MAX)
15211523
{
15221524
const AsyncCallInfo& callInfo = call->GetAsyncInfo();
1523-
assert(callInfo.SaveAndRestoreSynchronizationContextField &&
1524-
(callInfo.SynchronizationContextLclNum != BAD_VAR_NUM));
1525+
assert(callInfo.SaveAndRestoreSynchronizationContextField);
1526+
assert(callInfo.ExecutionContextHandling == ExecutionContextHandling::SaveAndRestore);
1527+
assert(callInfo.SynchronizationContextLclNum != BAD_VAR_NUM);
15251528

15261529
// Insert call
15271530
// AsyncHelpers.CaptureContinuationContext(

0 commit comments

Comments
 (0)