Skip to content

Commit 0d320a2

Browse files
Copilotjakobbotsch
andauthored
Revert runtime-async gating and disable crossgen for InvalidCSharp
Co-authored-by: jakobbotsch <[email protected]>
1 parent e51d2f4 commit 0d320a2

5 files changed

Lines changed: 2 additions & 88 deletions

File tree

‎src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,6 @@
5454
<DocumentationFile>$(OutputPath)$(MSBuildProjectName).xml</DocumentationFile>
5555
</PropertyGroup>
5656

57-
<!-- Mirror the runtime-async support predicate from src/libraries/Directory.Build.targets so the
58-
BypassReadyToRun attributes on the MethodImpl.Async helpers can be conditioned on it. -->
59-
<PropertyGroup Condition="'$(RuntimeAsyncSupported)' == ''">
60-
<RuntimeAsyncSupported Condition="'$(TargetOS)' != 'browser'
61-
and '$(TargetOS)' != 'wasi'
62-
and '$(TargetOS)' != 'android'
63-
and '$(TargetsAppleMobile)' != 'true'
64-
and '$(RuntimeFlavor)' != 'Mono'">true</RuntimeAsyncSupported>
65-
</PropertyGroup>
66-
67-
<PropertyGroup>
68-
<DefineConstants Condition="'$(RuntimeAsyncSupported)' == 'true'">$(DefineConstants);RUNTIME_ASYNC_SUPPORTED</DefineConstants>
69-
</PropertyGroup>
70-
7157
<!-- Platform specific properties -->
7258
<PropertyGroup Condition="'$(Platform)' == 'x64'">
7359
<DefineConstants>$(DefineConstants);TARGET_AMD64</DefineConstants>

‎src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncHelpers.CoreCLR.cs‎

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,6 @@ private static unsafe Continuation AllocContinuationClass(Continuation prevConti
349349
}
350350
#endif
351351

352-
#if !RUNTIME_ASYNC_SUPPORTED
353-
[BypassReadyToRun]
354-
#endif
355352
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.Async)]
356353
private static unsafe void AwaitTask(Task task, ConfigureAwaitOptions options)
357354
{
@@ -386,9 +383,6 @@ private static unsafe void AwaitTask(Task task, ConfigureAwaitOptions options)
386383
AsyncSuspend(taskCont);
387384
}
388385

389-
#if !RUNTIME_ASYNC_SUPPORTED
390-
[BypassReadyToRun]
391-
#endif
392386
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.Async)]
393387
private static unsafe T AwaitTask<T>(Task<T> task, ConfigureAwaitOptions options)
394388
{
@@ -434,9 +428,6 @@ private static unsafe T AwaitTask<T>(Task<T> task, ConfigureAwaitOptions options
434428
/// awaiting a completion of an underlying Task or ValueTaskSource.
435429
/// </summary>
436430
/// <param name="valueTask">ValueTask whose completion we are awaiting.</param>
437-
#if !RUNTIME_ASYNC_SUPPORTED
438-
[BypassReadyToRun]
439-
#endif
440431
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.Async)]
441432
private static unsafe void TransparentAwaitValueTask(ValueTask valueTask)
442433
{
@@ -485,9 +476,6 @@ private static unsafe void TransparentAwaitValueTask(ValueTask valueTask)
485476
AsyncSuspend(nextCont);
486477
}
487478

488-
#if !RUNTIME_ASYNC_SUPPORTED
489-
[BypassReadyToRun]
490-
#endif
491479
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.Async)]
492480
private static unsafe void AwaitValueTaskSource(IValueTaskSource source, short token, bool continueOnCapturedContext)
493481
{
@@ -524,9 +512,6 @@ private static unsafe void AwaitValueTaskSource(IValueTaskSource source, short t
524512
AsyncSuspend(vtsCont);
525513
}
526514

527-
#if !RUNTIME_ASYNC_SUPPORTED
528-
[BypassReadyToRun]
529-
#endif
530515
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.Async)]
531516
private static unsafe T TransparentAwaitValueTaskOfT<T>(ValueTask<T> valueTask)
532517
{
@@ -575,9 +560,6 @@ private static unsafe T TransparentAwaitValueTaskOfT<T>(ValueTask<T> valueTask)
575560
return default!;
576561
}
577562

