Skip to content

Commit 9bcd3e7

Browse files
authored
[RuntimeAsync] Make runtime async tests to build and pass locally. (#115499)
* missing parts to make tests buildable * move tests into directories * intrisics location * fix for arm64
1 parent c53ccee commit 9bcd3e7

File tree

70 files changed

+25
-12
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+25
-12
lines changed

src/coreclr/jit/importer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6041,7 +6041,7 @@ bool Compiler::impMatchAwaitPattern(const BYTE* codeAddr, const BYTE* codeEndp,
60416041

60426042
// check if it is an Await intrinsic
60436043
if (eeIsIntrinsic(nextCallTok.hMethod) &&
6044-
lookupNamedIntrinsic(nextCallTok.hMethod) == NI_System_Runtime_CompilerServices_RuntimeHelpers_Await)
6044+
lookupNamedIntrinsic(nextCallTok.hMethod) == NI_System_Runtime_CompilerServices_AsyncHelpers_Await)
60456045
{
60466046
// yes, this is an Await
60476047
return true;

src/coreclr/jit/importercalls.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3333,15 +3333,15 @@ GenTree* Compiler::impIntrinsic(CORINFO_CLASS_HANDLE clsHnd,
33333333
return node;
33343334
}
33353335

3336-
if (ni == NI_System_Runtime_CompilerServices_RuntimeHelpers_AsyncSuspend)
3336+
if (ni == NI_System_Runtime_CompilerServices_AsyncHelpers_AsyncSuspend)
33373337
{
33383338
GenTree* node = gtNewOperNode(GT_RETURN_SUSPEND, TYP_VOID, impPopStack().val);
33393339
node->SetHasOrderingSideEffect();
33403340
node->gtFlags |= GTF_CALL | GTF_GLOB_REF;
33413341
return node;
33423342
}
33433343

3344-
if (ni == NI_System_Runtime_CompilerServices_RuntimeHelpers_Await)
3344+
if (ni == NI_System_Runtime_CompilerServices_AsyncHelpers_Await)
33453345
{
33463346
// These are marked intrinsics simply to match them by name in
33473347
// the Await pattern optimization. Make sure we keep pIntrinsicName assigned
@@ -11059,13 +11059,16 @@ NamedIntrinsic Compiler::lookupNamedIntrinsic(CORINFO_METHOD_HANDLE method)
1105911059
{
1106011060
result = NI_System_Runtime_CompilerServices_RuntimeHelpers_GetMethodTable;
1106111061
}
11062-
else if (strcmp(methodName, "Await") == 0)
11062+
}
11063+
else if (strcmp(className, "AsyncHelpers") == 0)
11064+
{
11065+
if (strcmp(methodName, "AsyncSuspend") == 0)
1106311066
{
11064-
result = NI_System_Runtime_CompilerServices_RuntimeHelpers_Await;
11067+
result = NI_System_Runtime_CompilerServices_AsyncHelpers_AsyncSuspend;
1106511068
}
11066-
else if (strcmp(methodName, "AsyncSuspend") == 0)
11069+
else if (strcmp(methodName, "Await") == 0)
1106711070
{
11068-
result = NI_System_Runtime_CompilerServices_RuntimeHelpers_AsyncSuspend;
11071+
result = NI_System_Runtime_CompilerServices_AsyncHelpers_Await;
1106911072
}
1107011073
}
1107111074
else if (strcmp(className, "StaticsHelpers") == 0)

src/coreclr/jit/namedintrinsiclist.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ enum NamedIntrinsic : unsigned short
121121
NI_System_Runtime_CompilerServices_RuntimeHelpers_IsKnownConstant,
122122
NI_System_Runtime_CompilerServices_RuntimeHelpers_IsReferenceOrContainsReferences,
123123
NI_System_Runtime_CompilerServices_RuntimeHelpers_GetMethodTable,
124-
NI_System_Runtime_CompilerServices_RuntimeHelpers_Await,
125-
NI_System_Runtime_CompilerServices_RuntimeHelpers_AsyncSuspend,
124+
125+
NI_System_Runtime_CompilerServices_AsyncHelpers_AsyncSuspend,
126+
NI_System_Runtime_CompilerServices_AsyncHelpers_Await,
126127

127128
NI_System_Runtime_CompilerServices_StaticsHelpers_VolatileReadAsByref,
128129

src/coreclr/vm/arm64/stubs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ void HijackFrame::UpdateRegDisplay_Impl(const PREGDISPLAY pRD, bool updateFloats
772772

773773
pRD->volatileCurrContextPointers.X0 = &m_Args->X0;
774774
pRD->volatileCurrContextPointers.X1 = &m_Args->X1;
775-
pRD->volatileCurrContextPointers.X1 = &m_Args->X2;
775+
pRD->volatileCurrContextPointers.X2 = &m_Args->X2;
776776

777777
pRD->pCurrentContext->X19 = m_Args->X19;
778778
pRD->pCurrentContext->X20 = m_Args->X20;

src/tests/async/Directory.Build.props

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Merged.props', $(MSBuildThisFileDirectory)..))" />
4+
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', $(MSBuildThisFileDirectory)..))" />
5+
6+
<PropertyGroup>
7+
<RunAnalyzers>true</RunAnalyzers>
8+
<NoWarn>$(NoWarn);xUnit1013</NoWarn>
9+
<EnableNETAnalyzers>false</EnableNETAnalyzers>
10+
</PropertyGroup>
11+
</Project>

src/tests/async/asynctests.csproj renamed to src/tests/async/async.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<ItemGroup>
33
<MergedWrapperProjectReference Include="*/**/*.??proj" />
4-
<MergedWrapperProjectReference Include="*.??proj" />
5-
<MergedWrapperProjectReference Remove="$(MSBuildProjectName).csproj" />
64

75
<!-- Remove manual benchmarks from the test wrapper -->
86
<MergedWrapperProjectReference Remove="eh-microbench.csproj" />
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)