Skip to content

Commit 0f28558

Browse files
davidwrightonjkotasCopilot
authored
[clr-interp] Async Resume stubs are exclusive to the JIT as they use a set of intrinsics that are JIT specific (#123046)
Implement the second half of the intrinsic for SetNextCallAsyncContinuation. This allows the interpreter to correctly generate code for async resumption stubs (although it won't use them itself, as the interpreter has a different path for calling async resume stubs that we don't currently plan to remove. This is used in some of our interpreter test modes where the runtime may choose to JIT a runtime async method and interpret its associated async resumption stub. --------- Co-authored-by: Jan Kotas <jkotas@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d5ac199 commit 0f28558

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/coreclr/interpreter/compiler.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4949,8 +4949,18 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re
49494949
m_pStackPointer--;
49504950
int32_t continuationArg = m_pStackPointer[0].var;
49514951

4952-
AddIns(INTOP_LDNULL);
4953-
m_pLastNewIns->SetDVar(continuationArg);
4952+
if (m_nextCallAsyncContinuationVar == -1)
4953+
{
4954+
AddIns(INTOP_LDNULL);
4955+
m_pLastNewIns->SetDVar(continuationArg);
4956+
}
4957+
else
4958+
{
4959+
AddIns(INTOP_MOV_P);
4960+
m_pLastNewIns->SetSVar(m_nextCallAsyncContinuationVar);
4961+
m_pLastNewIns->SetDVar(continuationArg);
4962+
m_nextCallAsyncContinuationVar = -1;
4963+
}
49544964
callArgs[continuationArgLocation] = continuationArg;
49554965
}
49564966

0 commit comments

Comments
 (0)