578-
#if !RUNTIME_ASYNC_SUPPORTED
579-
[BypassReadyToRun]
580-
#endif
581563
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.Async)]
582564
private static unsafe T AwaitValueTaskSource<T>(IValueTaskSource<T> source, short token, bool continueOnCapturedContext)
583565
{
@@ -619,9 +601,6 @@ private static unsafe T AwaitValueTaskSource<T>(IValueTaskSource<T> source, shor
619601
/// Used by internal thunks that implement awaiting on Task.
620602
/// </summary>
621603
/// <param name="task">Task whose completion we are awaiting.</param>
622-
#if !RUNTIME_ASYNC_SUPPORTED
623-
[BypassReadyToRun]
624-
#endif
625604
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.Async)]
626605
private static unsafe void TransparentAwait(Task task)
627606
{
@@ -651,9 +630,6 @@ private static unsafe void TransparentAwait(Task task)
651630
/// Used by internal thunks that implement awaiting on Task.
652631
/// </summary>
653632
/// <param name="task">Task whose completion we are awaiting.</param>
654-
#if !RUNTIME_ASYNC_SUPPORTED
655-
[BypassReadyToRun]
656-
#endif
657633
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.Async)]
658634
private static unsafe T TransparentAwaitOfT<T>(Task<T> task)
659635
{

‎src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,6 @@
4646
<Features>$(Features);runtime-async=on</Features>
4747
</PropertyGroup>
4848

49-
<!-- Mirror the runtime-async support predicate from src/libraries/Directory.Build.targets so the
50-
BypassReadyToRun attributes on the MethodImpl.Async helpers can be conditioned on it. -->
51-
<PropertyGroup Condition="'$(RuntimeAsyncSupported)' == ''">
52-
<RuntimeAsyncSupported Condition="'$(TargetOS)' != 'browser'
53-
and '$(TargetOS)' != 'wasi'
54-
and '$(TargetOS)' != 'android'
55-
and '$(TargetsAppleMobile)' != 'true'
56-
and '$(RuntimeFlavor)' != 'Mono'">true</RuntimeAsyncSupported>
57-
</PropertyGroup>
58-
59-
<PropertyGroup>
60-
<DefineConstants Condition="'$(RuntimeAsyncSupported)' == 'true'">$(DefineConstants);RUNTIME_ASYNC_SUPPORTED</DefineConstants>
61-
</PropertyGroup>
62-
6349
<!-- Sources -->
6450
<ItemGroup>
6551
<Compile Include="$(CompilerCommonPath)\Internal\Runtime\DehydratedData.cs">

‎src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncHelpers.cs‎

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ namespace System.Runtime.CompilerServices
1414
public static partial class AsyncHelpers
1515
{
1616
#if CORECLR || NATIVEAOT
17-
// "BypassReadyToRun" keeps these MethodImpl.Async helpers out of AOT/R2R images on platforms
18-
// that don't support runtime-async (RUNTIME_ASYNC_SUPPORTED is not defined there). On those
19-
// platforms the JIT cannot emit code for runtime-async returns, so the helpers must be JITted.
2017
// Must be NoInlining because we use AsyncSuspend to manufacture an explicit suspension point.
2118
// It will not capture/restore any local state that is live across it.
2219

@@ -25,9 +22,6 @@ public static partial class AsyncHelpers
2522
/// </summary>
2623
/// <typeparam name="TAwaiter">The awaiter type.</typeparam>
2724
/// <param name="awaiter">The awaiter to await.</param>
28-
#if !RUNTIME_ASYNC_SUPPORTED
29-
[BypassReadyToRun]
30-
#endif
3125
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.Async)]
3226
[StackTraceHidden]
3327
public static unsafe void AwaitAwaiter<TAwaiter>(TAwaiter awaiter) where TAwaiter : INotifyCompletion
@@ -47,9 +41,6 @@ public static unsafe void AwaitAwaiter<TAwaiter>(TAwaiter awaiter) where TAwaite
4741
/// </summary>
4842
/// <typeparam name="TAwaiter">The awaiter type.</typeparam>
4943
/// <param name="awaiter">The awaiter to await.</param>
50-
#if !RUNTIME_ASYNC_SUPPORTED
51-
[BypassReadyToRun]
52-
#endif
5344
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.Async)]
5445
[StackTraceHidden]
5546
public static unsafe void UnsafeAwaitAwaiter<TAwaiter>(TAwaiter awaiter) where TAwaiter : ICriticalNotifyCompletion
@@ -67,9 +58,6 @@ public static unsafe void UnsafeAwaitAwaiter<TAwaiter>(TAwaiter awaiter) where T
6758
/// <typeparam name="T">The result type produced by the task.</typeparam>
6859
/// <param name="task">The task to await.</param>
6960
[Intrinsic]
70-
#if !RUNTIME_ASYNC_SUPPORTED
71-
[BypassReadyToRun]
72-
#endif
7361
[MethodImpl(MethodImplOptions.Async)]
7462
[StackTraceHidden]
7563
public static T Await<T>(Task<T> task)
@@ -89,9 +77,6 @@ public static T Await<T>(Task<T> task)
8977
/// </summary>
9078
/// <param name="task">The task to await.</param>
9179
[Intrinsic]
92-
#if !RUNTIME_ASYNC_SUPPORTED
93-
[BypassReadyToRun]
94-
#endif
9580
[MethodImpl(MethodImplOptions.Async)]
9681
[StackTraceHidden]
9782
public static void Await(Task task)
@@ -112,9 +97,6 @@ public static void Await(Task task)
11297
/// <typeparam name="T">The result type produced by the value task.</typeparam>
11398
/// <param name="task">The value task to await.</param>
11499
[Intrinsic]
115-
#if !RUNTIME_ASYNC_SUPPORTED
116-
[BypassReadyToRun]
117-
#endif
118100
[MethodImpl(MethodImplOptions.Async)]
119101
[StackTraceHidden]
120102
public static T Await<T>(ValueTask<T> task)
@@ -153,9 +135,6 @@ public static T Await<T>(ValueTask<T> task)
153135
/// </summary>
154136
/// <param name="task">The value task to await.</param>
155137
[Intrinsic]
156-
#if !RUNTIME_ASYNC_SUPPORTED
157-
[BypassReadyToRun]
158-
#endif
159138
[MethodImpl(MethodImplOptions.Async)]
160139
[StackTraceHidden]
161140
public static void Await(ValueTask task)
@@ -196,9 +175,6 @@ public static void Await(ValueTask task)
196175
/// </summary>
197176
/// <param name="configuredAwaitable">The configured awaitable to await.</param>
198177
[Intrinsic]
199-
#if !RUNTIME_ASYNC_SUPPORTED
200-
[BypassReadyToRun]
201-
#endif
202178
[MethodImpl(MethodImplOptions.Async)]
203179
[StackTraceHidden]
204180
public static void Await(ConfiguredTaskAwaitable configuredAwaitable)
@@ -222,9 +198,6 @@ public static void Await(ConfiguredTaskAwaitable configuredAwaitable)
222198
}
223199

