Commit 142bd45
Refactor async calling convention detection to use MethodDesc extension method (#121420)
Consolidates async calling convention detection logic into a single
`MethodDesc` extension method, removing the need for
`MethodSignatureFlags.AsyncCall` flag.
**Changes:**
- **Added `IsAsyncCall` extension method** on `MethodDesc` that unifies
detection logic: returns true for async variants and async intrinsics
that don't return Task/ValueTask
- **Removed `MethodSignatureFlags.AsyncCall`** enum value and
`MethodSignature.IsAsyncCall` property
- **Updated call sites** in `CorInfoImpl.cs` to use the new extension
method for `CORINFO_CALLCONV_ASYNCCALL` and `CORJIT_FLAG_ASYNC`
- **Simplified `AsyncMethodVariant`** to no longer set the AsyncCall
flag in signature
**Rationale:**
Async calling convention is now determined at the MethodDesc level
(similar to hidden parameters in generic calling conventions) rather
than being stored in signature flags. This properly handles both async
variants (which have the flag set by signature transformation) and async
intrinsics (which have `IsAsync` metadata but don't return
Task/ValueTask).
```csharp
// Before: Logic scattered across multiple locations
if (method.IsAsync && !method.Signature.ReturnsTaskOrValueTask())
sig->callConv |= CorInfoCallConv.CORINFO_CALLCONV_ASYNCCALL;
// After: Unified in extension method
if (method.IsAsyncCall())
sig->callConv |= CorInfoCallConv.CORINFO_CALLCONV_ASYNCCALL;
```
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/dotnet/runtime/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>1 parent ce59648 commit 142bd45
File tree
4 files changed
+9
-20
lines changed- src/coreclr/tools/Common
- Compiler
- JitInterface
- TypeSystem/Common
4 files changed
+9
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
42 | | - | |
43 | 41 | | |
44 | 42 | | |
45 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
156 | 163 | | |
157 | 164 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
836 | | - | |
837 | | - | |
838 | | - | |
| 836 | + | |
839 | 837 | | |
840 | 838 | | |
841 | 839 | | |
| |||
882 | 880 | | |
883 | 881 | | |
884 | 882 | | |
885 | | - | |
886 | 883 | | |
887 | 884 | | |
888 | 885 | | |
| |||
4337 | 4334 | | |
4338 | 4335 | | |
4339 | 4336 | | |
4340 | | - | |
4341 | | - | |
4342 | | - | |
4343 | | - | |
| 4337 | + | |
4344 | 4338 | | |
4345 | 4339 | | |
4346 | 4340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
| |||
140 | 138 | | |
141 | 139 | | |
142 | 140 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | 141 | | |
152 | 142 | | |
153 | 143 | | |
| |||
0 commit comments