224200
[Intrinsic]
225-
#if !RUNTIME_ASYNC_SUPPORTED
226-
[BypassReadyToRun]
227-
#endif
228201
[MethodImpl(MethodImplOptions.Async | MethodImplOptions.NoInlining)]
229202
[StackTraceHidden]
230203
private static void AwaitTaskWithRareOptions(ConfiguredTaskAwaitable.ConfiguredTaskAwaiter awaiter)
@@ -242,9 +215,6 @@ private static void AwaitTaskWithRareOptions(ConfiguredTaskAwaitable.ConfiguredT
242215
/// </summary>
243216
/// <param name="configuredAwaitable">The configured value task awaitable to await.</param>
244217
[Intrinsic]
245-
#if !RUNTIME_ASYNC_SUPPORTED
246-
[BypassReadyToRun]
247-
#endif
248218
[MethodImpl(MethodImplOptions.Async)]
249219
[StackTraceHidden]
250220
public static void Await(ConfiguredValueTaskAwaitable configuredAwaitable)
@@ -287,9 +257,6 @@ public static void Await(ConfiguredValueTaskAwaitable configuredAwaitable)
287257
/// <typeparam name="T">The result type produced by the awaitable.</typeparam>
288258
/// <param name="configuredAwaitable">The configured awaitable to await.</param>
289259
[Intrinsic]
290-
#if !RUNTIME_ASYNC_SUPPORTED
291-
[BypassReadyToRun]
292-
#endif
293260
[MethodImpl(MethodImplOptions.Async)]
294261
[StackTraceHidden]
295262
public static T Await<T>(ConfiguredTaskAwaitable<T> configuredAwaitable)
@@ -314,9 +281,6 @@ public static T Await<T>(ConfiguredTaskAwaitable<T> configuredAwaitable)
314281
/// <typeparam name="T">The result type produced by the awaitable.</typeparam>
315282
/// <param name="configuredAwaitable">The configured awaitable to await.</param>
316283
[Intrinsic]
317-
#if !RUNTIME_ASYNC_SUPPORTED
318-
[BypassReadyToRun]
319-
#endif
320284
[MethodImpl(MethodImplOptions.Async)]
321285
[StackTraceHidden]
322286
public static T Await<T>(ConfiguredValueTaskAwaitable<T> configuredAwaitable)

‎src/tests/Interop/UnmanagedCallersOnly/InvalidCSharp.ilproj‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk.IL">
22
<PropertyGroup>
33
<OutputType>library</OutputType>
4+
<!-- crossgen2 cannot handle non-task-returning runtime-async methods that are not in CoreLib -->
5+
<CrossGenTest>false</CrossGenTest>
46
</PropertyGroup>
57
<ItemGroup>
68
<Compile Include="InvalidCallbacks.il" />

0 commit comments

Comments
 (0)